Is it okay to call pfDCS:setTrans() in post-cull node callback?

New Message Reply Date view Thread view Subject view Author view

Jeremy Friesner (jaf++at++chem.ucsd.edu)
Wed, 18 Sep 1996 16:24:27 -0700 (PDT)


Hi All,

In order to save time in our Performer project (which contains lots of
moving objects in the scene), I'd like to be able to only move the
objects that are currently in the viewing frustum.

It seems to do that, I would want to call pfDCS::setTrans() and pfDCS::setRot()
in the Post-node cull callback. This used to work--however, I can't get
it to work anymore. :( What happens is after any call to setTrans() or
setRot(), the object dissappears from the screen. It appears that the
cull traversal is culling this function, because afterwards pfGetCullResult()
returns 0 for that object.

Any ideas as to what is going on here?

Thanks,
Jeremy

---- here's some relevant code ----

...

      // update scene graph only when node is visible!
      dcs->setTravFuncs(PFTRAV_CULL,
          PreNodeCullMoveCallback, PostNodeCullMoveCallback);
...

extern int PreNodeCullMoveCallback(pfTraverser *, void *)
{
  // do nothing for now
  return PFTRAV_CONT;
}

extern int PostNodeCullMoveCallback(pfTraverser* trav, void*)
{
  pfDCS* dcs = (pfDCS*) trav->getNode();
  assert(dcs->pfIsOfType(pfDCS::getClassType()),
         "class type of node isn't pfDCS %s ", dcs->getTypeName());

  // turns out we get called for every node; let's see if we are visible
  // before we do motion calculations
  if (pfGetCullResult() == PFIS_FALSE) return PFTRAV_CONT;

  ObjectInfo * obinfo = (ObjectInfo*)dcs->getUserData();
  if (obinfo)
  {
printf("obj moving to %f %f %f, %f %f %f\n",
 obinfo->loc.xyz[0], obinfo->loc.xyz[1], obinfo->loc.xyz[2],
 obinfo->loc.hpr[0], obinfo->loc.hpr[1], obinfo->loc.hpr[2]);

       dcs->setTrans(obinfo->loc.xyz[0], obinfo->loc.xyz[1], obinfo->loc.xyz[2]);
       dcs->setRot(obinfo->loc.hpr[0], obinfo->loc.hpr[1], obinfo->loc.hpr[2]);
  }
  return PFTRAV_CONT;
}

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++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:53:33 PDT

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