John Rohlf (jrohlf++at++tubes)
Thu, 3 Nov 94 13:01:17 PST
Not directly. Currently, if a pfLightSource has a non-empty
bounding sphere, it will be culled to the viewing frustum. Culling
to the pfLightSource bounding sphere is on our TODO list but it's
not a real high priority.
> 2) Does the limitions of 8 GL-Lightsources refer to a pfChannel or a
> pfPipe ?
A pfChannel.
> 3) Another solution could be to illuminate just certain objects of the
> scene. To get this I wrote another nodeDrawCallback-function for a
> certain object (node), where I switch the respective lightsources
> on. These are the sources of the pre- und post-callback:
>
> /* Pre Node DRAW Callback for lighting */
> long preDrawLight(pfTraverser *trav, void *data)
> {
> pfVec3 xyz, hpr;
>
> int i;
> userNodeDataTyp *myData =
> (userNodeDataTyp*)pfGetUserData(pfGetTravNode(trav));
> ASSERT(myData);
>
> pfPushIdentMatrix();
>
> for (i=0; i<shared->nSpotLs; i++) {
> pfLightPos(shared->spotLs[i],0,0,0,1); // for testing
> pfLightOn(shared->spotLs[i]);
> }
>
> pfPopMatrix();
> /* normal continue */
> return(PFTRAV_CONT);
> }
>
> /* Post Node Draw Callback */
> long postDrawLight(pfTraverser *trav, void *data)
> {
> int i;
> for (i=0; i<shared->nSpotLsAll; i++) {
> pfLightOff(shared->spotLs[i]);
> }
> // pfPopMatrix();
> return(PFTRAV_CONT);
> }
>
> Unfortunately, this solution is working just like a headlight,
> because the lightsource is moving depending on the viewer-position.
> If I move the pfPopMatrix to the PostNodeCallBack-function, the
> node is not rendered, which is understandable. Is there any chance to
> solve the problem with the method above ? I suppose pfLightOn is
> not of any use in nodeDrawCallbacks at all. If so, is there an other
> way to illuminate certain objects only, except modifying the
> pfGStateAttr ?
This callback method will work if you have the appropriate
ModelView matrix set up. If you don't want headlight mode, then
don't load an identity matrix - leave the ModelView matrix alone.
Another option is to set the PFSTATE_LIGHTS attribute of
your pfGeoStates. Just call pfGStateAttr and pass it an array of
pfLights that you wish to use.
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:38 PDT