15 #include "physxSoftBodyDesc.h"
16 #include "physxSoftBodyMesh.h"
17 #include "physxManager.h"
24 void PhysxSoftBodyDesc::
25 set_name(
const char *name) {
27 _name = name ? name :
"";
28 _desc.name = _name.c_str();
36 void PhysxSoftBodyDesc::
37 set_global_pos(
const LPoint3f &pos) {
47 void PhysxSoftBodyDesc::
58 void PhysxSoftBodyDesc::
59 set_global_hpr(
float h,
float p,
float r) {
76 void PhysxSoftBodyDesc::
77 set_particle_radius(
float radius) {
79 _desc.particleRadius = radius;
87 void PhysxSoftBodyDesc::
88 set_relative_grid_spacing(
float spacing) {
90 _desc.relativeGridSpacing = spacing;
98 void PhysxSoftBodyDesc::
99 set_collision_response_coefficient(
float coef) {
101 _desc.collisionResponseCoefficient = coef;
109 void PhysxSoftBodyDesc::
110 set_attachment_response_coefficient(
float coef) {
112 _desc.attachmentResponseCoefficient = coef;
120 void PhysxSoftBodyDesc::
121 set_density(
float density) {
123 _desc.density = density;
131 void PhysxSoftBodyDesc::
132 set_volume_stiffness(
float stiffness) {
134 _desc.volumeStiffness = stiffness;
142 void PhysxSoftBodyDesc::
143 set_stretching_stiffness(
float stiffness) {
145 _desc.stretchingStiffness = stiffness;
153 void PhysxSoftBodyDesc::
154 set_damping_coefficient(
float damping) {
156 _desc.dampingCoefficient = damping;
164 void PhysxSoftBodyDesc::
165 set_friction(
float friction) {
167 _desc.friction = friction;
175 void PhysxSoftBodyDesc::
176 set_tear_factor(
float tearFactor) {
178 _desc.tearFactor = tearFactor;
193 _desc.flags &= ~(flag);
207 _desc.solverIterations = iterations;
215 void PhysxSoftBodyDesc::
218 _desc.softBodyMesh = mesh->ptr();
226 const char *PhysxSoftBodyDesc::
238 get_global_pos()
const {
249 get_global_mat()
const {
259 float PhysxSoftBodyDesc::
260 get_particle_radius()
const {
262 return _desc.particleRadius;
270 float PhysxSoftBodyDesc::
271 get_relative_grid_spacing()
const {
273 return _desc.relativeGridSpacing;
281 float PhysxSoftBodyDesc::
282 get_collision_response_coefficient()
const {
284 return _desc.collisionResponseCoefficient;
292 float PhysxSoftBodyDesc::
293 get_attachment_response_coefficient()
const {
295 return _desc.attachmentResponseCoefficient;
303 float PhysxSoftBodyDesc::
304 get_density()
const {
306 return _desc.density;
314 float PhysxSoftBodyDesc::
315 get_volume_stiffness()
const {
317 return _desc.volumeStiffness;
325 float PhysxSoftBodyDesc::
326 get_stretching_stiffness()
const {
328 return _desc.stretchingStiffness;
336 float PhysxSoftBodyDesc::
337 get_damping_coefficient()
const {
339 return _desc.dampingCoefficient;
347 float PhysxSoftBodyDesc::
348 get_friction()
const {
350 return _desc.friction;
358 float PhysxSoftBodyDesc::
359 get_tear_factor()
const {
361 return _desc.tearFactor;
369 bool PhysxSoftBodyDesc::
370 get_flag(PhysxSoftBodyFlag flag)
const {
372 return (_desc.flags & flag) ?
true :
false;
380 unsigned int PhysxSoftBodyDesc::
381 get_solver_iterations()
const {
383 return _desc.solverIterations;
388 // Function: PhysxSoftBodyDesc::get_mesh_numbers
390 // Description: Used by PhysScene to query the sizes of arrays
391 // to allocate for the user buffers in PhysxSoftBodyNode.
393 void PhysxSoftBodyDesc::
394 get_mesh_numbers(NxU32 &numVertices, NxU32 &numTriangles) {
396 NxSoftBodyMeshDesc meshDesc;
397 _desc.clothMesh->saveToDesc(meshDesc);
399 numVertices = meshDesc.numVertices;
400 numTriangles = meshDesc.numTriangles;
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
void extract_to_matrix(LMatrix3f &m) const
Based on the quat lib from VRPN.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
This is a 4-by-4 transform matrix.
static NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
void set_flag(PhysxSoftBodyFlag flag, bool value)
Raise or lower individual SoftBodyFlag flags.
void set_hpr(const LVecBase3f &hpr, CoordinateSystem cs=CS_default)
Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
This is the base quaternion class.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
void set_solver_iterations(unsigned int interations)
Number of solver iterations.
This is a 3-by-3 transform matrix.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.