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

GeomTri Class Reference

Triangle Primitive. More...

#include <geomTri.h>

Inheritance diagram for GeomTri:

Geom dDrawable ReferenceCount WritableConfigurable BoundedObject TypedWritable TypedObject List of all members.

Public Types

typedef const VertexfGetNextVertex (VertexIterator &)
typedef const NormalfGetNextNormal (NormalIterator &)
typedef const TexCoordfGetNextTexCoord (TexCoordIterator &)
typedef const ColorfGetNextColor (ColorIterator &)
enum  BoundingVolumeType { BVT_static, BVT_dynamic_sphere }

Public Member Functions

 GeomTri ()
virtual Geommake_copy () const
 Returns a newly-allocated Geom that is a shallow copy of this one.

virtual void print_draw_immediate () const
virtual void draw_immediate (GraphicsStateGuardianBase *gsg, GeomContext *gc)
virtual int get_num_vertices_per_prim () const
virtual int get_num_more_vertices_than_components () const
virtual bool uses_components () const
virtual int get_length (int) const
virtual PTA_ushort get_tris () const
 This is similar in principle to explode(), except it returns only a list of triangle vertex indices, with no information about color or whatever.

virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()
void write (ostream &out, int indent_level=0) const
virtual void output (ostream &out) const
void write_verbose (ostream &out, int indent_level) const
 Writes to the indicated ostream a formatted picture of the contents of the Geom, in detail--but hopefully not too much detail.

virtual void draw (GraphicsStateGuardianBase *gsg)
 Actually draws the Geom with the indicated GSG.

virtual void config ()
 Configure rendering based on current settings.

void calc_tight_bounds (LPoint3f &min_point, LPoint3f &max_point, bool &found_any) const
 Expands min_point and max_point to include all of the vertices in the Geom, if any.

void transform_vertices (const LMatrix4f &mat)
 Applies the indicated transform to all of the vertices in the Geom.

void set_coords (const PTA_Vertexf &coords, const PTA_ushort &vindex=PTA_ushort())
void set_coords (const PTA_Vertexf &coords, GeomBindType bind, const PTA_ushort &vindex=PTA_ushort())
void set_normals (const PTA_Normalf &norms, GeomBindType bind, const PTA_ushort &nindex=PTA_ushort())
void set_colors (const PTA_Colorf &colors, GeomBindType bind, const PTA_ushort &cindex=PTA_ushort())
void set_texcoords (const PTA_TexCoordf &texcoords, GeomBindType bind, const PTA_ushort &tindex=PTA_ushort())
void get_coords (PTA_Vertexf &coords, GeomBindType &bind, PTA_ushort &vindex) const
void get_coords (PTA_Vertexf &coords, PTA_ushort &vindex) const
void get_normals (PTA_Normalf &norms, GeomBindType &bind, PTA_ushort &nindex) const
void get_colors (PTA_Colorf &colors, GeomBindType &bind, PTA_ushort &cindex) const
void get_texcoords (PTA_TexCoordf &texcoords, GeomBindType &bind, PTA_ushort &tindex) const
virtual bool is_dynamic () const
 Returns true if the Geom has any dynamic properties that are expected to change from one frame to the next, or false if the Geom is largely static.

GeomBindType get_binding (int attr) const
 Returns the GeomBindType which indicates the assignment of colors (or normals, etc.) to the primitives.

const PTA_Vertexfget_coords_array () const
 Returns the array of vertex coordinates associated with the Geom.

const PTA_Normalfget_normals_array () const
 Returns the array of normals associated with the Geom.

const PTA_Colorfget_colors_array () const
 Returns the array of colors associated with the Geom.

const PTA_TexCoordfget_texcoords_array () const
 Returns the array of texcoords associated with the Geom.

const PTA_ushortget_coords_index () const
 Returns the array of indices that, if nonempty, will be used to traverse the vertices in coords_array.

const PTA_ushortget_normals_index () const
 Returns the array of indices that, if nonempty, will be used to traverse the vertices in normals_array.

const PTA_ushortget_colors_index () const
 Returns the array of indices that, if nonempty, will be used to traverse the vertices in colors_array.

const PTA_ushortget_texcoords_index () const
 Returns the array of indices that, if nonempty, will be used to traverse the vertices in texcoords_array.

void set_num_prims (int num)
 Sets the number of primitives in the Geom.

int get_num_prims () const
 Returns the number of primitives in the Geom.

void set_lengths (const PTA_int &lengths)
 Sets the array that indicates the length (number of vertices) of each primitive.

PTA_int get_lengths () const
 Returns the array the indicates the length (number of vertices) of each primitive.

int get_num_vertices () const
 Returns the number of vertices required by all all the prims in the Geom.

virtual Geomexplode () const
 If the Geom is a composite type such as a tristrip, this allocates and returns a new Geom that represents the same geometry as a simple type, for instance a set of triangles.

VertexIterator make_vertex_iterator () const
const Vertexfget_next_vertex (VertexIterator &viterator) const
NormalIterator make_normal_iterator () const
const Normalfget_next_normal (NormalIterator &niterator) const
TexCoordIterator make_texcoord_iterator () const
const TexCoordfget_next_texcoord (TexCoordIterator &tciterator) const
ColorIterator make_color_iterator () const
const Colorfget_next_color (ColorIterator &citerator) const
GeomContextprepare (GraphicsStateGuardianBase *gsg)
 Creates a context for the Geom on the particular GSG, if it does not already exist.

void unprepare ()
 Frees the context allocated on all GSG's for which the geom has been declared.

void unprepare (GraphicsStateGuardianBase *gsg)
 Frees the geom context only on the indicated GSG, if it exists there.

void clear_gsg (GraphicsStateGuardianBase *gsg)
 Removes the indicated GSG from the Geom's known GSG's, without actually releasing the geom on that GSG.

virtual void write_datagram (BamWriter *manager, Datagram &me)
 Function to write the important information in the particular object to a Datagram.

int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.

void check_config () const
bool is_dirty (void) const
void make_dirty (void)
virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

virtual void finalize ()
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.

bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.

void set_bound (BoundingVolumeType type)
 Sets the type of the bounding volume that will be dynamically computed for this particular node.

void set_bound (const BoundingVolume &volume)
 Explicitly sets a new bounding volume on this node.

const BoundingVolumeget_bound () const
 Returns the current bounding volume on this node, possibly forcing a recompute.

bool mark_bound_stale ()
 Marks the current bounding volume as stale, so that it will be recomputed later.

void force_bound_stale ()
 Marks the current volume as stale and propagates the effect at least one level, even if it had already been marked stale.

bool is_bound_stale () const
 Returns true if the bound is currently marked stale and will be recomputed the next time get_bound() is called.

void set_final (bool flag)
 Sets the "final" flag on this BoundedObject.

bool is_final () const
 Returns the current state of the "final" flag.


Static Public Member Functions

void register_with_read_factory (void)
 Factory method to generate a GeomTri object.

TypedWritablemake_GeomTri (const FactoryParams &params)
 Factory method to generate a GeomTri object.

TypeHandle get_class_type ()
void init_type ()

Static Public Attributes

TypedWritable *const Null = (TypedWritable*)0L

Protected Member Functions

void init ()
virtual BoundingVolumerecompute_bound ()
 Recomputes the dynamic bounding volume for this Geom.

void fillin (DatagramIterator &scan, BamReader *manager)
 Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.

virtual void propagate_stale_bound ()
 Called by BoundedObject::mark_bound_stale(), this should make sure that all bounding volumes that depend on this one are marked stale also.

const BoundingVolumeget_bound_ptr () const
 Returns the state of the _bound pointer.

BoundingVolumeset_bound_ptr (BoundingVolume *bound)
 Changes the _bound pointer.


Protected Attributes

PTA_Vertexf _coords
PTA_Normalf _norms
PTA_Colorf _colors
PTA_TexCoordf _texcoords
PTA_ushort _vindex
PTA_ushort _nindex
PTA_ushort _cindex
PTA_ushort _tindex
int _numprims
int _num_vertices
PTA_int _primlengths
enum GeomBindType _bind [num_GeomAttrTypes]
GetNextVertex_get_vertex
GetNextNormal_get_normal
GetNextTexCoord_get_texcoord
GetNextColor_get_color
GraphicsStateGuardianBase_prepared_gsg
GeomContext_prepared_context

Static Private Attributes

TypeHandle _type_handle

Detailed Description

Triangle Primitive.

Definition at line 34 of file geomTri.h.


Member Typedef Documentation

typedef const Colorf& Geom::GetNextColor(ColorIterator &) [inherited]
 

Definition at line 118 of file geom.h.

typedef const Normalf& Geom::GetNextNormal(NormalIterator &) [inherited]
 

Definition at line 116 of file geom.h.

typedef const TexCoordf& Geom::GetNextTexCoord(TexCoordIterator &) [inherited]
 

Definition at line 117 of file geom.h.

typedef const Vertexf& Geom::GetNextVertex(VertexIterator &) [inherited]
 

Definition at line 115 of file geom.h.


Member Enumeration Documentation

enum BoundedObject::BoundingVolumeType [inherited]
 

Enumeration values:
BVT_static 
BVT_dynamic_sphere 

Definition at line 58 of file boundedObject.h.


Constructor & Destructor Documentation

GeomTri::GeomTri  )  [inline]
 

Definition at line 36 of file geomTri.h.


Member Function Documentation

void Geom::calc_tight_bounds LPoint3f &  min_point,
LPoint3f &  max_point,
bool &  found_any
const [inherited]
 

Expands min_point and max_point to include all of the vertices in the Geom, if any.

found_any is set true if any points are found. It is the caller's responsibility to initialize min_point, max_point, and found_any before calling this function.

Definition at line 244 of file geom.cxx.

References PointerToArray< Vertexf >::begin(), PointerToArray< Vertexf >::end(), Geom::get_coords(), nassertv, PointerToArray< Vertexf >::push_back(), PointerToArray< Vertexf >::reserve(), Geom::set_coords(), and PointerToArray< Vertexf >::size().

void WritableConfigurable::check_config  )  const [inline, inherited]
 

Definition at line 70 of file writableConfigurable.h.

References PUBLISHED.

Referenced by Geom::set_lengths().

void Geom::clear_gsg GraphicsStateGuardianBase gsg  )  [inherited]
 

Removes the indicated GSG from the Geom's known GSG's, without actually releasing the geom on that GSG.

This is intended to be called only from GSG::release_geom(); it should never be called by user code.

Definition at line 746 of file geom.cxx.

References Geom::_num_vertices, and Geom::_numprims.

int TypedWritable::complete_pointers TypedWritable **  p_list,
BamReader manager
[virtual, inherited]
 

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

This is the callback function that is made by the BamReader at some later point, after all of the required pointers have been filled in. It is necessary because there might be forward references in a bam file; when we call read_pointer() in fillin(), the object may not have been read from the file yet, so we do not have a pointer available at that time. Thus, instead of returning a pointer, read_pointer() simply reserves a later callback. This function provides that callback. The calling object is responsible for keeping track of the number of times it called read_pointer() and extracting the same number of pointers out of the supplied vector, and storing them appropriately within the object.

Reimplemented in AnimBundleNode, AnimGroup, PartBundleNode, PartGroup, Character, CharacterJoint, CollisionNode, GeomSprite, PiecewiseCurve, ClipPlaneAttrib, FogAttrib, LensNode, LightAttrib, MaterialAttrib, RenderEffects, RenderState, TextureAttrib, Person, and Child.

Definition at line 94 of file typedWritable.cxx.

Referenced by RenderState::do_invert_compose().

void Geom::config void   )  [virtual, inherited]
 

Configure rendering based on current settings.

Reimplemented from WritableConfigurable.

Definition at line 579 of file geom.cxx.

References Geom::_prepared_context, Geom::_prepared_gsg, NULL, and GraphicsStateGuardianBase::release_geom().

Referenced by GeomSphere::draw_immediate(), Geom::get_texcoords(), get_tris(), and GeomLine::write_datagram().

void Geom::draw GraphicsStateGuardianBase gsg  )  [virtual, inherited]
 

Actually draws the Geom with the indicated GSG.

Reimplemented from dDrawable.

Definition at line 559 of file geom.cxx.

References Geom::_prepared_context, Geom::_prepared_gsg, NULL, GraphicsStateGuardianBase::prepare_geom(), and Geom::unprepare().

Referenced by GLGraphicsStateGuardian::prepare_geom_node().

void GeomTri::draw_immediate GraphicsStateGuardianBase gsg,
GeomContext gc
[virtual]
 

Implements Geom.

Definition at line 199 of file geomTri.cxx.

References Geom::_numprims, Geom::_vindex, PointerToArray< unsigned short >::empty(), nassertr, PTA_ushort, PointerToArray< unsigned short >::push_back(), PointerToArray< unsigned short >::reserve(), and PointerToArray< unsigned short >::size().

Geom * Geom::explode  )  const [virtual, inherited]
 

If the Geom is a composite type such as a tristrip, this allocates and returns a new Geom that represents the same geometry as a simple type, for instance a set of triangles.

If the Geom is already a simple type, this allocates and returns a copy. This is just a convenience function for dealing with composite types when performance is less than paramount.

Reimplemented in GeomLine, GeomLinestrip, GeomPoint, GeomPolygon, GeomSphere, GeomSprite, GeomTrifan, and GeomTristrip.

Definition at line 513 of file geom.cxx.

void Geom::fillin DatagramIterator scan,
BamReader manager
[protected, inherited]
 

Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.

Reimplemented from dDrawable.

Reimplemented in GeomLine, GeomLinestrip, GeomPoint, and GeomSprite.

Definition at line 877 of file geom.cxx.

References describe_attr(), G_OFF, G_PER_VERTEX, GeomBindType, Geom::get_colors(), Geom::get_coords(), Geom::get_normals(), Geom::get_num_prims(), Geom::get_texcoords(), Geom::get_type(), indent(), NULL, PointerToArray< Vertexf >::size(), ushort, and Vertexf.

Referenced by GeomSphere::draw_immediate(), get_tris(), GeomLine::make_GeomLine(), GeomLinestrip::make_GeomLinestrip(), and GeomPoint::make_GeomPoint().

void TypedWritable::finalize void   )  [virtual, inherited]
 

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented in PartBundle, RenderAttrib, RenderEffect, RenderEffects, RenderState, and TransformState.

Definition at line 112 of file typedWritable.cxx.

Referenced by BamReader::skip_pointer().

void BoundedObject::force_bound_stale  )  [inline, inherited]
 

Marks the current volume as stale and propagates the effect at least one level, even if it had already been marked stale.

Definition at line 188 of file boundedObject.I.

References BoundedObject::_cycler, BoundedObject::F_final, and INLINE.

Referenced by PandaNode::remove_child().

virtual TypeHandle GeomTri::force_init_type void   )  [inline, virtual]
 

Reimplemented from Geom.

Definition at line 74 of file geomTri.h.

GeomBindType Geom::get_binding int  attr  )  const [inline, inherited]
 

Returns the GeomBindType which indicates the assignment of colors (or normals, etc.) to the primitives.

Definition at line 36 of file geom.I.

References Geom::_coords, and INLINE.

Referenced by GLGraphicsStateGuardian::draw_point(), DXGraphicsStateGuardian8::draw_point(), DXGraphicsStateGuardian7::draw_prim_inner_loop(), GLGraphicsStateGuardian::draw_quad(), and GeomTristrip::get_num_tris().

const BoundingVolume & BoundedObject::get_bound  )  const [inherited]
 

Returns the current bounding volume on this node, possibly forcing a recompute.

A node's bounding volume encloses only the node itself, irrespective of the nodes above or below it in the graph. This is different from the bounding volumes on the arcs, which enclose all geometry below them.

Reimplemented in PandaNode.

Definition at line 59 of file boundedObject.cxx.

Referenced by PandaNode::clear_effect(), PandaNode::get_state(), and CollisionLevelState::reserve().

const BoundingVolume * BoundedObject::get_bound_ptr  )  const [inline, protected, inherited]
 

Returns the state of the _bound pointer.

To be used only internally by derived classes.

This returns a const pointer only; the bounding volume should not be modified directly, because that might interfere with pipelining. Instead, create a new copy with make_copy(), modify the copy, and set_bound_ptr() with the copy.

Alternatively, if you have just called recompute_bound(), which is guaranteed to reset the pointer, just use the return value from that as a non-const BoundingVolume pointer.

Definition at line 318 of file boundedObject.I.

TypeHandle GeomTri::get_class_type void   )  [inline, static]
 

Reimplemented from Geom.

Definition at line 62 of file geomTri.h.

void Geom::get_colors PTA_Colorf colors,
GeomBindType bind,
PTA_ushort cindex
const [inherited]
 

Definition at line 447 of file geom.cxx.

References PTA_ushort.

Referenced by DXGraphicsStateGuardian7::draw_prim_inner_loop_coordtexonly(), and Geom::fillin().

const PTA_Colorf & Geom::get_colors_array  )  const [inline, inherited]
 

Returns the array of colors associated with the Geom.

This may have any binding type. It may either be indexed or nonindexed, depending on whether get_colors_index() returns a NULL array.

Definition at line 95 of file geom.I.

const PTA_ushort & Geom::get_colors_index  )  const [inline, inherited]
 

Returns the array of indices that, if nonempty, will be used to traverse the vertices in colors_array.

Definition at line 161 of file geom.I.

References Geom::_num_vertices, and INLINE.

void Geom::get_coords PTA_Vertexf coords,
PTA_ushort vindex
const [inherited]
 

Definition at line 401 of file geom.cxx.

References Geom::_bind, Geom::_tindex, and G_TEXCOORD.

void Geom::get_coords PTA_Vertexf coords,
GeomBindType bind,
PTA_ushort vindex
const [inherited]
 

Definition at line 417 of file geom.cxx.

Referenced by Geom::calc_tight_bounds(), DXGraphicsStateGuardian7::draw_prim_inner_loop_coordtexonly(), Geom::fillin(), and GeomTransformer::~GeomTransformer().

const PTA_Vertexf & Geom::get_coords_array  )  const [inline, inherited]
 

Returns the array of vertex coordinates associated with the Geom.

This must have binding type G_PER_VERTEX. It may either be indexed or nonindexed, depending on whether get_coords_index() returns a NULL array.

Definition at line 57 of file geom.I.

const PTA_ushort & Geom::get_coords_index  )  const [inline, inherited]
 

Returns the array of indices that, if nonempty, will be used to traverse the vertices in coords_array.

Definition at line 131 of file geom.I.

References Geom::_num_vertices, Geom::_numprims, Geom::get_num_vertices_per_prim(), INLINE, WritableConfigurable::make_dirty(), and Geom::uses_components().

virtual int GeomTri::get_length int   )  const [inline, virtual]
 

Implements Geom.

Definition at line 51 of file geomTri.h.

References PUBLISHED.

PTA_int Geom::get_lengths  )  const [inline, inherited]
 

Returns the array the indicates the length (number of vertices) of each primitive.

This array will generally only be defined for composite type Geoms, like a GeomTristrip; it is meaningless for simple Geoms.

Definition at line 285 of file geom.I.

Referenced by GLGraphicsStateGuardian::draw_quad().

const Colorf & Geom::get_next_color ColorIterator &  citerator  )  const [inline, inherited]
 

Definition at line 426 of file geom.I.

Referenced by GeomTristrip::get_num_tris().

const Normalf & Geom::get_next_normal NormalIterator &  niterator  )  const [inline, inherited]
 

Definition at line 370 of file geom.I.

Referenced by DXGraphicsStateGuardian8::draw_point(), GeomTristrip::get_num_tris(), and issue_vertex_rib().

const TexCoordf & Geom::get_next_texcoord TexCoordIterator &  tciterator  )  const [inline, inherited]
 

Definition at line 398 of file geom.I.

const Vertexf & Geom::get_next_vertex VertexIterator &  viterator  )  const [inline, inherited]
 

Definition at line 342 of file geom.I.

Referenced by Geom::operator=().

void Geom::get_normals PTA_Normalf norms,
GeomBindType bind,
PTA_ushort nindex
const [inherited]
 

Definition at line 432 of file geom.cxx.

References Geom::make_copy().

Referenced by SceneGraphAnalyzer::collect_statistics(), DXGraphicsStateGuardian7::draw_prim_inner_loop_coordtexonly(), and Geom::fillin().

const PTA_Normalf & Geom::get_normals_array  )  const [inline, inherited]
 

Returns the array of normals associated with the Geom.

This may have any binding type. It may either be indexed or nonindexed, depending on whether get_normals_index() returns a NULL array.

Definition at line 76 of file geom.I.

References Geom::_texcoords, and INLINE.

const PTA_ushort & Geom::get_normals_index  )  const [inline, inherited]
 

Returns the array of indices that, if nonempty, will be used to traverse the vertices in normals_array.

Definition at line 146 of file geom.I.

virtual int GeomTri::get_num_more_vertices_than_components  )  const [inline, virtual]
 

Implements Geom.

Definition at line 44 of file geomTri.h.

int Geom::get_num_prims void   )  const [inline, inherited]
 

Returns the number of primitives in the Geom.

Definition at line 213 of file geom.I.

Referenced by SceneGraphAnalyzer::collect_statistics(), GLGraphicsStateGuardian::draw_point(), DXGraphicsStateGuardian8::draw_point(), DXGraphicsStateGuardian7::draw_prim_inner_loop_coordtexonly(), GLGraphicsStateGuardian::draw_quad(), Geom::fillin(), Geom::operator=(), and CRGraphicsStateGuardian::prepare_lens().

int Geom::get_num_vertices  )  const [inline, inherited]
 

Returns the number of vertices required by all all the prims in the Geom.

Definition at line 228 of file geom.I.

Referenced by GLGraphicsStateGuardian::draw_point(), DXGraphicsStateGuardian8::draw_point(), DXGraphicsStateGuardian7::draw_prim_inner_loop_coordtexonly(), GLGraphicsStateGuardian::draw_quad(), and CRGraphicsStateGuardian::prepare_lens().

virtual int GeomTri::get_num_vertices_per_prim  )  const [inline, virtual]
 

Implements Geom.

Definition at line 41 of file geomTri.h.

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

void Geom::get_texcoords PTA_TexCoordf texcoords,
GeomBindType bind,
PTA_ushort tindex
const [inherited]
 

Definition at line 462 of file geom.cxx.

References Geom::_prepared_context, Geom::_prepared_gsg, Geom::config(), Geom::draw_immediate(), WritableConfigurable::is_dirty(), and NULL.

Referenced by DXGraphicsStateGuardian7::draw_prim_inner_loop_coordtexonly(), Geom::fillin(), and GeomTransformer::transform_vertices().

const PTA_TexCoordf & Geom::get_texcoords_array  )  const [inline, inherited]
 

Returns the array of texcoords associated with the Geom.

This may have a binding type of G_PER_VERTEX or G_OFF. It may either be indexed or nonindexed, depending on whether get_texcoords_index() returns a NULL array.

Definition at line 116 of file geom.I.

References Geom::_cindex.

const PTA_ushort & Geom::get_texcoords_index  )  const [inline, inherited]
 

Returns the array of indices that, if nonempty, will be used to traverse the vertices in texcoords_array.

Definition at line 176 of file geom.I.

PTA_ushort GeomTri::get_tris  )  const [virtual]
 

This is similar in principle to explode(), except it returns only a list of triangle vertex indices, with no information about color or whatever.

The array returned is a set of indices into the geom's _coords array, as retrieve by get_coords(); there will be 3*n elements in the array, where n is the number of triangles described by the geometry. This is useful when it's important to determine the physical structure of the geometry, without necessarily worrying about its rendering properties, and when performance considerations are not overwhelming.

Reimplemented from Geom.

Definition at line 232 of file geomTri.cxx.

References Geom::config(), Geom::fillin(), WritableConfigurable::make_dirty(), and parse_params().

virtual TypeHandle GeomTri::get_type void   )  const [inline, virtual]
 

Reimplemented from Geom.

Definition at line 71 of file geomTri.h.

int TypedObject::get_type_index  )  const [inline, inherited]
 

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 71 of file typedObject.I.

References TypeHandle::get_name(), TypedObject::get_type(), and INLINE.

void Geom::init  )  [protected, inherited]
 

Definition at line 761 of file geom.cxx.

References Geom::_bind, and GeomBindType.

void GeomTri::init_type void   )  [inline, static]
 

Reimplemented from Geom.

Definition at line 66 of file geomTri.h.

bool BoundedObject::is_bound_stale  )  const [inline, inherited]
 

Returns true if the bound is currently marked stale and will be recomputed the next time get_bound() is called.

This function is defined up at the top of this file, because several of the inline functions below reference it.

Definition at line 217 of file boundedObject.I.

References BoundedObject::_cycler, and INLINE.

Referenced by BoundedObject::~BoundedObject().

bool WritableConfigurable::is_dirty void   )  const [inline, inherited]
 

Definition at line 82 of file writableConfigurable.h.

Referenced by Geom::get_texcoords(), and dDrawable::~dDrawable().

bool Geom::is_dynamic  )  const [virtual, inherited]
 

Returns true if the Geom has any dynamic properties that are expected to change from one frame to the next, or false if the Geom is largely static.

For now, this is the same thing as asking whether its vertices are indexed.

Reimplemented from dDrawable.

Definition at line 486 of file geom.cxx.

bool TypedObject::is_exact_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is the indicated type exactly.

Definition at line 101 of file typedObject.I.

Referenced by PT(), and CollisionNode::xform().

bool BoundedObject::is_final  )  const [inline, inherited]
 

Returns the current state of the "final" flag.

Initially, this flag is off (false), but it may be changed by an explicit call to set_final(). See set_final().

Definition at line 280 of file boundedObject.I.

bool TypedObject::is_of_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is or derives from the indicated type.

Definition at line 86 of file typedObject.I.

Referenced by EggMaterialCollection::collapse_equivalent_materials(), EggTextureCollection::collapse_equivalent_textures(), DeferredNodeProperty::compose(), AnimBundleMaker::create_s_channel(), CharacterMaker::create_slider(), ProjectionScreen::cull_callback(), DataNode::define_output(), EggNode::determine_draw_order(), CharacterMaker::egg_to_index(), EggGroupUniquifier::EggGroupUniquifier(), EggPoolUniquifier::EggPoolUniquifier(), EggGroupNode::find_textures(), StaticTextFont::get_glyph(), EggMaterialCollection::insert_materials(), EggTextureCollection::insert_textures(), CharacterJoint::make_copy(), PT(), EggGroupNode::r_flatten_transforms(), EggGroupNode::r_transform_vertices(), EggGroupNode::recompute_polygon_normals(), CollisionLevelState::reserve(), PandaFramework::reset_frame_rate(), PandaFramework::set_texture(), EggGroupNode::steal_children(), and DataGraphTraverser::traverse().

Geom::ColorIterator Geom::make_color_iterator  )  const [inline, inherited]
 

Definition at line 410 of file geom.I.

Referenced by GLGraphicsStateGuardian::draw_point(), GLGraphicsStateGuardian::draw_quad(), GeomTristrip::get_num_tris(), and CRGraphicsStateGuardian::prepare_lens().

Geom * GeomTri::make_copy void   )  const [virtual]
 

Returns a newly-allocated Geom that is a shallow copy of this one.

It will be a different Geom pointer, but its internal data may or may not be shared with that of the original Geom.

Implements Geom.

Definition at line 50 of file geomTri.cxx.

void WritableConfigurable::make_dirty void   )  [inline, inherited]
 

Definition at line 83 of file writableConfigurable.h.

Referenced by GeomSphere::draw_immediate(), Geom::get_coords_index(), get_tris(), PixelBuffer::set_size(), PixelBuffer::set_xorg(), PixelBuffer::set_ysize(), PixelBuffer::stencil_buffer(), Geom::transform_vertices(), and GeomLine::write_datagram().

TypedWritable * GeomTri::make_GeomTri const FactoryParams params  )  [static]
 

Factory method to generate a GeomTri object.

Definition at line 264 of file geomTri.cxx.

Geom::NormalIterator Geom::make_normal_iterator  )  const [inline, inherited]
 

Definition at line 354 of file geom.I.

Referenced by GLGraphicsStateGuardian::draw_point(), GLGraphicsStateGuardian::draw_quad(), GeomTristrip::get_num_tris(), and CRGraphicsStateGuardian::prepare_lens().

Geom::TexCoordIterator Geom::make_texcoord_iterator  )  const [inline, inherited]
 

Definition at line 382 of file geom.I.

Referenced by GLGraphicsStateGuardian::draw_point(), GLGraphicsStateGuardian::draw_quad(), GeomTristrip::get_num_tris(), and CRGraphicsStateGuardian::prepare_lens().

Geom::VertexIterator Geom::make_vertex_iterator  )  const [inline, inherited]
 

Definition at line 326 of file geom.I.

References Geom::_get_color, Colorf, and INLINE.

Referenced by GLGraphicsStateGuardian::draw_point(), GLGraphicsStateGuardian::draw_quad(), GeomTristrip::get_num_tris(), Geom::operator=(), and CRGraphicsStateGuardian::prepare_lens().

bool BoundedObject::mark_bound_stale  )  [inline, inherited]
 

Marks the current bounding volume as stale, so that it will be recomputed later.

This may have a cascading effect up to the root of all graphs of which the node is a part. Returns true if the setting was changed, or false if it was already marked stale (or if it is a static bounding volume).

Definition at line 162 of file boundedObject.I.

References BoundedObject::_cycler, BoundedObject::F_bound_stale, and INLINE.

Referenced by CollisionSphere::CollisionSphere(), GeomNode::combine_with(), CollisionPlane::get_normal(), PGItem::instance_to_state_def(), CollisionPlane::make_copy(), PGItem::set_active(), CollisionSphere::set_center(), TextNode::set_coordinate_system(), PandaNode::set_effect(), CollisionNode::set_from_collide_mask(), GeomNode::set_geom_state(), CollisionRay::set_origin(), CollisionSegment::set_point_a(), CollisionSphere::test_intersection(), CollisionSegment::test_intersection(), CollisionRay::test_intersection(), and CollisionNode::xform().

void Geom::output ostream &  out  )  const [virtual, inherited]
 

Definition at line 639 of file geom.cxx.

References Geom::_bind, Geom::_cindex, Geom::_get_color, Geom::_get_normal, Geom::_get_texcoord, Geom::_get_vertex, Geom::_primlengths, Geom::_tindex, G_OFF, get_color_noop(), get_normal_noop(), get_texcoord_noop(), and get_vertex_noop().

GeomContext * Geom::prepare GraphicsStateGuardianBase gsg  )  [inherited]
 

Creates a context for the Geom on the particular GSG, if it does not already exist.

Returns the new (or old) GeomContext.

If the given GeomContext pointer is non-NULL, it will be passed to the GSG, which may or may not choose to extend the existing GeomContext, or create a totally new one.

Definition at line 677 of file geom.cxx.

void GeomTri::print_draw_immediate void   )  const [virtual]
 

Implements Geom.

Definition at line 62 of file geomTri.cxx.

void dDrawable::propagate_stale_bound  )  [protected, virtual, inherited]
 

Called by BoundedObject::mark_bound_stale(), this should make sure that all bounding volumes that depend on this one are marked stale also.

Reimplemented from BoundedObject.

Definition at line 102 of file drawable.cxx.

BoundingVolume * Geom::recompute_bound  )  [protected, virtual, inherited]
 

Recomputes the dynamic bounding volume for this Geom.

This includes all of the vertices.

Reimplemented from BoundedObject.

Definition at line 796 of file geom.cxx.

References indent().

int ReferenceCount::ref  )  const [inline, inherited]
 

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void GeomTri::register_with_read_factory void   )  [static]
 

Factory method to generate a GeomTri object.

Definition at line 285 of file geomTri.cxx.

void BoundedObject::set_bound const BoundingVolume volume  )  [inline, inherited]
 

Explicitly sets a new bounding volume on this node.

This will be a static bounding volume that will no longer be recomputed automatically.

Reimplemented in PandaNode.

Definition at line 135 of file boundedObject.I.

References BoundedObject::F_bound_stale.

void BoundedObject::set_bound BoundedObject::BoundingVolumeType  type  )  [inline, inherited]
 

Sets the type of the bounding volume that will be dynamically computed for this particular node.

Presently, this should only be BVT_dynamic_sphere.

Definition at line 115 of file boundedObject.I.

BoundingVolume * BoundedObject::set_bound_ptr BoundingVolume bound  )  [inline, protected, inherited]
 

Changes the _bound pointer.

To be used only internally by derived classes, usually in recompute_bound(). The return value is the same pointer passed in, as a convenience (it will now be reference counted).

Definition at line 340 of file boundedObject.I.

void Geom::set_colors const PTA_Colorf colors,
GeomBindType  bind,
const PTA_ushort cindex = PTA_ushort()
[inherited]
 

Definition at line 366 of file geom.cxx.

References Geom::_bind, Geom::_nindex, Geom::_norms, and G_NORMAL.

Referenced by BuilderPrim::fill_geom().

void Geom::set_coords const PTA_Vertexf coords,
GeomBindType  bind,
const PTA_ushort vindex = PTA_ushort()
[inherited]
 

Definition at line 335 of file geom.cxx.

void Geom::set_coords const PTA_Vertexf coords,
const PTA_ushort vindex = PTA_ushort()
[inherited]
 

Definition at line 317 of file geom.cxx.

References Geom::_bind, Geom::_cindex, and G_COLOR.

Referenced by Geom::calc_tight_bounds(), WindowFramework::set_background_type(), and CollisionPolygon::test_intersection_from_segment().

void BoundedObject::set_final bool  flag  )  [inline, inherited]
 

Sets the "final" flag on this BoundedObject.

If this is true, than no bounding volume need be tested below it; a positive intersection with this bounding volume is deemed to be a positive intersection with all geometry inside.

This is useful to quickly force a larger bounding volume around a node when the GeomNodes themselves are inaccurate for some reason, without forcing a recompute of every nested bounding volume. It's also helpful when the bounding volume is tricked by some special properties, like billboards, that may move geometry out of its bounding volume otherwise.

Definition at line 256 of file boundedObject.I.

void Geom::set_lengths const PTA_int lengths  )  [inline, inherited]
 

Sets the array that indicates the length (number of vertices) of each primitive.

This array should have get_num_prims() entries. This only has meaning for composite type Geoms, like a GeomTristrip; it is ignored for simple Geoms, like a GeomTri.

Definition at line 262 of file geom.I.

References Geom::NormalIterator::_array, Geom::NormalIterator::_index, Geom::_nindex, Geom::_norms, WritableConfigurable::check_config(), and INLINE.

Referenced by WindowFramework::set_background_type(), and CollisionPolygon::test_intersection_from_segment().

void Geom::set_normals const PTA_Normalf norms,
GeomBindType  bind,
const PTA_ushort nindex = PTA_ushort()
[inherited]
 

Definition at line 349 of file geom.cxx.

void Geom::set_num_prims int  num  )  [inline, inherited]
 

Sets the number of primitives in the Geom.

The meaning of this depends on the precise type of Geom; generally, each prim is one triangle in a GeomTri, or one tristrip in a GeomTristrip.

Definition at line 195 of file geom.I.

Referenced by WindowFramework::set_background_type(), and CollisionPolygon::test_intersection_from_segment().

void Geom::set_texcoords const PTA_TexCoordf texcoords,
GeomBindType  bind,
const PTA_ushort tindex = PTA_ushort()
[inherited]
 

Definition at line 383 of file geom.cxx.

References Geom::_bind, Geom::_cindex, Geom::_colors, and G_COLOR.

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

Does some easy checks to make sure that the reference count isn't completely bogus.

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

void Geom::transform_vertices const LMatrix4f &  mat  )  [inherited]
 

Applies the indicated transform to all of the vertices in the Geom.

If the Geom happens to share a vertex table with another Geom, this operation will duplicate the vertex table instead of breaking the other Geom; however, if multiple Geoms with shared tables are transformed by the same matrix, they will no longer share tables after the operation. Consider using the GeomTransformer if you will be applying the same transform to multiple Geoms.

Definition at line 295 of file geom.cxx.

References Geom::_bind, Geom::_nindex, Geom::_norms, G_NORMAL, and WritableConfigurable::make_dirty().

void Geom::unprepare GraphicsStateGuardianBase gsg  )  [inherited]
 

Frees the geom context only on the indicated GSG, if it exists there.

Definition at line 721 of file geom.cxx.

References Geom::_colors, Geom::_coords, Geom::_norms, Geom::_texcoords, Geom::_vindex, and READ_PTA.

void Geom::unprepare  )  [inherited]
 

Frees the context allocated on all GSG's for which the geom has been declared.

Definition at line 702 of file geom.cxx.

Referenced by Geom::draw(), and Geom::Geom().

int ReferenceCount::unref  )  const [inline, inherited]
 

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().

virtual bool GeomTri::uses_components  )  const [inline, virtual]
 

Implements Geom.

Definition at line 47 of file geomTri.h.

void Geom::write ostream &  out,
int  indent_level = 0
const [inherited]
 

Definition at line 627 of file geom.cxx.

References Geom::_colors, Geom::_coords, Geom::_nindex, Geom::_norms, Geom::_texcoords, Geom::_vindex, PointerToArray< unsigned short >::clear(), PointerToArray< TexCoordf >::clear(), PointerToArray< Colorf >::clear(), PointerToArray< Normalf >::clear(), and PointerToArray< Vertexf >::clear().

void Geom::write_datagram BamWriter manager,
Datagram me
[virtual, inherited]
 

Function to write the important information in the particular object to a Datagram.

Reimplemented from dDrawable.

Reimplemented in GeomLine, GeomLinestrip, GeomPoint, and GeomSprite.

Definition at line 833 of file geom.cxx.

Referenced by GeomLine::draw_immediate(), GeomLinestrip::explode(), and GeomSprite::print_draw_immediate().

void Geom::write_verbose ostream &  out,
int  indent_level
const [inherited]
 

Writes to the indicated ostream a formatted picture of the contents of the Geom, in detail--but hopefully not too much detail.

Definition at line 1035 of file geom.cxx.


Member Data Documentation

enum GeomBindType Geom::_bind[num_GeomAttrTypes] [protected, inherited]
 

Definition at line 258 of file geom.h.

Referenced by Geom::get_coords(), Geom::init(), Geom::output(), Geom::set_colors(), Geom::set_coords(), Geom::set_texcoords(), Geom::transform_vertices(), and Geom::~Geom().

PTA_ushort Geom::_cindex [protected, inherited]
 

Definition at line 253 of file geom.h.

Referenced by Geom::Geom(), Geom::get_texcoords_array(), Geom::output(), Geom::set_coords(), and Geom::set_texcoords().

PTA_Colorf Geom::_colors [protected, inherited]
 

Definition at line 248 of file geom.h.

Referenced by Geom::Geom(), Geom::set_texcoords(), Geom::unprepare(), and Geom::write().

PTA_Vertexf Geom::_coords [protected, inherited]
 

Definition at line 246 of file geom.h.

Referenced by Geom::Geom(), Geom::get_binding(), Geom::unprepare(), and Geom::write().

GetNextColor* Geom::_get_color [protected, inherited]
 

Definition at line 264 of file geom.h.

Referenced by Geom::make_vertex_iterator(), and Geom::output().

GetNextNormal* Geom::_get_normal [protected, inherited]
 

Definition at line 262 of file geom.h.

Referenced by Geom::output().

GetNextTexCoord* Geom::_get_texcoord [protected, inherited]
 

Definition at line 263 of file geom.h.

Referenced by Geom::output().

GetNextVertex* Geom::_get_vertex [protected, inherited]
 

Definition at line 261 of file geom.h.

Referenced by Geom::output().

PTA_ushort Geom::_nindex [protected, inherited]
 

Definition at line 252 of file geom.h.

Referenced by Geom::Geom(), Geom::set_colors(), Geom::set_lengths(), Geom::transform_vertices(), and Geom::write().

PTA_Normalf Geom::_norms [protected, inherited]
 

Definition at line 247 of file geom.h.

Referenced by Geom::Geom(), Geom::set_colors(), Geom::set_lengths(), Geom::transform_vertices(), Geom::unprepare(), and Geom::write().

int Geom::_num_vertices [protected, inherited]
 

Definition at line 256 of file geom.h.

Referenced by Geom::clear_gsg(), Geom::Geom(), Geom::get_colors_index(), and Geom::get_coords_index().

int Geom::_numprims [protected, inherited]
 

Definition at line 256 of file geom.h.

Referenced by Geom::clear_gsg(), draw_immediate(), GeomQuad::draw_immediate(), Geom::Geom(), and Geom::get_coords_index().

GeomContext* Geom::_prepared_context [protected, inherited]
 

Definition at line 273 of file geom.h.

Referenced by Geom::config(), Geom::draw(), and Geom::get_texcoords().

GraphicsStateGuardianBase* Geom::_prepared_gsg [protected, inherited]
 

Definition at line 272 of file geom.h.

Referenced by Geom::config(), Geom::draw(), and Geom::get_texcoords().

PTA_int Geom::_primlengths [protected, inherited]
 

Definition at line 257 of file geom.h.

Referenced by GeomTristrip::draw_immediate(), Geom::Geom(), and Geom::output().

PTA_TexCoordf Geom::_texcoords [protected, inherited]
 

Definition at line 249 of file geom.h.

Referenced by Geom::Geom(), Geom::get_normals_array(), Geom::unprepare(), and Geom::write().

PTA_ushort Geom::_tindex [protected, inherited]
 

Definition at line 254 of file geom.h.

Referenced by Geom::Geom(), Geom::get_coords(), and Geom::output().

TypeHandle GeomTri::_type_handle [static, private]
 

Reimplemented from Geom.

Definition at line 33 of file geomTri.cxx.

PTA_ushort Geom::_vindex [protected, inherited]
 

Definition at line 251 of file geom.h.

Referenced by draw_immediate(), GeomQuad::draw_immediate(), Geom::Geom(), Geom::unprepare(), and Geom::write().

TypedWritable *const TypedWritable::Null = (TypedWritable*)0L [static, inherited]
 

Definition at line 25 of file typedWritable.cxx.

Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), PartGroup::pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram().


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