Panda3D
physxForceFieldShapeDesc.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxForceFieldShapeDesc.cxx
10  * @author enn0x
11  * @date 2009-11-06
12  */
13 
15 #include "physxManager.h"
16 
17 /**
18  * Sets a possible debug name.
19  */
21 set_name(const char *name) {
22 
23  _name = name ? name : "";
24  ptr()->name = _name.c_str();
25 }
26 
27 /**
28  *
29  */
30 void PhysxForceFieldShapeDesc::
31 set_pos(const LPoint3f &pos) {
32 
33  nassertv(!pos.is_nan());
34  ptr()->pose.t = PhysxManager::point3_to_nxVec3(pos);
35 }
36 
37 /**
38  *
39  */
40 void PhysxForceFieldShapeDesc::
41 set_mat(const LMatrix4f &mat) {
42 
43  nassertv(!mat.is_nan());
44  ptr()->pose = PhysxManager::mat4_to_nxMat34(mat);
45 }
46 
47 /**
48  *
49  */
50 void PhysxForceFieldShapeDesc::
51 set_hpr(float h, float p, float r) {
52 
53  LQuaternionf q;
54  LMatrix3f rot;
55  NxMat34 m;
56 
57  q.set_hpr(LVector3f(h, p, r));
58  q.extract_to_matrix(rot);
59 
60  ptr()->pose.M = PhysxManager::mat3_to_nxMat33(rot);
61 }
62 
63 /**
64  *
65  */
66 const char *PhysxForceFieldShapeDesc::
67 get_name() const {
68 
69  return ptr()->name;
70 }
71 
72 /**
73  *
74  */
75 LPoint3f PhysxForceFieldShapeDesc::
76 get_pos() const {
77 
78  return PhysxManager::nxVec3_to_point3(ptr()->pose.t);
79 }
80 
81 /**
82  *
83  */
84 LMatrix4f PhysxForceFieldShapeDesc::
85 get_mat() const {
86 
87  return PhysxManager::nxMat34_to_mat4(ptr()->pose);
88 }
void set_name(const char *name)
Sets a possible debug name.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
Definition: physxManager.I:63
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
Definition: physxManager.I:119
static NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
Definition: physxManager.I:139
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
Definition: physxManager.I:72
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
Definition: physxManager.I:130