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

BuilderBucket Class Reference

The main grouping tool for BuilderPrims. More...

#include <builderBucket.h>

Inheritance diagram for BuilderBucket:

BuilderProperties Namable List of all members.

Public Member Functions

 BuilderBucket ()
 BuilderBucket (const BuilderBucket &copy)
BuilderBucket & operator= (const BuilderBucket &copy)
virtual ~BuilderBucket ()
virtual BuilderBucket * make_copy () const
 Allocates and returns a new copy of this object.

virtual GeomNodemake_geom_node ()
 Called by the builder when it is time to create a new GeomNode.

virtual Geomdone_geom (Geom *geom)
 Called after all the geometry has been added to the Geom.

void add_attrib (const RenderAttrib *attrib)
 A convenience function to add the indicated render attribute to the bucket's state.

virtual bool operator< (const BuilderBucket &other) const
 Defines an arbitrary ordering among different buckets, and groups identical buckets together.

void set_coords (const PTA_Vertexf &coords)
 Sets the array that will be used to define the vertices for any indexed geometry that is associated with this bucket.

PTA_Vertexf get_coords () const
void set_normals (const PTA_Normalf &normals)
 Sets the array that will be used to define the normals for any indexed geometry that is associated with this bucket.

PTA_Normalf get_normals () const
void set_texcoords (const PTA_TexCoordf &texcoords)
 Sets the array that will be used to define the texture coordinates for any indexed geometry that is associated with this bucket.

PTA_TexCoordf get_texcoords () const
void set_colors (const PTA_Colorf &colors)
 Sets the array that will be used to define the colors for any indexed geometry that is associated with this bucket.

PTA_Colorf get_colors () const
virtual void output (ostream &out) const
 Formats the bucket for output in some sensible way.

bool operator< (const BuilderProperties &other) const
 Defines an arbitrary ordering among different properties, and groups identical sets of properties together.

void set_name (const string &name)
void clear_name ()
 Resets the Namable's name to empty.

bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty.

const string & get_name () const

Static Public Member Functions

BuilderBucket * get_default_bucket ()
 Returns a pointer to the BuilderBucket that is used to initialize any BuilderBuckets created with a default constructor.

TypeHandle get_class_type ()
void init_type ()

Public Attributes

PandaNode_node
short _drawBin
unsigned int _drawOrder
ConstPointerTo< RenderState_state
bool _mesh
bool _retesselate_coplanar
bool _unroll_fans
bool _show_tstrips
bool _show_qsheets
bool _show_quads
bool _show_normals
double _normal_scale
BuilderC _normal_color
bool _subdivide_polys
double _coplanar_threshold
bool _consider_fans
double _max_tfan_angle
int _min_tfan_tris

Protected Member Functions

int sort_value () const
 Returns a number for grouping properties.


Protected Attributes

PTA_Vertexf _coords
PTA_Normalf _normals
PTA_TexCoordf _texcoords
PTA_Colorf _colors

Static Protected Attributes

BuilderBucket * _default_bucket = NULL

Private Member Functions

 BuilderBucket (int)
 This special constructor is used only to initialize the _default_bucket pointer.


Detailed Description

The main grouping tool for BuilderPrims.

See the comments at the beginning of builder.h.

As each primitive is added to the builder, it is associated with a bucket. The bucket stores the scene-graph properties of the primitive, and is used to identify primitives that have the same properties and thus may be joined into a common triangle strip.

This grouping is done via the ordering operator, <, which defines an arbitrary ordering for buckets and identifies those buckets which are equivalent to each other. By subclassing off of BuilderBucket and redefining this operator, you can change the grouping behavior to suit your needs, if necessary.

Definition at line 79 of file builderBucket.h.


Constructor & Destructor Documentation

BuilderBucket::BuilderBucket  ) 
 

Definition at line 41 of file builderBucket.cxx.

References _node, and NULL.

Referenced by ~BuilderBucket().

BuilderBucket::BuilderBucket const BuilderBucket &  copy  ) 
 

Definition at line 55 of file builderBucket.cxx.

References _colors, _coords, _normals, _texcoords, Namable::get_name(), set_colors(), set_coords(), Namable::set_name(), set_normals(), and set_texcoords().

BuilderBucket::~BuilderBucket  )  [virtual]
 

Definition at line 97 of file builderBucket.cxx.

References BuilderBucket().

BuilderBucket::BuilderBucket int   )  [private]
 

This special constructor is used only to initialize the _default_bucket pointer.

It sets up the initial defaults. The normal constructor copies from this instance.

Definition at line 304 of file builderBucket.cxx.


Member Function Documentation

void BuilderBucket::add_attrib const RenderAttrib attrib  ) 
 

A convenience function to add the indicated render attribute to the bucket's state.

Definition at line 176 of file builderBucket.cxx.

References _colors, _drawBin, _drawOrder, and _state.

void Namable::clear_name  )  [inline, inherited]
 

Resets the Namable's name to empty.

Definition at line 82 of file namable.I.

References Namable::_name, and INLINE.

Geom * BuilderBucket::done_geom Geom geom  )  [virtual]
 

Called after all the geometry has been added to the Geom.

This is just a hook for the user to redefine to do any post-processing that may be desired on the geometry. It may deallocate it and return a new copy. If it returns NULL, the geom is discarded.

Definition at line 161 of file builderBucket.cxx.

References _coords, _node, _normals, _texcoords, and Namable::get_name().

TypeHandle Namable::get_class_type void   )  [inline, static, inherited]
 

Reimplemented in AnimBundle, AnimBundleNode, AnimChannel< SwitchType >, AnimChannelBase, AnimChannelFixed< SwitchType >, AnimChannelMatrixXfmTable, AnimChannelScalarTable, AnimGroup, MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, PartBundleNode, PartGroup, Character, CharacterJoint, CharacterJointBundle, CharacterSlider, CollisionNode, AnalogNode, ButtonNode, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, DataNode, ProjectionScreen, EggAnimData, EggBin, EggComment, EggCoordinateSystem, EggCurve, EggData, EggExternalReference, EggFilenameNode, EggGroup, EggGroupNode, EggMaterial, EggNamedObject, EggNode, EggNurbsCurve, EggNurbsSurface, EggPoint, EggPolygon, EggPrimitive, EggSAnimData, EggSurface, EggTable, EggTexture, EggVertexPool, EggXfmAnimData, EggXfmSAnim, ImageBuffer, PixelBuffer, Texture, ClassicNurbsCurve, CubicCurveseg, HermiteCurve, NurbsPPCurve, ParametricCurve, PiecewiseCurve, RopeNode, AmbientLight, Camera, DirectionalLight, Fog, GeomNode, LensNode, LightLensNode, LightNode, LODNode, ModelNode, ModelRoot, PandaNode, PlaneNode, PointLight, SelectiveChildNode, SequenceNode, Spotlight, SwitchNode, PGButton, PGEntry, PGItem, PGMouseWatcherBackground, PGMouseWatcherRegion, PGTop, PGWaitBar, ActorNode, ForceNode, PhysicalNode, TextFont, TextNode, ButtonThrower, DriveInterface, MouseWatcher, MouseWatcherRegion, Trackball, Transform2SG, AnimChannel< ACScalarSwitchType >, AnimChannel< ACMatrixSwitchType >, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >.

Definition at line 60 of file namable.h.

Referenced by MouseWatcherRegion::init_type().

PTA_Colorf BuilderBucket::get_colors  )  const [inline]
 

Definition at line 142 of file builderBucket.I.

PTA_Vertexf BuilderBucket::get_coords  )  const [inline]
 

Definition at line 49 of file builderBucket.I.

References _normals, and INLINE.

Referenced by BuilderVertex::get_color_value().

BuilderBucket * BuilderBucket::get_default_bucket  )  [inline, static]
 

Returns a pointer to the BuilderBucket that is used to initialize any BuilderBuckets created with a default constructor.

This is just a convenient way to set some global parameters.

Definition at line 162 of file builderBucket.I.

const string & Namable::get_name  )  const [inline, inherited]
 

Definition at line 109 of file namable.I.

Referenced by ComputedVerticesMaker::add_normal(), GLGraphicsStateGuardian::begin_bind_clip_planes(), GLGraphicsStateGuardian::begin_bind_lights(), BuilderBucket(), EggVertex::clear_grefs(), AnimBundleMaker::create_xfm_channel(), SceneGraphReducer::do_flatten_siblings(), done_geom(), DXTextureContext8::DXTextureContext8(), PartGroup::find_child(), EggLoader::find_collision_geometry(), EggGroupUniquifier::get_category(), PartBundle::get_control_effect(), PartGroup::get_num_children(), EggMorph< Parameter >::get_offset(), AnimChannelBase::has_changed(), Namable::has_name(), EggMaterial::is_equivalent_to(), Texture::load(), EggLoader::make_node(), AnimBundleMaker::make_node(), FindApproxPath::Component::matches(), LineSegs::move_to(), MovingPartBase::MovingPartBase(), NodeMap::NodeMap(), EggMorph< Parameter >::operator<(), operator<<(), MouseWatcherRegion::output(), AnimGroup::output(), EggXfmSAnim::r_transform(), Texture::read(), MouseWatcherGroup::remove_region(), EggLoader::reparent_decals(), CRGraphicsStateGuardian::set_blend_mode(), NodePath::set_color(), GLGraphicsStateGuardian::set_draw_buffer(), AnimChannelScalarTable::set_table(), NodePath::set_transparency(), NodePathComponent::uncollapse(), Texture::unprepare(), TextNode::wordwrap_to(), MovingPartBase::write(), CollisionNode::xform(), and EggVertex::~EggVertex().

PTA_Normalf BuilderBucket::get_normals  )  const [inline]
 

Definition at line 80 of file builderBucket.I.

References _texcoords, and INLINE.

Referenced by BuilderVertexI::set_coord_value().

PTA_TexCoordf BuilderBucket::get_texcoords  )  const [inline]
 

Definition at line 111 of file builderBucket.I.

References _colors.

bool Namable::has_name  )  const [inline, inherited]
 

Returns true if the Namable has a nonempty name set, false if the name is empty.

Definition at line 97 of file namable.I.

References Namable::get_name(), and INLINE.

Referenced by EggGroupUniquifier::EggGroupUniquifier(), Texture::read(), and Texture::Texture().

void Namable::init_type void   )  [inline, static, inherited]
 

Reimplemented in AnimBundle, AnimBundleNode, AnimChannel< SwitchType >, AnimChannelBase, AnimChannelFixed< SwitchType >, AnimChannelMatrixXfmTable, AnimChannelScalarTable, AnimGroup, MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, PartBundleNode, PartGroup, Character, CharacterJoint, CharacterJointBundle, CharacterSlider, CollisionNode, AnalogNode, ButtonNode, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, DataNode, ProjectionScreen, EggAnimData, EggBin, EggComment, EggCoordinateSystem, EggCurve, EggData, EggExternalReference, EggFilenameNode, EggGroup, EggGroupNode, EggMaterial, EggNamedObject, EggNode, EggNurbsCurve, EggNurbsSurface, EggPoint, EggPolygon, EggPrimitive, EggSAnimData, EggSurface, EggTable, EggTexture, EggVertexPool, EggXfmAnimData, EggXfmSAnim, ImageBuffer, PixelBuffer, Texture, ClassicNurbsCurve, CubicCurveseg, HermiteCurve, NurbsPPCurve, ParametricCurve, PiecewiseCurve, RopeNode, AmbientLight, Camera, DirectionalLight, Fog, GeomNode, LensNode, LightLensNode, LightNode, LODNode, ModelNode, ModelRoot, PandaNode, PlaneNode, PointLight, SelectiveChildNode, SequenceNode, Spotlight, SwitchNode, PGButton, PGEntry, PGItem, PGMouseWatcherBackground, PGMouseWatcherRegion, PGTop, PGWaitBar, ActorNode, ForceNode, PhysicalNode, TextFont, TextNode, ButtonThrower, DriveInterface, MouseWatcher, MouseWatcherRegion, Trackball, Transform2SG, AnimChannel< ACScalarSwitchType >, AnimChannel< ACMatrixSwitchType >, MovingPart< ACScalarSwitchType >, and MovingPart< ACMatrixSwitchType >.

Definition at line 63 of file namable.h.

References INLINE.

BuilderBucket * BuilderBucket::make_copy  )  const [virtual]
 

Allocates and returns a new copy of this object.

If you are subclassing from BuilderBucket, you must redefine this to return an instance of your new subclass, because the Builder will call this function to get its own copy.

Definition at line 118 of file builderBucket.cxx.

GeomNode * BuilderBucket::make_geom_node  )  [virtual]
 

Called by the builder when it is time to create a new GeomNode.

This function should allocate and return a new GeomNode suitable for adding geometry to. You may redefine it to return a subclass of GeomNode, or to do some initialization to the node.

Definition at line 140 of file builderBucket.cxx.

References _state.

bool BuilderProperties::operator< const BuilderProperties other  )  const [inherited]
 

Defines an arbitrary ordering among different properties, and groups identical sets of properties together.

This operator is used for the more important task of grouping BuilderBuckets together; see the comments for the similar function in builderBucket.cxx.

Definition at line 43 of file builderProperties.cxx.

References BuilderProperties::_max_tfan_angle.

bool BuilderBucket::operator< const BuilderBucket &  other  )  const [virtual]
 

Defines an arbitrary ordering among different buckets, and groups identical buckets together.

(Buckets a and b are identical if !(a < b) and !(b < a).)

The actual order between different buckets is arbitrary and largely irrelevant, so long as it is consistent. That is, if (a < b) and (b < c), it must also be true that (a < c). Also, if (a < b), it cannot be true that (b < a).

Definition at line 209 of file builderBucket.cxx.

References _normals, Normalf, and NULL.

BuilderBucket & BuilderBucket::operator= const BuilderBucket &  copy  ) 
 

Definition at line 69 of file builderBucket.cxx.

References _drawBin, _drawOrder, _node, and _state.

void BuilderBucket::output ostream &  out  )  const [virtual]
 

Formats the bucket for output in some sensible way.

Reimplemented from BuilderProperties.

Definition at line 248 of file builderBucket.cxx.

References BuilderProperties::_consider_fans, BuilderProperties::_coplanar_threshold, _drawBin, _drawOrder, BuilderProperties::_max_tfan_angle, BuilderProperties::_mesh, BuilderProperties::_min_tfan_tris, _node, BuilderProperties::_normal_color, BuilderProperties::_normal_scale, BuilderProperties::_retesselate_coplanar, BuilderProperties::_show_normals, BuilderProperties::_show_qsheets, BuilderProperties::_show_quads, BuilderProperties::_show_tstrips, _state, BuilderProperties::_subdivide_polys, BuilderProperties::_unroll_fans, and NULL.

void BuilderBucket::set_colors const PTA_Colorf colors  )  [inline]
 

Sets the array that will be used to define the colors for any indexed geometry that is associated with this bucket.

Definition at line 129 of file builderBucket.I.

References _default_bucket.

Referenced by BuilderBucket().

void BuilderBucket::set_coords const PTA_Vertexf coords  )  [inline]
 

Sets the array that will be used to define the vertices for any indexed geometry that is associated with this bucket.

Definition at line 37 of file builderBucket.I.

References _coords, and INLINE.

Referenced by BuilderBucket().

void Namable::set_name const string &  name  )  [inline, inherited]
 

Definition at line 69 of file namable.I.

References Namable::_name.

Referenced by BuilderBucket(), SceneGraphReducer::do_flatten_siblings(), Texture::read(), PandaNode::reparent(), and Texture::Texture().

void BuilderBucket::set_normals const PTA_Normalf normals  )  [inline]
 

Sets the array that will be used to define the normals for any indexed geometry that is associated with this bucket.

Definition at line 67 of file builderBucket.I.

References _texcoords, and INLINE.

Referenced by BuilderBucket().

void BuilderBucket::set_texcoords const PTA_TexCoordf texcoords  )  [inline]
 

Sets the array that will be used to define the texture coordinates for any indexed geometry that is associated with this bucket.

Definition at line 98 of file builderBucket.I.

References _colors, and INLINE.

Referenced by BuilderBucket().

int BuilderProperties::sort_value  )  const [protected, inherited]
 

Returns a number for grouping properties.

This is used as a helper function to the ordering operator, above. It simply collects all the booleans together into a single number.

Definition at line 137 of file builderProperties.cxx.


Member Data Documentation

PTA_Colorf BuilderBucket::_colors [protected]
 

Definition at line 120 of file builderBucket.h.

Referenced by add_attrib(), BuilderBucket(), get_texcoords(), and set_texcoords().

bool BuilderProperties::_consider_fans [inherited]
 

Definition at line 124 of file builderProperties.h.

Referenced by output().

PTA_Vertexf BuilderBucket::_coords [protected]
 

Definition at line 117 of file builderBucket.h.

Referenced by BuilderBucket(), done_geom(), and set_coords().

double BuilderProperties::_coplanar_threshold [inherited]
 

Definition at line 119 of file builderProperties.h.

Referenced by MesherStrip< PrimType >::mate(), and output().

BuilderBucket * BuilderBucket::_default_bucket = NULL [static, protected]
 

Definition at line 30 of file builderBucket.cxx.

Referenced by set_colors().

short BuilderBucket::_drawBin
 

Definition at line 111 of file builderBucket.h.

Referenced by add_attrib(), operator=(), and output().

unsigned int BuilderBucket::_drawOrder
 

Definition at line 112 of file builderBucket.h.

Referenced by add_attrib(), operator=(), and output().

double BuilderProperties::_max_tfan_angle [inherited]
 

Definition at line 129 of file builderProperties.h.

Referenced by BuilderProperties::operator<(), and output().

bool BuilderProperties::_mesh [inherited]
 

Definition at line 72 of file builderProperties.h.

Referenced by expand_lines(), and output().

int BuilderProperties::_min_tfan_tris [inherited]
 

Definition at line 136 of file builderProperties.h.

Referenced by output().

PandaNode* BuilderBucket::_node
 

Definition at line 109 of file builderBucket.h.

Referenced by BuilderBucket(), done_geom(), operator=(), and output().

BuilderC BuilderProperties::_normal_color [inherited]
 

Definition at line 109 of file builderProperties.h.

Referenced by output().

double BuilderProperties::_normal_scale [inherited]
 

Definition at line 108 of file builderProperties.h.

Referenced by output().

PTA_Normalf BuilderBucket::_normals [protected]
 

Definition at line 118 of file builderBucket.h.

Referenced by BuilderBucket(), done_geom(), get_coords(), and operator<().

bool BuilderProperties::_retesselate_coplanar [inherited]
 

Definition at line 78 of file builderProperties.h.

Referenced by MesherStrip< PrimType >::mate(), and output().

bool BuilderProperties::_show_normals [inherited]
 

Definition at line 107 of file builderProperties.h.

Referenced by output().

bool BuilderProperties::_show_qsheets [inherited]
 

Definition at line 97 of file builderProperties.h.

Referenced by output().

bool BuilderProperties::_show_quads [inherited]
 

Definition at line 103 of file builderProperties.h.

Referenced by output().

bool BuilderProperties::_show_tstrips [inherited]
 

Definition at line 92 of file builderProperties.h.

Referenced by output().

ConstPointerTo< RenderState > BuilderBucket::_state
 

Definition at line 114 of file builderBucket.h.

Referenced by add_attrib(), make_geom_node(), operator=(), and output().

bool BuilderProperties::_subdivide_polys [inherited]
 

Definition at line 113 of file builderProperties.h.

Referenced by expand_lines(), and output().

PTA_TexCoordf BuilderBucket::_texcoords [protected]
 

Definition at line 119 of file builderBucket.h.

Referenced by BuilderBucket(), done_geom(), get_normals(), and set_normals().

bool BuilderProperties::_unroll_fans [inherited]
 

Definition at line 84 of file builderProperties.h.

Referenced by output().


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