Panda3D
Loading...
Searching...
No Matches
physxManager.I
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 physxManager.I
10 * @author enn0x
11 * @date 2009-09-01
12 */
13
14/**
15 * Returns a pointer to the NxPhysicsSDK.
16 */
17INLINE NxPhysicsSDK *PhysxManager::
18get_sdk() const {
19
20 return _sdk;
21}
22
23/**
24 * Converts from LVector3f to NxVec3.
25 */
26INLINE NxVec3 PhysxManager::
27vec3_to_nxVec3(const LVector3f &v) {
28
29 return NxVec3(v.get_x(), v.get_y(), v.get_z());
30}
31
32/**
33 * Converts from NxVec3 to LVector3f.
34 */
35INLINE LVector3f PhysxManager::
36nxVec3_to_vec3(const NxVec3 &v) {
37
38 return LVector3f(v.x, v.y, v.z);
39}
40
41/**
42 * Converts from LVector3f to NxExtendedVec3.
43 */
44INLINE NxExtendedVec3 PhysxManager::
45vec3_to_nxExtVec3(const LVector3f &v) {
46
47 return NxExtendedVec3(v.get_x(), v.get_y(), v.get_z());
48}
49
50/**
51 * Converts from NxExtendedVec3 to LVector3f.
52 */
53INLINE LVector3f PhysxManager::
54nxExtVec3_to_vec3(const NxExtendedVec3 &v) {
55
56 return LVector3f(v.x, v.y, v.z);
57}
58
59/**
60 * Converts from LPoint3f to NxVec3.
61 */
62INLINE NxVec3 PhysxManager::
63point3_to_nxVec3(const LPoint3f &p) {
64
65 return NxVec3(p.get_x(), p.get_y(), p.get_z());
66}
67
68/**
69 * Converts from NxVec3 to LPoint3f.
70 */
71INLINE LPoint3f PhysxManager::
72nxVec3_to_point3(const NxVec3 &p) {
73
74 return LPoint3f(p.x, p.y, p.z);
75}
76
77/**
78 * Converts from LPoint3f to NxExtendedVec3.
79 */
80INLINE NxExtendedVec3 PhysxManager::
81point3_to_nxExtVec3(const LPoint3f &p) {
82
83 return NxExtendedVec3(p.get_x(), p.get_y(), p.get_z());
84}
85
86/**
87 * Converts from NxExtendedVec3 to LPoint3f.
88 */
89INLINE LPoint3f PhysxManager::
90nxExtVec3_to_point3(const NxExtendedVec3 &p) {
91
92 return LPoint3f(p.x, p.y, p.z);
93}
94
95/**
96 * Converts from LQuaternionf to NxQuat.
97 */
98INLINE NxQuat PhysxManager::
99quat_to_nxQuat(const LQuaternionf &q) {
100
101 NxQuat nxq;
102 nxq.setXYZW(q.get_i(), q.get_j(), q.get_k(), q.get_r());
103 return nxq;
104}
105
106/**
107 * Converts from NxQuat to LQuaternionf.
108 */
109INLINE LQuaternionf PhysxManager::
110nxQuat_to_quat(const NxQuat &q) {
111
112 return LQuaternionf(q.w, q.x, q.y, q.z);
113}
114
115/**
116 * Converts from LMatrix4f to NxMat34.
117 */
118INLINE NxMat34 PhysxManager::
119mat4_to_nxMat34(const LMatrix4f &m) {
120
121 NxMat33 mat = mat3_to_nxMat33(m.get_upper_3());
122 NxVec3 v = vec3_to_nxVec3(m.get_row3(3));
123 return NxMat34(mat, v);
124}
125
126/**
127 * Converts from NxMat34 to LMatrix4f.
128 */
129INLINE LMatrix4f PhysxManager::
130nxMat34_to_mat4(const NxMat34 &m) {
131
132 return LMatrix4f(nxMat33_to_mat3(m.M), nxVec3_to_vec3(m.t));
133}
134
135/**
136 * Converts from LMatrix3f to NxMat33.
137 */
138INLINE NxMat33 PhysxManager::
139mat3_to_nxMat33(const LMatrix3f &m) {
140
141 NxMat33 mat;
142 mat.setColumnMajor(m.get_data());
143 return mat;
144}
145
146/**
147 * Converts from NxMat33 to LMatrix3f.
148 */
149INLINE LMatrix3f PhysxManager::
150nxMat33_to_mat3(const NxMat33 &m) {
151
152 float cells[9];
153 m.getColumnMajor(cells);
154 return LMatrix3f(cells[0], cells[1], cells[2],
155 cells[3], cells[4], cells[5],
156 cells[6], cells[7], cells[8]);
157}
158
159/**
160 *
161 */
162INLINE void PhysxManager::
163update_vec3_from_nxVec3(LVector3f &v, const NxVec3 &nVec) {
164
165 v.set_x(nVec.x);
166 v.set_y(nVec.y);
167 v.set_z(nVec.z);
168}
169
170/**
171 *
172 */
173INLINE void PhysxManager::
174update_point3_from_nxVec3(LPoint3f &p, const NxVec3 &nVec) {
175
176 p.set_x(nVec.x);
177 p.set_y(nVec.y);
178 p.set_z(nVec.z);
179}
180
181
182/**
183 *
184 */
185INLINE void PhysxManager::
186ls() const {
187
188 ls(nout);
189}
190
191/**
192 *
193 */
194INLINE void PhysxManager::
195ls(std::ostream &out, int indent_level) const {
196
197 indent(out, indent_level) << "PhysxManager\n";
198
199 _scenes.ls(out, indent_level);
200 _heightfields.ls(out, indent_level);
201 _convex_meshes.ls(out, indent_level);
202 _triangle_meshes.ls(out, indent_level);
203}
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
static LMatrix3f nxMat33_to_mat3(const NxMat33 &m)
Converts from NxMat33 to LMatrix3f.
static NxExtendedVec3 point3_to_nxExtVec3(const LPoint3f &p)
Converts from LPoint3f to NxExtendedVec3.
NxPhysicsSDK * get_sdk() const
Returns a pointer to the NxPhysicsSDK.
static LVector3f nxExtVec3_to_vec3(const NxExtendedVec3 &v)
Converts from NxExtendedVec3 to LVector3f.
static NxQuat quat_to_nxQuat(const LQuaternionf &q)
Converts from LQuaternionf to NxQuat.
static LPoint3f nxExtVec3_to_point3(const NxExtendedVec3 &p)
Converts from NxExtendedVec3 to LPoint3f.
static LQuaternionf nxQuat_to_quat(const NxQuat &q)
Converts from NxQuat to LQuaternionf.
static NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
static NxExtendedVec3 vec3_to_nxExtVec3(const LVector3f &v)
Converts from LVector3f to NxExtendedVec3.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20