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 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 (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 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
 Returns the number of nodes above this node in the egg hierarchy. More...
 
const LMatrix4dget_node_frame () const
 Returns the coordinate frame of the node itself. More...
 
const LMatrix4dget_node_frame_inv () const
 Returns the inverse of the matrix returned by get_node_frame(). More...
 
const LMatrix4dget_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 LMatrix4dget_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 LMatrix4dget_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 LMatrix4dget_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 LMatrix4dget_vertex_frame () const
 Returns the coordinate frame of the vertices referenced by primitives at or under this node. More...
 
const LMatrix4dget_vertex_frame_inv () const
 Returns the inverse of the matrix returned by get_vertex_frame(). More...
 
const LMatrix4dget_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 LMatrix4dget_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 LMatrix4dget_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 LMatrix4dget_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 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 string &name="")
 
 EggNamedObject (const EggNamedObject &copy)
 
EggNamedObjectoperator= (const EggNamedObject &copy)
 
void output (ostream &out) const
 
void write_header (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)
 
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...
 
void operator= (const TypedObject &copy)
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 Returns the current reference count. More...
 
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 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...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 
- Public Member Functions inherited from Namable
 Namable (const string &initial_name="")
 
 Namable (const Namable &copy)
 
void clear_name ()
 Resets the Namable's name to empty. More...
 
const 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...
 
Namableoperator= (const Namable &other)
 
void output (ostream &out) const
 Outputs the Namable. More...
 
void set_name (const 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
 

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

References add_vertex(), begin(), end(), EggVertex::get_index(), and has_forward_vertices().

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

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

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

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

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

Referenced by MayaToEggConverter::clear(), create_unique_vertex(), EggVertexPool(), SoftToEggConverter::find_morph_table(), get_forward_vertex(), make_new_vertex(), size(), and EggMesherFanMaker::unroll().

◆ begin()

EggVertexPool::iterator EggVertexPool::begin ( ) const

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

References LVecBase4f::almost_equal(), empty(), EggAttributes::get_color(), and has_uvs().

Referenced by has_nonwhite_colors(), and EggLoader::make_polyset().

◆ create_unique_vertex()

EggVertex * EggVertexPool::create_unique_vertex ( const EggVertex copy)

◆ empty()

bool EggVertexPool::empty ( ) const

Returns true if the pool is empty.

Definition at line 447 of file eggVertexPool.cxx.

References size().

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

◆ end()

EggVertexPool::iterator EggVertexPool::end ( ) const

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

References remove_vertex().

Referenced by create_unique_vertex(), and EggGroupNode::rebuild_vertex_pools().

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

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

Referenced by get_uv_names(), and EggLoader::make_polyset().

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

References add_vertex(), and get_highest_index().

Referenced by get_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 177 of file eggVertexPool.cxx.

References set_highest_index().

Referenced by add_vertex(), and get_forward_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 202 of file eggVertexPool.cxx.

References EggVertex::get_num_dimensions(), and has_normals().

Referenced by EggLoader::make_polyset(), set_highest_index(), and EggVertexUV::transform().

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

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

Referenced by has_aux(), and EggLoader::make_polyset().

◆ get_vertex()

EggVertex * EggVertexPool::get_vertex ( int  index) const

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

References get_uv_names(), and EggVertex::has_aux().

Referenced by has_uvs().

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

References has_nonwhite_colors().

Referenced by has_normals().

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

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

Referenced by has_forward_vertices().

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

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

Referenced by EggVertexPool().

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

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

Referenced by has_colors().

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

References has_colors().

Referenced by get_num_dimensions(), and EggLoader::make_polyset().

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

References has_aux(), and EggVertex::has_uv().

Referenced by check_overall_color().

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

References get_vertex(), and operator[]().

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

References add_vertex().

Referenced by make_new_vertex(), and operator[]().

◆ 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 65 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 83 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 101 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 119 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 36 of file eggVertexPool.I.

References get_vertex(), and make_new_vertex().

Referenced by has_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 640 of file eggVertexPool.cxx.

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

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

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

References get_vertex(), and remove_unused_vertices().

Referenced by find_matching_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 191 of file eggVertexPool.cxx.

References get_num_dimensions().

Referenced by SoftToEggConverter::find_morph_table(), and get_highest_index().

◆ size()

EggVertexPool::size_type EggVertexPool::size ( ) const

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

References begin(), end(), size(), and write().

Referenced by EggLoader::make_polyset().

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

References begin(), end(), EggVertex::get_num_global_coord(), EggVertex::get_num_local_coord(), LMatrix4d::get_row3(), LMatrix4d::set_row(), size(), and EggVertex::transform().

Referenced by write().

◆ write()

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

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

Implements EggNode.

Definition at line 857 of file eggVertexPool.cxx.

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

Referenced by sort_by_external_index().


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