Re: Coloring pfGroups

New Message Reply Date view Thread view Subject view Author view

John Rohlf (jrohlf++at++tubes)
Tue, 23 Nov 93 12:34:28 -0800


>We have an immediate need to turn a model black at sim time. We need to
>be able to (given a pfGroup *) change all the geosets in that group to
>use a single color (like black for instance).
>
>Is there a way to do this with
>
>pfNodeTravFuncs(mygroup,
> PFTRAV_DRAW,
> my_gl_func_to_color_everything_black,
> if_this_thing_says_ok,
> NULL,
> NULL);
>
>I haven't tried it, but I expect the GeoSet to override any color or
>texture that I use to turn this black (since I looked at the pfPrint of
>the group and found per vertex color and texture Attributes on the
>pfGeoSet level of the group model that I want to turn black).
>
>If I do lighting hacks (like a light with a color of black),
>I am assuming that I will have to re-enable the lighting in the post callback.
>
>We would ultimately like to be able to have some kind of pfSwitch that
>handles this by managing two Groups each with its own color settings,
>or else some way that implements this as part of the scene database.
>
>Anyway, we have not come up with a clear cut solution, and just thought
>that someone might know of a way to implement this type of thing.
>
>Anyone have a good method in performer? Also we have the same need for
>switching textures (IE having two textures that we can switch between
>at sim time).

        Colors are set locally by pfGeoSets unless lighting is active
and lmcolor mode is off (LMC_NULL). What you should do is

                1. enable lighting: pfEnable(PFEN_LIGHTING);
                2. apply a lighting model without ambient: pfApplyLModel()
                3. apply a material without ambient: pfApplyMtl()
                4. apply a black light: pfLightOn()
                5. disable lmcolor mode:
                        pfMtlColorMode(mtl, PFMTL_FRONT, PFMTL_CMODE_NULL);

Furthermore, you should override all of the above state so they cannot
be modified by any pfGeoStates etc:

        pfOverride(PFSTATE_ENLIGHTING|PFSTATE_LMODEL etc..., 1);


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:06 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.