Panda3D

Loading...
Searching...
No Matches
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:

## 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 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.
| EggVertexPool (const std::string &name)
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.
EggVertex * | add_vertex (EggVertex *vertex, int index=-1)
| Adds the indicated vertex to the pool.
iterator | begin () const
| Returns an iterator that can be used to traverse through all the vertices in the pool.
void | check_overall_color (bool &has_overall_color, LColor &overall_color) const
| Scans the vertex pool for different colors on different vertices.
EggVertex * | create_unique_vertex (const EggVertex &copy)
| Creates a new vertex in the pool that is a copy of the indicated one and returns it.
bool | empty () const
| Returns true if the pool is empty.
iterator | end () const
| Returns an iterator that can be used to traverse through all the vertices in the pool.
EggVertex * | find_matching_vertex (const EggVertex &copy)
| If the EggVertexPool already has a vertex matching the indicated vertex, returns it; otherwise, returns NULL.
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.
EggVertex * | get_forward_vertex (int index)
| Returns the vertex in the pool with the indicated index number.
int | get_highest_index () const
| Returns the highest index number used by any vertex in the pool (except forward references).
int | get_num_dimensions () const
| Returns the maximum number of dimensions used by any vertex in the pool.
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").
EggVertex * | 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.
bool | has_aux () const
| Returns true if any vertex in the pool has auxiliary data defined, false if none of them do.
bool | has_colors () const
| Returns true if any vertex in the pool has a color defined, false if none of them do.
bool | has_defined_vertices () const
| Returns true if any vertices in the pool are fully defined vertices, false if all vertices are forward references.
bool | has_forward_vertices () const
| Returns true if any vertices in the pool are undefined forward-reference vertices, false if all vertices are defined.
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.
bool | has_normals () const
| Returns true if any vertex in the pool has a normal defined, false if none of them do.
bool | has_uvs () const
| Returns true if any vertex in the pool has a uv defined, false if none of them do.
bool | has_vertex (int index) const
| Returns true if the indicated vertex has been defined in the vertex pool, false otherwise.
EggVertex * | make_new_vertex ()
| Allocates and returns a new vertex from the pool.
EggVertex * | make_new_vertex (const LPoint2d &pos)
| Allocates and returns a new vertex from the pool.
EggVertex * | make_new_vertex (const LPoint3d &pos)
| Allocates and returns a new vertex from the pool.
EggVertex * | make_new_vertex (const LPoint4d &pos)
| Allocates and returns a new vertex from the pool.
EggVertex * | make_new_vertex (double pos)
| Allocates and returns a new vertex from the pool.
EggVertex * | operator[] (int index) const
| Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number.
int | remove_unused_vertices ()
| Removes all vertices from the pool that are not referenced by at least one primitive.
void | remove_vertex (EggVertex *vertex)
| Removes the vertex from the pool.
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.
size_type | size () const
| Returns the number of vertices in the pool.
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.
void | transform (const LMatrix4d &mat)
| Applies the indicated transformation matrix to all the vertices.
void | write (std::ostream &out, int indent_level) const
| Writes the vertex pool to the indicated output stream in Egg format.
Public Member Functions inherited from EggNode
| EggNode (const EggNode &copy)
| EggNode (const std::string &name="")
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.
virtual EggRenderMode * | determine_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.
virtual EggRenderMode * | determine_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.
virtual bool | determine_decal ()
| Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set.
virtual EggRenderMode * | determine_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.
virtual EggRenderMode * | determine_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.
virtual EggRenderMode * | determine_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.
virtual EggRenderMode * | determine_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.
virtual bool | determine_indexed ()
| Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set.
virtual EggRenderMode * | determine_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.
void | flatten_transforms ()
| Removes any transform and instance records from this node in the scene graph and below.
int | get_depth () const
const LMatrix4d & | get_node_frame () const
| Returns the coordinate frame of the node itself.
const LMatrix4d & | get_node_frame_inv () const
| Returns the inverse of the matrix returned by get_node_frame().
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.
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.
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.
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.
EggGroupNode * | get_parent () const
const LMatrix4d & | get_vertex_frame () const
| Returns the coordinate frame of the vertices referenced by primitives at or under this node.
const LMatrix4d & | get_vertex_frame_inv () const
| Returns the inverse of the matrix returned by get_vertex_frame().
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.
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.
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.
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.
virtual bool | is_anim_matrix () const
| Returns true if this node represents a table of animation transformation data, false otherwise.
virtual bool | is_joint () const
| Returns true if this particular node represents a <Joint> entry or not.
bool | is_local_coord () const
| Returns true if this node's vertices are not in the global coordinate space.
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.
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.
EggNode & | operator= (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.
int | rename_node (vector_string strip_prefix)
| Rename by stripping out the prefix.
void | test_under_integrity () const
void | transform (const LMatrix4d &mat)
| Applies the indicated transformation to the node and all of its descendants.
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.
Public Member Functions inherited from EggNamedObject
| EggNamedObject (const EggNamedObject &copy)
| EggNamedObject (const std::string &name="")
EggNamedObject & | operator= (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.
Public Member Functions inherited from EggObject
| EggObject (const EggObject &copy)
virtual EggTransform * | as_transform ()
| Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.
void | clear_user_data ()
| Removes *all* user data pointers from the node.
void | clear_user_data (TypeHandle type)
| Removes the user data pointer of the indicated type.
EggUserData * | get_user_data () const
| Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored.
EggUserData * | get_user_data (TypeHandle type) const
| Returns the user data pointer of the indicated type, if it exists, or NULL if it does not.
bool | has_user_data () const
| Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.
bool | has_user_data (TypeHandle type) const
| Returns true if the user data pointer of the indicated type has been set, false otherwise.
EggObject & | operator= (const EggObject &copy)
void | set_user_data (EggUserData *user_data)
| Sets the user data associated with this object.
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
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
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.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.
Public Member Functions inherited from Namable
| Namable (const std::string &initial_name="")
void | clear_name ()
| Resets the Namable's name to empty.
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.
void | output (std::ostream &out) const
| Outputs the Namable.
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.
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.
| get_parent
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.
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.

## Member Typedef Documentation

## ◆ const_iterator

typedef iterator EggVertexPool::const_iterator

Definition at line 62 of file eggVertexPool.h.

## ◆ iterator

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

Definition at line 61 of file eggVertexPool.h.

## ◆ size_type

typedef IndexVertices::size_type EggVertexPool::size_type

Definition at line 63 of file eggVertexPool.h.

## Constructor & Destructor Documentation

## ◆ EggVertexPool() [1/2]

EggVertexPool::EggVertexPool | ( | const std::string & | name | ) |
| explicit

Definition at line 30 of file eggVertexPool.cxx.

## ◆ EggVertexPool() [2/2]

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 40 of file eggVertexPool.cxx.

References begin(), and end().

## ◆ ~EggVertexPool()

EggVertexPool::~EggVertexPool | ( |  | ) |

Definition at line 52 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 630 of file eggVertexPool.cxx.

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

Referenced by EggGroupNode::make_point_primitives().

## ◆ 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 420 of file eggVertexPool.cxx.

References get_highest_index(), and EggVertex::is_forward_reference().

Referenced by create_unique_vertex(), get_forward_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 373 of file eggVertexPool.cxx.

Referenced by EggVertexPool(), XFileMesh::create_polygons(), sort_by_external_index(), transform(), and write().

## ◆ 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 247 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 471 of file eggVertexPool.cxx.

References add_vertex().

Referenced by XFileMesh::create_polygons(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::strip_normals(), EggCompositePrimitive::unify_attributes(), and EggPrimitive::unify_attributes().

## ◆ empty()

bool EggVertexPool::empty | ( |  | ) | const

Returns true if the pool is empty.

Definition at line 392 of file eggVertexPool.cxx.

Referenced by check_overall_color(), and EggGroupNode::remove_unused_vertices().

## ◆ 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 384 of file eggVertexPool.cxx.

Referenced by EggVertexPool(), XFileMesh::create_polygons(), sort_by_external_index(), transform(), and write().

## ◆ 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 490 of file eggVertexPool.cxx.

Referenced by EggGroupNode::rebuild_vertex_pools().

## ◆ force_init_type()

virtual TypeHandle EggVertexPool::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from EggNode.

Definition at line 158 of file eggVertexPool.h.

## ◆ 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 350 of file eggVertexPool.cxx.

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

## ◆ get_class_type()

static TypeHandle EggVertexPool::get_class_type | ( |  | ) |
| inline static

Definition at line 147 of file eggVertexPool.h.

## ◆ 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 136 of file eggVertexPool.cxx.

References add_vertex().

## ◆ 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 155 of file eggVertexPool.cxx.

Referenced by add_vertex().

## ◆ 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 174 of file eggVertexPool.cxx.

References EggVertex::get_num_dimensions().

## ◆ get_type()

virtual TypeHandle EggVertexPool::get_type | ( |  | ) | const
| inline virtual

Reimplemented from EggNode.

Definition at line 155 of file eggVertexPool.h.

## ◆ 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 314 of file eggVertexPool.cxx.

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

## ◆ 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 114 of file eggVertexPool.cxx.

References EggVertex::is_forward_reference().

Referenced by EggMesherFanMaker::compute_angle(), EggMesherEdge::compute_box(), EggMesherEdge::compute_length(), EggMesherStrip::convex_quad(), has_vertex(), operator[](), PT(), remove_vertex(), and EggMesherFanMaker::unroll().

## ◆ 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 294 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 208 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 97 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 80 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 225 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 191 of file eggVertexPool.cxx.

## ◆ 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 277 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 18 of file eggVertexPool.I.

References get_vertex().

## ◆ init_type()

static void EggVertexPool::init_type | ( |  | ) |
| inline static

Definition at line 150 of file eggVertexPool.h.

## ◆ 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 36 of file eggVertexPool.I.

References add_vertex().

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

## ◆ make_new_vertex() [2/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 63 of file eggVertexPool.I.

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

## ◆ make_new_vertex() [3/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 77 of file eggVertexPool.I.

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

## ◆ make_new_vertex() [4/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 91 of file eggVertexPool.I.

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

## ◆ make_new_vertex() [5/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 49 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 27 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 565 of file eggVertexPool.cxx.

References EggVertex::clear_grefs(), EggPrimitive::find(), EggVertex::pref_size(), EggPrimitive::replace(), and size().

Referenced by EggLoader::make_polyset(), and EggGroupNode::remove_unused_vertices().

## ◆ 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 509 of file eggVertexPool.cxx.

References get_vertex().

## ◆ 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 166 of file eggVertexPool.cxx.

## ◆ size()

EggVertexPool::size_type EggVertexPool::size | ( |  | ) | const

Returns the number of vertices in the pool.

Definition at line 400 of file eggVertexPool.cxx.

Referenced by EggGroupNode::rebuild_vertex_pools(), remove_unused_vertices(), sort_by_external_index(), and transform().

## ◆ 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 745 of file eggVertexPool.cxx.

References begin(), end(), and 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 657 of file eggVertexPool.cxx.

References begin(), end(), EggVertex::get_num_global_coord(), EggVertex::get_num_local_coord(), size(), split_vertex(), and EggVertex::transform().

## ◆ 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 774 of file eggVertexPool.cxx.

References begin(), end(), indent(), and EggNamedObject::write_header().

## Friends And Related Symbol Documentation

## ◆ EggVertex

friend class EggVertex
| friend

Definition at line 163 of file eggVertexPool.h.

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

- panda/src/egg/eggVertexPool.h
- panda/src/egg/eggVertexPool.cxx
- panda/src/egg/eggVertexPool.I