Re: [Plib-devel] directional lights
Brought to you by:
sjbaker
From: Curtis L. O. <cu...@in...> - 2000-08-23 01:25:41
|
Sam, Thanks for the response. I'm not sure if the specifics of what you describe will work, but perhaps the general approach would. The view direction doesn't really affect the choice I want to make. The object position and view position produce one vector, but that needs to be compared to a vector defining the optimal view direction of the object. Perhaps we would need to derive a new ssgSelector type class that saves this directional vector and some tolerance and then does the comparison when the scene graph is traversed. Curt. Sam Stickland writes: > 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 -- Curtis Olson Human Factors Research Lab Flight Gear Project Twin Cities cu...@hf... cu...@fl... Minnesota http://www.menet.umn.edu/~curt http://www.flightgear.org |