EggVertexPool

from panda3d.egg import EggVertexPool
class EggVertexPool

Bases:

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

Inheritance diagram

Inheritance diagram of EggVertexPool

__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)
add_unused_vertices_to_prim(prim: EggPrimitive)

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

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

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

find_matching_vertex(copy: EggVertex) EggVertex

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.

get_aux_names(aux_names: panda3d.core.vector_string)

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

static get_class_type() panda3d.core.TypeHandle
get_forward_vertex(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.

get_highest_index() int

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

get_num_dimensions() int

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

get_uv_names(uv_names: panda3d.core.vector_string, uvw_names: panda3d.core.vector_string, tbn_names: panda3d.core.vector_string)

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.

get_vertex(index: int) EggVertex

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

has_aux() bool

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

has_colors() bool

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

has_defined_vertices() bool

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

has_forward_vertices() bool

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

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

has_normals() bool

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

has_uvs() bool

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

has_vertex(index: int) bool

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

make_new_vertex() EggVertex

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

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

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

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

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

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

remove_vertex(vertex: EggVertex)

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

set_highest_index(highest_index: int)

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.

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.

transform(mat: panda3d.core.LMatrix4d)

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.