Panda3D
Loading...
Searching...
No Matches
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 */
21set_name(const char *name) {
22
23 _name = name ? name : "";
24 ptr()->name = _name.c_str();
25}
26
27/**
28 *
29 */
30void PhysxForceFieldShapeDesc::
31set_pos(const LPoint3f &pos) {
32
33 nassertv(!pos.is_nan());
34 ptr()->pose.t = PhysxManager::point3_to_nxVec3(pos);
35}
36
37/**
38 *
39 */
40void PhysxForceFieldShapeDesc::
41set_mat(const LMatrix4f &mat) {
42
43 nassertv(!mat.is_nan());
44 ptr()->pose = PhysxManager::mat4_to_nxMat34(mat);
45}
46
47/**
48 *
49 */
50void PhysxForceFieldShapeDesc::
51set_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 */
66const char *PhysxForceFieldShapeDesc::
67get_name() const {
68
69 return ptr()->name;
70}
71
72/**
73 *
74 */
75LPoint3f PhysxForceFieldShapeDesc::
76get_pos() const {
77
78 return PhysxManager::nxVec3_to_point3(ptr()->pose.t);
79}
80
81/**
82 *
83 */
84LMatrix4f PhysxForceFieldShapeDesc::
85get_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.
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 NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.