15 #include "physxDebugGeomNode.h"
17 #include "geomVertexFormat.h"
18 #include "geomVertexWriter.h"
27 void PhysxDebugGeomNode::
28 update(NxScene *scenePtr) {
34 const NxDebugRenderable *renderable = scenePtr->getDebugRenderable();
37 physx_cat.warning() <<
"Could no get debug renderable." << endl;
46 _prim_lines->clear_vertices();
47 _prim_triangles->clear_vertices();
51 NxU32 n = renderable->getNbLines();
52 const NxDebugLine *lines = renderable->getLines();
54 for (NxU32 i=0; i<n; i++)
56 NxF32 b = NxF32((lines[i].
color)&0xff) / 255.0f;
57 NxF32 g = NxF32((lines[i].
color>>8)&0xff) / 255.0f;
58 NxF32 r = NxF32((lines[i].
color>>16)&0xff) / 255.0f;
60 NxVec3 p0 = lines[i].p0;
61 NxVec3 p1 = lines[i].p1;
65 _prim_lines->add_vertex(v++);
69 _prim_lines->add_vertex(v++);
76 NxU32 n = renderable->getNbTriangles();
77 const NxDebugTriangle *triangles = renderable->getTriangles();
79 for (NxU32 i=0; i<n; i++)
81 NxF32 b = NxF32((triangles[i].
color)&0xff) / 255.0f;
82 NxF32 g = NxF32((triangles[i].
color>>8)&0xff) / 255.0f;
83 NxF32 r = NxF32((triangles[i].
color>>16)&0xff) / 255.0f;
85 NxVec3 p0 = triangles[i].p0;
86 NxVec3 p1 = triangles[i].p1;
87 NxVec3 p2 = triangles[i].p2;
91 _prim_triangles->add_vertex(v++);
95 _prim_triangles->add_vertex(v++);
99 _prim_triangles->add_vertex(v++);
103 _prim_lines->close_primitive();
104 _prim_triangles->close_primitive();
106 physx_cat.spam() <<
"Updated PhysxDebugGeomNode geometry\n";
114 void PhysxDebugGeomNode::
117 NxGetPhysicsSDK()->setParameter(NX_VISUALIZATION_SCALE, _scale);
125 void PhysxDebugGeomNode::
128 NxGetPhysicsSDK()->setParameter(NX_VISUALIZATION_SCALE, 0.0f);
136 void PhysxDebugGeomNode::
139 if (NxGetPhysicsSDK()->getParameter(NX_VISUALIZATION_SCALE) == 0.0f) {
void add_data4f(float x, float y, float z, float w)
Sets the write row to a particular 4-component value, and advances the write row. ...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void add_data3f(float x, float y, float z)
Sets the write row to a particular 3-component value, and advances the write row. ...
TypeHandle is the identifier used to differentiate C++ class types.
int get_num_parents(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of parent nodes this node has.
void remove_all_geoms()
Removes all the geoms from the node at once.