14#ifndef EGGVERTEXPOOL_H
15#define EGGVERTEXPOOL_H
41class EXPCL_PANDA_EGG EggVertexPool :
public EggNode {
51 typedef pmap<int, PT_EggVertex> IndexVertices;
62 typedef iterator const_iterator;
63 typedef IndexVertices::size_type size_type;
68 explicit EggVertexPool(
const std::string &name);
69 EggVertexPool(
const EggVertexPool ©);
79 INLINE EggVertex *operator [](
int index)
const;
95 void get_uv_names(vector_string &uv_names, vector_string &uvw_names,
96 vector_string &tbn_names)
const;
101 iterator
begin()
const;
102 iterator
end()
const;
106 size_type
size()
const;
110 EggVertex *
add_vertex(EggVertex *vertex,
int index = -1);
132 void write(std::ostream &out,
int indent_level)
const;
135 virtual void r_transform(
const LMatrix4d &mat,
const LMatrix4d &inv,
136 CoordinateSystem to_cs);
137 virtual void r_transform_vertices(
const LMatrix4d &mat);
140 UniqueVertices _unique_vertices;
141 IndexVertices _index_vertices;
150 static void init_type() {
151 EggNode::init_type();
153 EggNode::get_class_type());
156 return get_class_type();
158 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
163friend class EggVertex;
void transform(const LMatrix4d &mat)
Applies the indicated transformation to the node and all of its descendants.
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
A collection of vertices.
bool has_colors() const
Returns true if any vertex in the pool has a color defined, false if none of them do.
void remove_vertex(EggVertex *vertex)
Removes the vertex from the pool.
bool has_normals() const
Returns true if any vertex in the pool has a normal defined, false if none of them do.
int remove_unused_vertices()
Removes all vertices from the pool that are not referenced by at least one primitive.
int get_highest_index() const
Returns the highest index number used by any vertex in the pool (except forward references).
EggVertex * find_matching_vertex(const EggVertex ©)
If the EggVertexPool already has a vertex matching the indicated vertex, returns it; otherwise,...
bool has_defined_vertices() const
Returns true if any vertices in the pool are fully defined vertices, false if all vertices are forwar...
void sort_by_external_index()
Re-orders (and re-numbers) the vertices in this vertex pool so that they appear in increasing order b...
bool has_aux() const
Returns true if any vertex in the pool has auxiliary data defined, false if none of them do.
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.
size_type size() const
Returns the number of vertices in the pool.
bool has_nonwhite_colors() const
Returns true if any vertex in the pool has a color defined other than white, false if no vertices hav...
bool has_uvs() const
Returns true if any vertex in the pool has a uv defined, false if none of them do.
iterator end() 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.
bool has_vertex(int index) const
Returns true if the indicated vertex has been defined in the vertex pool, false otherwise.
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.
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 U...
EggVertex * get_vertex(int index) const
Returns the vertex in the pool with the indicated index number, or NULL if no vertices have that inde...
int get_num_dimensions() const
Returns the maximum number of dimensions used by any vertex in the pool.
iterator begin() const
Returns an iterator that can be used to traverse through all the vertices in the pool.
EggVertex * make_new_vertex()
Allocates and returns a new 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 nu...
EggVertex * add_vertex(EggVertex *vertex, int index=-1)
Adds the indicated vertex to the pool.
EggVertex * create_unique_vertex(const EggVertex ©)
Creates a new vertex in the pool that is a copy of the indicated one and returns it.
bool has_forward_vertices() const
Returns true if any vertices in the pool are undefined forward-reference vertices,...
bool empty() const
Returns true if the pool is empty.
EggVertex * get_forward_vertex(int index)
Returns the vertex in the pool with the indicated index number.
void write(std::ostream &out, int indent_level) const
Writes the vertex pool to the indicated output stream in Egg format.
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL multiset.
This is an iterator adaptor that converts any iterator that returns a pair (e.g.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...