36 _points =
new NxVec3[numVertices];
38 _desc.numVertices = numVertices;
39 _desc.points = _points;
46 _texcoords =
new LPoint2f[numVertices];
54set_vertex(
unsigned int idx,
const LPoint3f &vert,
const LPoint2f &texcoord) {
56 nassertv(_desc.numVertices > idx);
59 _texcoords[idx] = texcoord;
70 if (_desc.triangles) {
74 _triangles =
new NxU32[3 * numTriangles];
76 _desc.numTriangles = numTriangles;
77 _desc.triangles = _triangles;
85 unsigned int i1,
unsigned int i2,
unsigned int i3) {
87 nassertv(_desc.numTriangles > idx);
91 _triangles[idx + 1] = i2;
92 _triangles[idx + 2] = i3;
117 CPT(
Geom) geom = gnode->get_geom(j);
134 for (
int k=0; k<geom->get_num_primitives(); k++) {
137 prim = prim->decompose();
139 for (
int l=0; l<prim->get_num_primitives(); l++) {
141 int s = prim->get_primitive_start(l);
142 int e = prim->get_primitive_end(l);
144 for (
int l=s; l<e; l++) {
145 dataIndices.push_back(prim->get_vertex(l));
155 NxU32 numVertices = dataVertices.size();
156 NxU32 numTriangles = dataIndices.size() / 3;
158 _points =
new NxVec3[numVertices];
159 _triangles =
new NxU32[3 * numTriangles];
160 _texcoords =
new LPoint2f[numVertices];
164 for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) {
173 for (tcit=dataTexcoords.begin(); tcit!=dataTexcoords.end(); tcit++) {
182 for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) {
189 _desc.numVertices = numVertices;
190 _desc.points = _points;
191 _desc.numTriangles = numTriangles;
192 _desc.triangles = _triangles;
A node that holds Geom objects, renderable pieces of geometry.
get_num_geoms
Returns the number of geoms in the node.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
bool is_at_end() const
Returns true if the reader is currently at the end of the list of vertices, false otherwise.
const LVecBase3f & get_data3f()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
const LVecBase2f & get_data2f()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
A container for geometry primitives.
This is a set of zero or more NodePaths.
get_num_paths
Returns the number of NodePaths in the collection.
get_path
Returns the nth NodePath in the collection.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
NodePathCollection find_all_matches(const std::string &path) const
Returns the complete set of all NodePaths that begin with this NodePath and can be extended by path.
PandaNode * node() const
Returns the referenced node of the path.
void set_vertex(unsigned int idx, const LPoint3f &vert, const LPoint2f &texcoord)
Sets a single vertex.
void set_num_triangles(unsigned int n)
Sets the number of triangles to be stored in this triangle mesh.
void set_triangle(unsigned int idx, unsigned int i1, unsigned int i2, unsigned int i3)
Sets a single triangle, by providing the three indices i1, i2, i3.
void set_num_vertices(unsigned int n)
Sets the number of vertices to be stored within this triangle mesh.
void set_from_node_path(const NodePath &np)
A convenience method to set the mesh data from a NodePath in a single call.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
This is our own Panda specialization on the default STL vector.
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.