Re: Database model color switching

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie (dorbie++at++bitch.reading.sgi.com)
Mon, 16 Oct 1995 14:02:27 +0100


Scene graph traversal has changed slightly in Performer 2.0, here's
an example of how to traverse a loaded node and modify the GeoStates.
It checks for wireline GeoSets and changes their geostates which contain
lines. It then enables blended non occluding transparency in the GeoStates,
perfect if you want to perform line antialiasing on IMPACT, provided
you load a model with some wireline replication included.
You also need to turn linesmooth on in GL or OpenGL, do this after your
InitGfx call:

#ifdef IRISGL
    linesmooth(SML_ON);
#endif

#ifndef IRISGL
    glEnable(GL_LINE_SMOOTH);
#endif

Anyway, to return to the subject, you can use similar code to that below
to modify geostates or try using draw callbacks to change the material
and override the material state, examples have already been posted to
this group.

Look at the manual entry for:

pfNodeTravFuncs

Good Luck,

Angus.

void Modify_Tree(pfNode *node);
static void ModifyGStates(pfGeode *geode);

void Modify_Tree(pfNode *node)
{
    long i;
    pfType *type;

    type = pfGetType(node);

    if( pfIsExactType(node, pfGetGeodeClassType()) )
    {
        ModifyGStates((pfGeode*)node);
    }
    else if( pfIsOfType(node, pfGetGroupClassType()) )
    {
        /*
         * speed up sequence
        */
        if( pfIsExactType(node, pfGetSeqClassType()) )
        {
           printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> Accelerated a sequence\n");
           pfSeqDuration((pfSequence *)node, 3.0f, -1);
        }

        /*
         * Recurse on children
        */
        for(i = 0; i < pfGetNumChildren(node); i++)
            Modify_Tree( pfGetChild(node, i) );
    }
}

static void ModifyGStates(pfGeode *geode)
{
    long i, ng;
    pfGeoState *gstate;

    ng = pfGetNumGSets( geode);
    printf("found a geode with %d gsets\n",ng);

    if(ng > 0)
    {
      for(i = 0; i < ng; i++)
      {
        if(pfGetGSetPrimType(pfGetGSet( geode, i)) == PFGS_LINES ||
           pfGetGSetPrimType(pfGetGSet( geode, i)) == PFGS_LINESTRIPS)
        {
          gstate = pfGetGSetGState( pfGetGSet( geode, i) );
          printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> Blended a wireline Model\n");
          pfGStateMode( gstate, PFSTATE_TRANSPARENCY,
                PFTR_BLEND_ALPHA | PFTR_NO_OCCLUDE);
        }
      }

    }
}

On Oct 16, 8:20am, Pat Stevenson wrote:
> Subject: Database model color switching
>
> Hello,
> I am a new grad starting out with Performer. I have manuals for 1.2 but my
> company is using 2.0 second beta release. Since I am new, I haven't gotten
the
> hang of any intricate details, but a synopsis follows:
>
> We are using Performer to create battle scenarios. Terrain, models,
> simulation,
> and DIS are all involved. The main interface is in Motif with Inventor
widgets
> and the problem I have is in a color filter for the database models. We have
> enemy, manned, and other such targets that are supposed to be selected and
> shown in other colors beside their inherit ones from loading. I can't figure
> out how to either insert some kind of color node, or traverse the model's
> GeoSets and change the default colors. Please send me any information, or a
> pointer where I can find more out. I have called Performer's beta developer,
> but have not received any calls back. Thanks for any help you can provide.
>
> Pat Stevenson
> gstevens++at++harris.com
>
>
>-- End of excerpt from Pat Stevenson

-- 
Angus Dorbie,
Silicon Graphics Ltd, UK
dorbie++at++reading.sgi.com

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:51:57 PDT

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