Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# EggVertexPool Class Reference

A collection of vertices. More...

Inheritance diagram for EggVertexPool:

List of all members.

## Public Member Functions
| EggVertexPool (EggVertexPool const 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 (string name)
| addUnusedVerticesToPrim (EggPrimitive prim)
| Adds all of the unused vertices in this vertex pool to the indicated primitive, in ascending order.
EggVertex | addVertex (EggVertex vertex, int index)
| Adds the indicated vertex to the pool.
EggVertex | addVertex (EggVertex vertex)
| Adds the indicated vertex to the pool.
EggVertex | createUniqueVertex (EggVertex const copy)
| Creates a new vertex in the pool that is a copy of the indicated one and returns it.
EggVertex | findMatchingVertex (EggVertex const copy)
| If the EggVertexPool already has a vertex matching the indicated vertex, returns it; otherwise, returns NULL.
| getAuxNames (vectorbasic_stringchar aux_names)
| Returns the list of auxiliary data names that are defined by any vertices in the pool.
EggVertex | getForwardVertex (int index)
| Returns the vertex in the pool with the indicated index number.
int | getHighestIndex ()
| Returns the highest index number used by any vertex in the pool (except forward references).
int | getNumDimensions ()
| Returns the maximum number of dimensions used by any vertex in the pool.
| getUvNames (vectorbasic_stringchar uv_names, vectorbasic_stringchar uvw_names, vectorbasic_stringchar tbn_names)
| 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 | getVertex (int index)
| Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number.
bool | hasAux ()
| Returns true if any vertex in the pool has auxiliary data defined, false if none of them do.
bool | hasColors ()
| Returns true if any vertex in the pool has a color defined, false if none of them do.
bool | hasDefinedVertices ()
| Returns true if any vertices in the pool are fully defined vertices, false if all vertices are forward references.
bool | hasForwardVertices ()
| Returns true if any vertices in the pool are undefined forward-reference vertices, false if all vertices are defined.
bool | hasNonwhiteColors ()
| 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 | hasNormals ()
| Returns true if any vertex in the pool has a normal defined, false if none of them do.
bool | hasUvs ()
| Returns true if any vertex in the pool has a uv defined, false if none of them do.
bool | hasVertex (int index)
| Returns true if the indicated vertex has been defined in the vertex pool, false otherwise.
EggVertex | makeNewVertex (Point2D const pos)
| Allocates and returns a new vertex from the pool.
EggVertex | makeNewVertex (Point3D const pos)
| Allocates and returns a new vertex from the pool.
EggVertex | makeNewVertex (double pos)
| Allocates and returns a new vertex from the pool.
EggVertex | makeNewVertex (Point4D const pos)
| Allocates and returns a new vertex from the pool.
EggVertex | makeNewVertex ()
| Allocates and returns a new vertex from the pool.
EggVertex | operator[] (int index)
| Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that index number.
int | removeUnusedVertices ()
| Removes all vertices from the pool that are not referenced by at least one primitive.
| removeVertex (EggVertex vertex)
| Removes the vertex from the pool.
| setHighestIndex (int highest_index)
| Artificially changes the "highest index number", so that a newly created vertex will begin at this number plus 1.
unsigned int | size ()
| Returns the number of vertices in the pool.
| sortByExternalIndex ()
| 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.
| transform (Mat4D const mat)
| Applies the indicated transformation matrix to all the vertices.
## Static Public Member Functions
static TypeHandle | getClassType ()

## 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().

## Constructor & Destructor Documentation

EggVertexPool | ( | EggVertexPool const | 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.

EggVertexPool | ( | string | name | ) |

## Member Function Documentation

addUnusedVerticesToPrim | ( | EggPrimitive | prim | ) |

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

EggVertex addVertex | ( | EggVertex | vertex | ) |

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.

EggVertex addVertex | ( | EggVertex | vertex,
|  | int | index
| ) |  |

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.

EggVertex createUniqueVertex | ( | EggVertex const | 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.

EggVertex findMatchingVertex | ( | EggVertex const | 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.

getAuxNames | ( | vectorbasic_stringchar | aux_names | ) |

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

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented from EggNode.

EggVertex getForwardVertex | ( | 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.

int getHighestIndex | ( |  | ) |

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

Returns -1 if the pool is empty.

int getNumDimensions | ( |  | ) |

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

getUvNames | ( | vectorbasic_stringchar | uv_names,
|  | vectorbasic_stringchar | uvw_names,
|  | vectorbasic_stringchar | tbn_names
| ) |  |

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.

EggVertex getVertex | ( | int | index | ) |

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

bool hasAux | ( |  | ) |

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

bool hasColors | ( |  | ) |

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

bool hasDefinedVertices | ( |  | ) |

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

bool hasForwardVertices | ( |  | ) |

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

bool hasNonwhiteColors | ( |  | ) |

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 hasNormals | ( |  | ) |

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

bool hasUvs | ( |  | ) |

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

bool hasVertex | ( | int | index | ) |

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

This does not include forward references.

EggVertex makeNewVertex | ( | Point4D const | pos | ) |

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.

EggVertex makeNewVertex | ( |  | ) |

Allocates and returns a new vertex from the pool.

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

EggVertex makeNewVertex | ( | double | pos | ) |

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.

EggVertex makeNewVertex | ( | Point2D const | pos | ) |

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.

EggVertex makeNewVertex | ( | Point3D const | pos | ) |

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.

EggVertex operator[] | ( | int | index | ) |

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

int removeUnusedVertices | ( |  | ) |

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.

removeVertex | ( | EggVertex | vertex | ) |

Removes the vertex from the pool.

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

setHighestIndex | ( | 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.

unsigned int size | ( |  | ) |

Returns the number of vertices in the pool.

sortByExternalIndex | ( |  | ) |

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.

transform | ( | Mat4D const | 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.

Reimplemented from EggNode.

All Classes Namespaces Functions Variables Enumerations Enumerator Properties