Re: [Plib-devel] directional lights
Brought to you by:
sjbaker
From: Sam S. <sa...@sp...> - 2000-08-22 22:35:41
|
> Steve, > > Does plib provide any facilities for drawing or not drawing an object > based on relative view angle? I'm pondering how I might impliment > directional lights such as VASI for runways ... lights that change > color depending on your relative angle to them. Hi, I'm not Steve but I think you could use the predraw callback to do this. Something like: int myCB ( ssgEntity *entity) { /* Get the camera position */ sgVec3 camPos ; ssgGetCurrentContext () -> getCameraPosition ( pos ) ; /* Get the objects position */ sgVec3 objPos ; sgSetVec3 ( objPos, entity -> getBSphere () -> getCenter () ) ; /* Work out the angle between the two objects, and based on that either change the colour of the light ... */ sgVec4 *col = (ssgLeaf *) (entity) -> getColour ( blah) ; sgSetVec4 ( *col, 1.0f, 0.0f, 0.0f, 0.5f ) ; /* etc, you could also use getState() and alter that */ /* Choose to draw the object by returning TRUE to FALSE */ return TRUE; } Does that do the trick? Sam |