Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
EggVertexPool Class Reference

A collection of vertices. More...

#include "eggVertexPool.h"

Inheritance diagram for EggVertexPool:
EggNode EggNamedObject EggObject Namable TypedReferenceCount MemoryBase TypedObject ReferenceCount MemoryBase MemoryBase

Public Types

typedef iterator const_iterator
 
typedef second_of_pair_iterator< IndexVertices::const_iterator > iterator
 
typedef IndexVertices::size_type size_type
 

Public Member Functions

 EggVertexPool (const std::string &name)
 
 EggVertexPool (const EggVertexPool &copy)
 Copying a vertex pool is of questionable value, since it will copy all of the vertices and assign new pointers to them all. More...
 
void add_unused_vertices_to_prim (EggPrimitive *prim)
 Adds all of the unused vertices in this vertex pool to the indicated primitive, in ascending order. More...
 
EggVertexadd_vertex (EggVertex *vertex, int index=-1)
 Adds the indicated vertex to the pool. More...
 
iterator begin () const
 Returns an iterator that can be used to traverse through all the vertices in the pool. More...
 
void check_overall_color (bool &has_overall_color, LColor &overall_color) const
 Scans the vertex pool for different colors on different vertices. More...
 
EggVertexcreate_unique_vertex (const EggVertex &copy)
 Creates a new vertex in the pool that is a copy of the indicated one and returns it. More...
 
bool empty () const
 Returns true if the pool is empty. More...
 
iterator end () const
 Returns an iterator that can be used to traverse through all the vertices in the pool. More...
 
EggVertexfind_matching_vertex (const EggVertex &copy)
 If the EggVertexPool already has a vertex matching the indicated vertex, returns it; otherwise, returns NULL. More...
 
virtual TypeHandle force_init_type ()
 
void get_aux_names (vector_string &aux_names) const
 Returns the list of auxiliary data names that are defined by any vertices in the pool. More...
 
EggVertexget_forward_vertex (int index)
 Returns the vertex in the pool with the indicated index number. More...
 
int get_highest_index () const
 Returns the highest index number used by any vertex in the pool (except forward references). More...
 
int get_num_dimensions () const
 Returns the maximum number of dimensions used by any vertex in the pool. More...
 
virtual TypeHandle get_type () const
 
void get_uv_names (vector_string &uv_names, vector_string &uvw_names, vector_string &tbn_names) const
 Returns the list of UV names that are defined by any vertices in the pool, as well as the subset of UV names that actually define 3-d texture coordinates ("uvw_names"). More...
 
EggVertexget_vertex (int index) const
 Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number. More...
 
bool has_aux () const
 Returns true if any vertex in the pool has auxiliary data defined, false if none of them do. More...
 
bool has_colors () const
 Returns true if any vertex in the pool has a color defined, false if none of them do. More...
 
bool has_defined_vertices () const
 Returns true if any vertices in the pool are fully defined vertices, false if all vertices are forward references. More...
 
bool has_forward_vertices () const
 Returns true if any vertices in the pool are undefined forward-reference vertices, false if all vertices are defined. More...
 
bool has_nonwhite_colors () const
 Returns true if any vertex in the pool has a color defined other than white, false if no vertices have colors, or if all colors are white. More...
 
bool has_normals () const
 Returns true if any vertex in the pool has a normal defined, false if none of them do. More...
 
bool has_uvs () const
 Returns true if any vertex in the pool has a uv defined, false if none of them do. More...
 
bool has_vertex (int index) const
 Returns true if the indicated vertex has been defined in the vertex pool, false otherwise. More...
 
EggVertexmake_new_vertex ()
 Allocates and returns a new vertex from the pool. More...
 
EggVertexmake_new_vertex (double pos)
 Allocates and returns a new vertex from the pool. More...
 
EggVertexmake_new_vertex (const LPoint2d &pos)
 Allocates and returns a new vertex from the pool. More...
 
EggVertexmake_new_vertex (const LPoint3d &pos)
 Allocates and returns a new vertex from the pool. More...
 
EggVertexmake_new_vertex (const LPoint4d &pos)
 Allocates and returns a new vertex from the pool. More...
 
EggVertexoperator [] (int index) const
 Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number. More...
 
int remove_unused_vertices ()
 Removes all vertices from the pool that are not referenced by at least one primitive. More...
 
void remove_vertex (EggVertex *vertex)
 Removes the vertex from the pool. More...
 
void set_highest_index (int highest_index)
 Artificially changes the "highest index number", so that a newly created vertex will begin at this number plus 1. More...
 
size_type size () const
 Returns the number of vertices in the pool. More...
 
void sort_by_external_index ()
 Re-orders (and re-numbers) the vertices in this vertex pool so that they appear in increasing order by the optional external_index that has been assigned to each vertex. More...
 
void transform (const LMatrix4d &mat)
 Applies the indicated transformation matrix to all the vertices. More...
 
void write (std::ostream &out, int indent_level) const
 Writes the vertex pool to the indicated output stream in Egg format. More...
 
- Public Member Functions inherited from EggNode
 EggNode (const std::string &name="")
 
 EggNode (const EggNode &copy)
 
void apply_texmats ()
 Applies the texture matrices to the UV's of the vertices that reference them, and then removes the texture matrices from the textures themselves. More...
 
virtual EggRenderModedetermine_alpha_mode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has an alpha_mode other than AM_unspecified. More...
 
virtual EggRenderModedetermine_bin ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a bin specified. More...
 
virtual bool determine_decal ()
 Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set. More...
 
virtual EggRenderModedetermine_depth_offset ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_offset specified. More...
 
virtual EggRenderModedetermine_depth_test_mode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_test_mode other than DTM_unspecified. More...
 
virtual EggRenderModedetermine_depth_write_mode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_write_mode other than DWM_unspecified. More...
 
virtual EggRenderModedetermine_draw_order ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a draw_order specified. More...
 
virtual bool determine_indexed ()
 Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set. More...
 
virtual EggRenderModedetermine_visibility_mode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a visibility_mode other than VM_unspecified. More...
 
void flatten_transforms ()
 Removes any transform and instance records from this node in the scene graph and below. More...
 
int get_depth () const
 
const LMatrix4d & get_node_frame () const
 Returns the coordinate frame of the node itself. More...
 
const LMatrix4d & get_node_frame_inv () const
 Returns the inverse of the matrix returned by get_node_frame(). More...
 
const LMatrix4d * get_node_frame_inv_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame_inv() matrix. More...
 
const LMatrix4d * get_node_frame_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix. More...
 
const LMatrix4d & get_node_to_vertex () const
 Returns the transformation matrix suitable for converting vertices in the coordinate space of the node to the appropriate coordinate space for storing in the egg file. More...
 
const LMatrix4d * get_node_to_vertex_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_to_vertex() matrix. More...
 
EggGroupNodeget_parent () const
 
const LMatrix4d & get_vertex_frame () const
 Returns the coordinate frame of the vertices referenced by primitives at or under this node. More...
 
const LMatrix4d & get_vertex_frame_inv () const
 Returns the inverse of the matrix returned by get_vertex_frame(). More...
 
const LMatrix4d * get_vertex_frame_inv_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame_inv() matrix. More...
 
const LMatrix4d * get_vertex_frame_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix. More...
 
const LMatrix4d & get_vertex_to_node () const
 Returns the transformation matrix suitable for converting the vertices as read from the egg file into the coordinate space of the node. More...
 
const LMatrix4d * get_vertex_to_node_ptr () const
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_to_node() matrix. More...
 
virtual bool is_anim_matrix () const
 Returns true if this node represents a table of animation transformation data, false otherwise. More...
 
virtual bool is_joint () const
 Returns true if this particular node represents a <Joint> entry or not. More...
 
bool is_local_coord () const
 Returns true if this node's vertices are not in the global coordinate space. More...
 
bool is_under_instance () const
 Returns true if there is an <Instance> node somewhere in the egg tree at or above this node, false otherwise. More...
 
bool is_under_transform () const
 Returns true if there is a <Transform> entry somewhere in the egg tree at or above this node, false otherwise. More...
 
EggNodeoperator= (const EggNode &copy)
 
bool parse_egg (const std::string &egg_syntax)
 Parses the egg syntax given in the indicate string as if it had been read from the egg file within this object's definition. More...
 
int rename_node (vector_string strip_prefix)
 Rename by stripping out the prefix. More...
 
void test_under_integrity () const
 
void transform (const LMatrix4d &mat)
 Applies the indicated transformation to the node and all of its descendants. More...
 
void transform_vertices_only (const LMatrix4d &mat)
 Applies the indicated transformation only to vertices that appear in global space within vertex pools at this node and below. More...
 
- Public Member Functions inherited from EggNamedObject
 EggNamedObject (const std::string &name="")
 
 EggNamedObject (const EggNamedObject &copy)
 
EggNamedObjectoperator= (const EggNamedObject &copy)
 
void output (std::ostream &out) const
 
void write_header (std::ostream &out, int indent_level, const char *egg_keyword) const
 Writes the first line of the egg object, e.g. More...
 
- Public Member Functions inherited from EggObject
 EggObject (const EggObject &copy)
 
virtual EggTransformas_transform ()
 Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not. More...
 
void clear_user_data ()
 Removes *all* user data pointers from the node. More...
 
void clear_user_data (TypeHandle type)
 Removes the user data pointer of the indicated type. More...
 
EggUserDataget_user_data () const
 Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored. More...
 
EggUserDataget_user_data (TypeHandle type) const
 Returns the user data pointer of the indicated type, if it exists, or NULL if it does not. More...
 
bool has_user_data () const
 Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise. More...
 
bool has_user_data (TypeHandle type) const
 Returns true if the user data pointer of the indicated type has been set, false otherwise. More...
 
EggObjectoperator= (const EggObject &copy)
 
void set_user_data (EggUserData *user_data)
 Sets the user data associated with this object. More...
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 
- Public Member Functions inherited from Namable
 Namable (const std::string &initial_name="")
 
void clear_name ()
 Resets the Namable's name to empty. More...
 
const std::string & get_name () const
 
bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
void output (std::ostream &out) const
 Outputs the Namable. More...
 
void set_name (const std::string &name)
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from EggNode
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from EggNamedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from EggObject
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from Namable
static TypeHandle get_class_type ()
 
static void init_type ()
 

Friends

class EggVertex
 

Additional Inherited Members

- Public Attributes inherited from EggNode
 get_depth
 Returns the number of nodes above this node in the egg hierarchy. More...
 
 get_parent
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 
- Public Attributes inherited from Namable
 get_name
 
 set_name
 

Detailed Description

A collection of vertices.

There may be any number of vertex pools in a single egg structure. The vertices in a single pool need not necessarily have any connection to each other, but it is necessary that any one primitive (e.g. a polygon) must pull all its vertices from the same pool.

An EggVertexPool is an STL-style container of pointers to EggVertex's. Functions add_vertex() and remove_vertex() are provided to manipulate the list. The list may also be operated on (read-only) via iterators and begin()/end().

Definition at line 41 of file eggVertexPool.h.

Constructor & Destructor Documentation

◆ EggVertexPool()

EggVertexPool::EggVertexPool ( const EggVertexPool copy)

Copying a vertex pool is of questionable value, since it will copy all of the vertices and assign new pointers to them all.

There will be no polygons referring to the new vertices.

Definition at line 41 of file eggVertexPool.cxx.

Member Function Documentation

◆ add_unused_vertices_to_prim()

void EggVertexPool::add_unused_vertices_to_prim ( EggPrimitive prim)

Adds all of the unused vertices in this vertex pool to the indicated primitive, in ascending order.

Definition at line 631 of file eggVertexPool.cxx.

References EggPrimitive::add_vertex(), and EggVertex::pref_size().

◆ add_vertex()

EggVertex * EggVertexPool::add_vertex ( EggVertex vertex,
int  index = -1 
)

Adds the indicated vertex to the pool.

It is an error if the vertex is already a member of this or any other pool. The vertex must have been allocated from the free store; its pointer will now be owned by the vertex pool. If the index number is supplied, tries to assign that index number; it is an error if the index number is already in use.

It is possible that a forward reference to this vertex was requested in the past; if so, the data from the supplied vertex is copied onto the forward reference, which becomes the actual vertex. In this case, a different pointer is saved (and returned) than the one actually passed in. In the usual case, however, the vertex pointer passed in is the one that is saved in the vertex pool and returned from this method.

Definition at line 421 of file eggVertexPool.cxx.

Referenced by create_unique_vertex(), make_new_vertex(), and split_vertex().

◆ begin()

EggVertexPool::iterator EggVertexPool::begin ( ) const

Returns an iterator that can be used to traverse through all the vertices in the pool.

Definition at line 374 of file eggVertexPool.cxx.

◆ check_overall_color()

void EggVertexPool::check_overall_color ( bool &  has_overall_color,
LColor &  overall_color 
) const

Scans the vertex pool for different colors on different vertices.

If all vertices are the same color, sets has_overall_color to true and fills the color into overall_color. If no vertices have any color, set has_overall_color to true and fills white into overall_color. If at least two vertices have different colors, sets has_overall_color to false.

Definition at line 248 of file eggVertexPool.cxx.

References empty(), and EggAttributes::get_color().

◆ create_unique_vertex()

EggVertex * EggVertexPool::create_unique_vertex ( const EggVertex copy)

Creates a new vertex in the pool that is a copy of the indicated one and returns it.

If there is already a vertex in the pool like the indicated one, simply returns that one.

Definition at line 472 of file eggVertexPool.cxx.

References add_vertex().

◆ empty()

bool EggVertexPool::empty ( ) const

Returns true if the pool is empty.

Definition at line 393 of file eggVertexPool.cxx.

Referenced by check_overall_color().

◆ end()

EggVertexPool::iterator EggVertexPool::end ( ) const

Returns an iterator that can be used to traverse through all the vertices in the pool.

Definition at line 385 of file eggVertexPool.cxx.

◆ find_matching_vertex()

EggVertex * EggVertexPool::find_matching_vertex ( const EggVertex copy)

If the EggVertexPool already has a vertex matching the indicated vertex, returns it; otherwise, returns NULL.

This is similar to create_unique_vertex() except that a new vertex is never created.

Definition at line 491 of file eggVertexPool.cxx.

◆ get_aux_names()

void EggVertexPool::get_aux_names ( vector_string &  aux_names) const

Returns the list of auxiliary data names that are defined by any vertices in the pool.

Definition at line 351 of file eggVertexPool.cxx.

References EggVertex::aux_begin(), and EggVertex::aux_end().

Referenced by PT().

◆ get_forward_vertex()

EggVertex * EggVertexPool::get_forward_vertex ( int  index)

Returns the vertex in the pool with the indicated index number.

If there is not a vertex in the pool with the indicated index number, creates a special forward-reference EggVertex that has no data, on the assumption that the vertex pool has not yet been fully read and more data will be available later.

Definition at line 137 of file eggVertexPool.cxx.

◆ get_highest_index()

int EggVertexPool::get_highest_index ( ) const

Returns the highest index number used by any vertex in the pool (except forward references).

Returns -1 if the pool is empty.

Definition at line 156 of file eggVertexPool.cxx.

◆ get_num_dimensions()

int EggVertexPool::get_num_dimensions ( ) const

Returns the maximum number of dimensions used by any vertex in the pool.

Definition at line 175 of file eggVertexPool.cxx.

References EggVertex::get_num_dimensions().

Referenced by PT().

◆ get_uv_names()

void EggVertexPool::get_uv_names ( vector_string &  uv_names,
vector_string &  uvw_names,
vector_string &  tbn_names 
) const

Returns the list of UV names that are defined by any vertices in the pool, as well as the subset of UV names that actually define 3-d texture coordinates ("uvw_names").

Also returns the subset of UV/UVW names that define a tangent and binormal. It is the user's responsibility to clear both vectors before calling this method.

Definition at line 315 of file eggVertexPool.cxx.

References EggVertexUV::has_w(), EggVertex::uv_begin(), and EggVertex::uv_end().

Referenced by PT().

◆ get_vertex()

EggVertex * EggVertexPool::get_vertex ( int  index) const

Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number.

Definition at line 115 of file eggVertexPool.cxx.

References EggVertex::is_forward_reference().

Referenced by EggMesherEdge::compute_box(), EggMesherEdge::compute_length(), has_vertex(), and operator []().

◆ has_aux()

bool EggVertexPool::has_aux ( ) const

Returns true if any vertex in the pool has auxiliary data defined, false if none of them do.

Definition at line 295 of file eggVertexPool.cxx.

References EggVertex::has_aux().

◆ has_colors()

bool EggVertexPool::has_colors ( ) const

Returns true if any vertex in the pool has a color defined, false if none of them do.

Definition at line 209 of file eggVertexPool.cxx.

◆ has_defined_vertices()

bool EggVertexPool::has_defined_vertices ( ) const

Returns true if any vertices in the pool are fully defined vertices, false if all vertices are forward references.

Definition at line 98 of file eggVertexPool.cxx.

References EggVertex::is_forward_reference().

◆ has_forward_vertices()

bool EggVertexPool::has_forward_vertices ( ) const

Returns true if any vertices in the pool are undefined forward-reference vertices, false if all vertices are defined.

Definition at line 81 of file eggVertexPool.cxx.

References EggVertex::is_forward_reference().

◆ has_nonwhite_colors()

bool EggVertexPool::has_nonwhite_colors ( ) const

Returns true if any vertex in the pool has a color defined other than white, false if no vertices have colors, or if all colors are white.

Definition at line 226 of file eggVertexPool.cxx.

References EggAttributes::get_color().

◆ has_normals()

bool EggVertexPool::has_normals ( ) const
virtual

Returns true if any vertex in the pool has a normal defined, false if none of them do.

Reimplemented from EggNode.

Definition at line 192 of file eggVertexPool.cxx.

Referenced by PT().

◆ has_uvs()

bool EggVertexPool::has_uvs ( ) const

Returns true if any vertex in the pool has a uv defined, false if none of them do.

Definition at line 278 of file eggVertexPool.cxx.

References EggVertex::has_uv().

◆ has_vertex()

bool EggVertexPool::has_vertex ( int  index) const
inline

Returns true if the indicated vertex has been defined in the vertex pool, false otherwise.

This does not include forward references.

Definition at line 19 of file eggVertexPool.I.

References get_vertex().

◆ make_new_vertex() [1/5]

EggVertex * EggVertexPool::make_new_vertex ( )
inline

Allocates and returns a new vertex from the pool.

This is one of three ways to add new vertices to a vertex pool.

Definition at line 37 of file eggVertexPool.I.

References add_vertex().

Referenced by make_new_vertex().

◆ make_new_vertex() [2/5]

EggVertex * EggVertexPool::make_new_vertex ( double  pos)
inline

Allocates and returns a new vertex from the pool.

This is one of three ways to add new vertices to a vertex pool.

This flavor of make_new_vertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

Definition at line 50 of file eggVertexPool.I.

References make_new_vertex(), and EggVertex::set_pos().

◆ make_new_vertex() [3/5]

EggVertex * EggVertexPool::make_new_vertex ( const LPoint2d &  pos)
inline

Allocates and returns a new vertex from the pool.

This is one of three ways to add new vertices to a vertex pool.

This flavor of make_new_vertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

Definition at line 64 of file eggVertexPool.I.

References make_new_vertex(), and EggVertex::set_pos().

◆ make_new_vertex() [4/5]

EggVertex * EggVertexPool::make_new_vertex ( const LPoint3d &  pos)
inline

Allocates and returns a new vertex from the pool.

This is one of three ways to add new vertices to a vertex pool.

This flavor of make_new_vertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

Definition at line 78 of file eggVertexPool.I.

References make_new_vertex(), and EggVertex::set_pos().

◆ make_new_vertex() [5/5]

EggVertex * EggVertexPool::make_new_vertex ( const LPoint4d &  pos)
inline

Allocates and returns a new vertex from the pool.

This is one of three ways to add new vertices to a vertex pool.

This flavor of make_new_vertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

Definition at line 92 of file eggVertexPool.I.

References make_new_vertex(), and EggVertex::set_pos().

◆ operator []()

EggVertex * EggVertexPool::operator [] ( int  index) const
inline

Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number.

Definition at line 28 of file eggVertexPool.I.

References get_vertex().

◆ remove_unused_vertices()

int EggVertexPool::remove_unused_vertices ( )

Removes all vertices from the pool that are not referenced by at least one primitive.

Also collapses together equivalent vertices, and renumbers all vertices after the operation so their indices are consecutive, beginning at zero. Returns the number of vertices removed.

Definition at line 566 of file eggVertexPool.cxx.

References EggVertex::clear_grefs(), and EggVertex::pref_size().

◆ remove_vertex()

void EggVertexPool::remove_vertex ( EggVertex vertex)

Removes the vertex from the pool.

It is an error if the vertex is not already a member of the pool.

Definition at line 510 of file eggVertexPool.cxx.

◆ set_highest_index()

void EggVertexPool::set_highest_index ( int  highest_index)

Artificially changes the "highest index number", so that a newly created vertex will begin at this number plus 1.

This can be used to default a vertex pool to start counting at 1 (or any other index number), instead of the default of 0. Use with caution.

Definition at line 167 of file eggVertexPool.cxx.

◆ size()

EggVertexPool::size_type EggVertexPool::size ( ) const

Returns the number of vertices in the pool.

Definition at line 401 of file eggVertexPool.cxx.

Referenced by sort_by_external_index().

◆ sort_by_external_index()

void EggVertexPool::sort_by_external_index ( )

Re-orders (and re-numbers) the vertices in this vertex pool so that they appear in increasing order by the optional external_index that has been assigned to each vertex.

Definition at line 746 of file eggVertexPool.cxx.

References size().

◆ transform()

void EggVertexPool::transform ( const LMatrix4d &  mat)

Applies the indicated transformation matrix to all the vertices.

However, vertices that are attached to primitives that believe their vertices are in a local coordinate system are transformed only by the scale and rotation component. If a vertex happens to be attached both to a local and a global primitive, and the transformation includes a translation component, the vertex will be split.

Definition at line 658 of file eggVertexPool.cxx.

◆ write()

void EggVertexPool::write ( std::ostream &  out,
int  indent_level 
) const
virtual

Writes the vertex pool to the indicated output stream in Egg format.

Implements EggNode.

Definition at line 775 of file eggVertexPool.cxx.

References EggNamedObject::write_header().


The documentation for this class was generated from the following files: