Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Builder Class Reference

The main driver class to the builder package. More...

#include <builder.h>

List of all members.

Public Member Functions

 Builder ()
 ~Builder ()
bool add_prim (const BuilderBucket &bucket, const BuilderPrim &prim)
 Adds the indicated nonindexed primitive, along with its associated bucket, to the builder's internal structures.

bool add_prim (const BuilderBucket &bucket, const BuilderPrimI &prim)
 Adds the indicated indexed primitive, along with its associated bucket, to the builder's internal structures.

bool add_prim_nonindexed (const BuilderBucket &bucket, const BuilderPrimI &prim)
 Adds the specified indexed primitive as if it were nonindexed.

GeomNodebuild (const string &default_name="")
 Creates Geoms for all the primitives added to all buckets, and adds them where appropriate to place them in the scene graph under their respective parents, and/or returns a single GeomNode that contains all geometry whose bucket did not reference a particular scene graph node to parent them to.


Protected Types

typedef pset< BuilderBucketNodeBuckets

Protected Member Functions

void add_bucket (const BuilderBucket &bucket)
 Adds a new BuilderBucket just like the given one to the set of all used BuilderBuckets, and makes it the current bucket.


Protected Attributes

Buckets _buckets
Buckets::iterator _bi


Detailed Description

The main driver class to the builder package.

See the comments above.

Definition at line 195 of file builder.h.


Member Typedef Documentation

typedef pset<BuilderBucketNode> Builder::Buckets [protected]
 

Definition at line 212 of file builder.h.


Constructor & Destructor Documentation

Builder::Builder  ) 
 

Definition at line 39 of file builder.cxx.

References _buckets.

Builder::~Builder  ) 
 

Definition at line 51 of file builder.cxx.


Member Function Documentation

void Builder::add_bucket const BuilderBucket bucket  )  [protected]
 

Adds a new BuilderBucket just like the given one to the set of all used BuilderBuckets, and makes it the current bucket.

Future primitives will be added to this bucket.

Definition at line 251 of file builder.cxx.

Referenced by add_prim().

bool Builder::add_prim const BuilderBucket bucket,
const BuilderPrimI prim
[inline]
 

Adds the indicated indexed primitive, along with its associated bucket, to the builder's internal structures.

This copies all relevant information into the builder.

Returns true if the primitive was successfully added, false if it was invalid for some reason (for instance, a polygon with two vertices).

Definition at line 77 of file builder.I.

References add_bucket(), and INLINE.

bool Builder::add_prim const BuilderBucket bucket,
const BuilderPrim prim
[inline]
 

Adds the indicated nonindexed primitive, along with its associated bucket, to the builder's internal structures.

This copies all relevant information into the builder.

Returns true if the primitive was successfully added, false if it was invalid for some reason (for instance, a polygon with two vertices).

Definition at line 47 of file builder.I.

References add_bucket(), and INLINE.

bool Builder::add_prim_nonindexed const BuilderBucket bucket,
const BuilderPrimI prim
[inline]
 

Adds the specified indexed primitive as if it were nonindexed.

This simply looks up each coordinate value on the prim in its associated array and stores a nonindexed primitive with the actual coordinate values, instead of the index numbers.

This is handy for having code that calls the builder and might want to build either indexed or nonindexed geometry, as selected by the user at run-time. Simply build indexed geometry in all cases, then call either add_prim or add_prim_nonindexed, according to the user's selection.

Definition at line 115 of file builder.I.

GeomNode * Builder::build const string &  default_name = ""  ) 
 

Creates Geoms for all the primitives added to all buckets, and adds them where appropriate to place them in the scene graph under their respective parents, and/or returns a single GeomNode that contains all geometry whose bucket did not reference a particular scene graph node to parent them to.

If a bucket's _node pointer was a GeomNode, the geometry will be added directly to that node. If the _node pointer was any other kind of node, a GeomNode will be created and parented to that node, and its name will be the name of the bucket. In this case, the name of the bucket can also be used to different nodes: if two buckets reference the same node, but have different names, then two different GeomNodes are created, one with each name.

Definition at line 142 of file builder.cxx.


Member Data Documentation

Buckets::iterator Builder::_bi [protected]
 

Definition at line 215 of file builder.h.

Buckets Builder::_buckets [protected]
 

Definition at line 214 of file builder.h.

Referenced by Builder().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:47:53 2003 for Panda by doxygen1.3