35 _vertices =
new NxVec3[numVertices];
37 _desc.numVertices = numVertices;
38 _desc.points = _vertices;
48 nassertv(_desc.numVertices > idx);
60 if (_desc.triangles) {
64 if (_desc.materialIndices) {
68 _triangles =
new NxU32[3 * numTriangles];
70 _desc.numTriangles = numTriangles;
71 _desc.triangles = _triangles;
73 if (use_material_indices ==
true) {
74 _materials =
new NxMaterialIndex[numTriangles];
75 _desc.materialIndices = _materials;
84 unsigned int i1,
unsigned int i2,
unsigned int i3,
85 unsigned int material_index) {
87 nassertv(_desc.numTriangles > idx);
89 if (_desc.materialIndices) {
90 _materials[idx] = (NxMaterialIndex) material_index;
95 _triangles[idx + 1] = i2;
96 _triangles[idx + 2] = i3;
102 const NxTriangleMeshDesc &PhysxTriangleMeshDesc::
129 CPT(
Geom) geom = gnode->get_geom(j);
140 for (
int k=0; k<geom->get_num_primitives(); k++) {
143 prim = prim->decompose();
145 for (
int l=0; l<prim->get_num_primitives(); l++) {
147 int s = prim->get_primitive_start(l);
148 int e = prim->get_primitive_end(l);
150 for (
int l=s; l<e; l++) {
151 dataIndices.push_back(prim->get_vertex(l));
161 NxU32 numVertices = dataVertices.size();
162 NxU32 numTriangles = dataIndices.size() / 3;
164 _vertices =
new NxVec3[numVertices];
165 _triangles =
new NxU32[3 * numTriangles];
169 for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) {
172 _vertices[i].x = v.get_x();
173 _vertices[i].y = v.get_y();
174 _vertices[i].z = v.get_z();
180 for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) {
187 _desc.numVertices = numVertices;
188 _desc.points = _vertices;
189 _desc.numTriangles = numTriangles;
190 _desc.triangles = _triangles;
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
void set_num_vertices(unsigned int n)
Sets the number of vertices to be stored within this triangle mesh.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
const LVecBase3f & get_data3f()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_path
Returns the nth NodePath in the collection.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for geometry primitives.
void set_vertex(unsigned int idx, const LPoint3f &vert)
Sets a single vertex.
void set_num_triangles(unsigned int n, bool use_material_indices=false)
Sets the number of triangles to be stored in this triangle mesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaNode * node() const
Returns the referenced node of the path.
get_num_geoms
Returns the number of geoms in the node.
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.
void set_triangle(unsigned int idx, unsigned int i1, unsigned int i2, unsigned int i3, unsigned int material_index=1)
Sets a single triangle, by providing the three indices i1, i2, i3.
get_num_paths
Returns the number of NodePaths in the collection.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A node that holds Geom objects, renderable pieces of geometry.
void set_from_node_path(const NodePath &np)
A convenience method to set the mesh data from a NodePath in a single call.
This is a set of zero or more NodePaths.