pfPartition(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
NAMEpfPartition - Create and update pfPartition spatial partitioning node.
FUNCTION SPECIFICATION
#include <Performer/pf/pfPartition.h>
pfPartition::pfPartition();
static pfType * pfPartition::getClassType(void);
void pfPartition::setVal(int which, float val);
float pfPartition::getVal(int which);
void pfPartition::setAttr(int which, void *attr);
void* pfPartition::getAttr(int which);
void pfPartition::build();
void pfPartition::update(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfPartition is derived from the parent class
pfGroup, so each of these member functions of class pfGroup are also
directly usable with objects of class pfPartition. This is also true for
ancestor classes of class pfGroup.
int pfGroup::addChild(pfNode *child);
int pfGroup::insertChild(int index, pfNode *child);
int pfGroup::replaceChild(pfNode *old, pfNode *new);
int pfGroup::removeChild(pfNode* child);
int pfGroup::searchChild(pfNode* child);
pfNode * pfGroup::getChild(int index);
int pfGroup::getNumChildren(void);
int pfGroup::bufferAddChild(pfNode *child);
int pfGroup::bufferRemoveChild(pfNode *child);
Since the class pfGroup is itself derived from the parent class pfNode,
objects of class pfPartition can also be used with these functions
designed for objects of class pfNode.
pfGroup * pfNode::getParent(int i);
int pfNode::getNumParents(void);
void pfNode::setBound(pfSphere *bsph, int mode);
int pfNode::getBound(pfSphere *bsph);
pfNode* pfNode::clone(int mode);
pfNode* pfNode::bufferClone(int mode, pfBuffer *buf);
int pfNode::flatten(int mode);
Page 1
pfPartition(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
int pfNode::setName(const char *name);
const char * pfNode::getName(void);
pfNode* pfNode::find(const char *pathName, pfType *type);
pfNode* pfNode::lookup(const char *name, pfType* type);
int pfNode::isect(pfSegSet *segSet, pfHit **hits[]);
void pfNode::setTravMask(int which, uint mask, int setMode,
int bitOp);
uint pfNode::getTravMask(int which);
void pfNode::setTravFuncs(int which, pfNodeTravFuncType pre,
pfNodeTravFuncType post);
void pfNode::getTravFuncs(int which, pfNodeTravFuncType *pre,
pfNodeTravFuncType *post);
void pfNode::setTravData(int which, void *data);
void * pfNode::getTravData(int which);
void pfNode::setTravMode(int which, int mode, int val);
int pfNode::getTravMode(int which, int mode) const;
Since the class pfNode is itself derived from the parent class pfObject,
objects of class pfPartition can also be used with these functions
designed for objects of class pfObject.
void* pfObject::operator new(size_t);
void* pfObject::operator new(size_t, pfFluxMemory *fmem);
void pfObject::setUserData(void *data);
void pfObject::setUserData(int slot, void *data);
void* pfObject::getUserData(pfObject *obj);
void* pfObject::getUserData(pfObject *obj, int slot);
int pfObject::getNumUserData();
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfPartition can also be used with these
functions designed for objects of class pfMemory.
void* pfMemory::getData(const void *ptr);
pfType * pfMemory::getType();
int pfMemory::isOfType(pfType *type);
int pfMemory::isExactType(pfType *type);
const char * pfMemory::getTypeName();
int pfMemory::copy(pfMemory *src);
int pfMemory::compare(const pfMemory *mem);
void pfMemory::print(uint which, uint verbose, char *prefix,
FILE *file);
int pfMemory::getArena(void *ptr);
void* pfMemory::getArena();
int pfMemory::ref();
int pfMemory::unref();
int pfMemory::unrefDelete();
int pfMemory::unrefGetRef();
Page 2
pfPartition(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
int pfMemory::getRef();
int pfMemory::checkDelete();
int pfMemory::isFluxed();
void * pfMemory::getArena();
int pfMemory::getSize();
DESCRIPTION
A pfPartition is a type of pfGroup for organizing the subgraph of a scene
into a static data structure which is more efficient for intersection
testing with pfNodeIsectSegs for some databases. pfPartition does not
affect culling performance nor does it improve intersection performance
under transformation nodes, pfSwitch nodes, pfMorph nodes or pfSequence
nodes.
new pfPartition creates and returns a handle to a pfPartition. Like
other pfNodes, pfPartitions are always allocated from shared memory and
cannot be created statically, on the stack or in arrays. pfPartitions
should be deleted using pfDelete rather than the delete operator.
pfPartition::getClassType returns the pfType* for the class pfPartition.
The pfType* returned by pfPartition::getClassType is the same as the
pfType* returned by invoking the virtual function getType on any instance
of class pfPartition. Because OpenGL Performer allows subclassing of
built-in types, when decisions are made based on the type of an object,
it is usually better to use the member function isOfType to test if an
object is of a type derived from a Performer type rather than to test for
strict equality of the pfType*'s.
pfPartition::build constructs a 2D spatial partitioning based on the
type.
Within the confines of the parameters set by pfPartition::setAttr, OpenGL
Performer attempts to construct an optimal partition based on the
distribution of vertices within the pfGeoSets in the subgraph of the
scene rooted at the partition. Information about the selected
partitioning is displayed when the pfNotifyLevel is debug or higher.
Because the search for the optimal partitioning is compute intensive,
once the partitioning has been determined for a particular database, the
range of the search should be restricted using pfPartition::setAttr.
pfPartition::update causes the scene graph under the partition to be
traversed and any changes incorporated into the spatial partitioning.
The partitioning itself does not change.
pfPartition::setAttr sets the partition attribute attr to the attribute
attr. Partition attributes are:
PFPART_MIN_SPACING
attr points to a pfVec3 specifying the minimum spacing between
partition dividers in each dimension. If not specified, the
default is 1/20th of the bounding box diagonal. When a
partition is built, a search is made between PFPART_MAX_SPACING
Page 3
pfPartition(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
and PFPART_MIN_SPACING.
PFPART_MAX_SPACING
attr points to a pfVec3 specifying the maximum spacing between
partition dividers in each dimension. If not specified, the
default is 1/10th of the bounding box diagonal. When a
partition is built, a search is made between PFPART_MAX_SPACING
and PFPART_MIN_SPACING.
PFPART_ORIGIN
attr points to a pfVec3 specifying an origin for the partition.
If not specified, a search is done to find an optimal origin.
pfPartition::getAttr returns the partition attribute attr.
pfPartition::setVal sets the partition value val to the value val.
Partition values are:
PFPART_FINENESS
A value between 0.0 and 1.0 which indicates how fine of a
partitioning should be constructed. The subdivision is limited
by PFPART_MIN_SPACING and PFPART_MAX_SPACING. 1.0 causes
extremely fine subdivision. 0.0 causes no subdivision. 0.5 is
usually a good value and is the default.
pfPartition::getVal returns the partition value val.
A pfPartition behaves like a pfGroup when the mode in the pfSegSet used
with pfNodeIsectSegs includes PFTRAV_IS_NO_PART.
NOTES
pfPartitions are primarily useful for databases containing many axis-
aligned objects for which bounding spheres are a poor fit and when only
one or two segments are made per call to pfNodeIsectSegs. For example,
terrain following on gridded terrain is likely to benefit. For databases
such as this which themselves have a regular grid, it is also important
for performance that the origin and spacing of the partition align
exactly the terrain grid. pfPartitions do not currently help with the
problem pfGeoSets containing too much geometry.
BUGS
The search for an optimal grid is very thorough so that it takes a very
long time if the search domain is large. Once a good partitioning for a
database is determined, the PFPART_MIN_SPACING, PFPART_MAX_SPACING and
PFPART_ORIGIN can be set equal for much faster building.
Currently only partitionings in the XY plane are supported.
Page 4
pfPartition(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages
SEE ALSO
pfGroup, pfNode, pfNodeIsectSegs, pfNotifyLevel, pfScene
Page 5