Scott McMillan (scott++at++ht.com)
Wed, 18 Sep 1996 09:47:43 -0400 (EDT)
Also note that many times in my apps, multiple GeoSets share the same
texture. This function will just set the same Texture multiple times.
Since I only do this once during initialization, I don't care about
efficiency.
scott
void upgradeTextures(pfNode *node)
{
if (node->isOfType(pfGroup::getClassType()))
{
for (int i=0; i<((pfGroup *) node)->getNumChildren(); i++)
{
upgradeTextures(((pfGroup *) node)->getChild(i));
}
}
else if (node->isOfType(pfGeode::getClassType()))
{
// okay...I have found a Geode now access the Texture, if present
pfGeode *gnode = (pfGeode *)node;
pfGeoSet *gset = gnode->getGSet(0);
if (gset)
{
pfGeoState* gstate = gset->getGState();
if (gstate)
{
pfTexture *tex =
(pfTexture *) gstate->getAttr(PFSTATE_TEXTURE);
if (tex)
{
// You probably should access the existing format and make a
// decision about what to change it to here. This is how you
// access the existing format:
// int old_format = tex->getFormat(PFTEX_INTERNAL_FORMAT);
tex->setFormat(PFTEX_INTERNAL_FORMAT, PFTEX_RGBA_8);
}
}
}
}
}
-- Scott McMillan | HT Medical, Inc. | Developing virtual environ- scott++at++ht.com | http://www.ht.com | ment medical and surgical Ph: 301-984-3706 | 6001 Montrose Rd., Ste. 902 | simulations and surgery Fax: 301-984-2104 | Rockville, MD 20852 | simulation creation tools.======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:33 PDT