# EggVertexPool¶

from panda3d.egg import EggVertexPool

class EggVertexPool

Bases: EggNode

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 addVertex() and removeVertex() are provided to manipulate the list. The list may also be operated on (read-only) via iterators and begin()/end().

Inheritance diagram

__getitem__(index: int)EggVertex

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

__init__(copy: EggVertexPool)

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.

__init__(name: str)
addUnusedVerticesToPrim(prim: EggPrimitive)None

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

addVertex(vertex: EggVertex, index: int)EggVertex

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.

createUniqueVertex(copy: EggVertex)EggVertex

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.

findMatchingVertex(copy: EggVertex)EggVertex

If the EggVertexPool already has a vertex matching the indicated vertex, returns it; otherwise, returns NULL. This is similar to createUniqueVertex() except that a new vertex is never created.

getAuxNames(aux_names: panda3d.core.vector_string)None

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

static getClassType()panda3d.core.TypeHandle
getForwardVertex(index: int)EggVertex

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.

getHighestIndex()int

Returns the highest index number used by any vertex in the pool (except forward references). Returns -1 if the pool is empty.

getNumDimensions()int

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

getUvNames(uv_names: panda3d.core.vector_string, uvw_names: panda3d.core.vector_string, tbn_names: panda3d.core.vector_string)None

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.

getVertex(index: int)EggVertex

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

hasAux()bool

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

hasColors()bool

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

hasDefinedVertices()bool

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

hasForwardVertices()bool

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

hasNonwhiteColors()bool

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.

hasNormals()bool

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

hasUvs()bool

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

hasVertex(index: int)bool

Returns true if the indicated vertex has been defined in the vertex pool, false otherwise. This does not include forward references.

makeNewVertex()EggVertex

Allocates and returns a new vertex from the pool. This is one of three ways to add new vertices to a vertex pool.

makeNewVertex(pos: panda3d.core.LPoint2d)EggVertex

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 makeNewVertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

makeNewVertex(pos: panda3d.core.LPoint3d)EggVertex

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 makeNewVertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

makeNewVertex(pos: panda3d.core.LPoint4d)EggVertex

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 makeNewVertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

makeNewVertex(pos: float)EggVertex

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 makeNewVertex() explicitly sets the vertex position as it is allocated. It does not attempt to share vertices.

removeUnusedVertices()int

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(vertex: EggVertex)None

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

setHighestIndex(highest_index: int)None

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.

size()int

Returns the number of vertices in the pool.

sortByExternalIndex()None

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(mat: panda3d.core.LMatrix4d)None

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.