Static BBox doesn't work

New Message Reply Date view Thread view Subject view Author view

Wade Olsen (wade++at++slack.shoreline-studios.com)
Mon, 13 Oct 1997 12:28:46 -0700


I'm unable to get static bounding boxes to work. Whenever I try to
apply one it seems to be ignored and a wacky bogus one is used
instead.

Is there some other issue beyond the just calling

        gset->setBound( bbox, PFBOUND_STATIC );

that I nead to be aware of?

I've include a minimal test case that exhibits the problem. After
running briefly, the scene graph is dumped to "scene.out"

------------------------bbox.c++--------------------------------------------

#include <Performer/pf.h>
#include <Performer/pr/pfGeoState.h>
#include <Performer/pr/pfGeoSet.h>
#include <Performer/pf/pfGeode.h>
#include <Performer/pf/pfScene.h>
#include <Performer/pf/pfChannel.h>

#define performerNew(type,num) (type *)(pfMalloc(sizeof(type) * num, pfGetSharedArena()))

void
main()
{
  pfInit();
  pfMultiprocess(0);
  pfConfig();
   
  pfGeoState * gstate = new pfGeoState;

  pfVec3 * verts = performerNew(pfVec3, 4);
  verts[0].set(-0.51f, -0.5f, 0.0f);
  verts[1].set(0.5f, -0.5f, 0.0f);
  verts[2].set(-0.5f, 0.5f, 0.0f);
  verts[3].set(0.5f, 0.5f, 0.0f);

  int * lengths = performerNew( int, 1 );
  lengths[0] = 4;

  pfVec4 * colors = performerNew(pfVec4, 1);
  colors[0].set(1.0, 1.0, 1.0, 1.0);

  //==== Create Bounding Box ====//
  pfBox * bbox = performerNew(pfBox, 1);
  bbox->min.set(-1, -1, -1);
  bbox->min.set(1, 1, 1);

  // Create the geoset
  pfGeoSet * gset = new pfGeoSet;

  // If the line below is uncommented, A wacky bounding sphere
  // ends up the geode.
  //
  gset->setBound( bbox, PFBOUND_STATIC );

  gset->setPrimType(PFGS_TRISTRIPS);
  gset->setPrimLengths( lengths );
  gset->setNumPrims(1);
  gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, verts, 0);
  gset->setAttr(PFGS_COLOR4, PFGS_OVERALL, colors, 0);
  gset->setGState(gstate);

  // Create a geode
  pfGeode * geode = new pfGeode;
  geode->addGSet(gset);

  pfScene * scene = new pfScene;
  scene->addChild(geode);

  pfVec3 xyz(0, 0, 2);
  pfVec3 hpr(0, -90, 0);
  pfChannel * channel = new pfChannel(pfGetPipe(0));
  channel->setScene(scene);
  channel->setView(xyz, hpr);

  for (int i = 0; i < 60; i++)
    {
      pfSync();
      pfFrame();
    }
   
  FILE * file = fopen ("scene.out","w");
  pfPrint(scene, PFTRAV_SELF | PFTRAV_DESCEND, PFPRINT_VB_DEBUG, file);
  fclose(file);
}
--------------------------------Makefile------------------------------------
include /usr/include/make/commondefs

TARGETS = bbox

LLDOPTS = \
        -lpf \
        -lpf_ogl \
        -limage \
        -lGLU \
        -lGL \
        -lX11 \
        -lm \
        -lfpe \
        ${NULL}

default: ${TARGETS}

include /usr/include/make/commonrules

-- 
-----------------------------
Wade Olsen, Shoreline Studios
e-mail:	wade++at++shoreline-studios.com
phone:	650-969-7896
fax:	650-969-7864
www:	http://www.shoreline-studios.com
=======================================================================
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:56:04 PDT

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