Panda3D
Loading...
Searching...
No Matches
physxForceFieldDesc.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 physxForceFieldDesc.cxx
10 * @author enn0x
11 * @date 2009-11-06
12 */
13
14#include "physxForceFieldDesc.h"
17#include "physxManager.h"
18#include "physxActor.h"
19
20/**
21 *
22 */
23void PhysxForceFieldDesc::
24set_name(const char *name) {
25
26 _name = name ? name : "";
27 _desc.name = _name.c_str();
28}
29
30/**
31 *
32 */
33void PhysxForceFieldDesc::
34set_pos(const LPoint3f &pos) {
35
36 _desc.pose.t = PhysxManager::point3_to_nxVec3(pos);
37}
38
39/**
40 *
41 */
42void PhysxForceFieldDesc::
43set_mat(const LMatrix4f &mat) {
44
45 _desc.pose = PhysxManager::mat4_to_nxMat34(mat);
46}
47
48/**
49 *
50 */
51void PhysxForceFieldDesc::
52set_hpr(float h, float p, float r) {
53
54 LQuaternionf q;
55 LMatrix3f rot;
56 NxMat34 m;
57
58 q.set_hpr(LVector3f(h, p, r));
59 q.extract_to_matrix(rot);
60
61 _desc.pose.M = PhysxManager::mat3_to_nxMat33(rot);
62}
63
64/**
65 *
66 */
67void PhysxForceFieldDesc::
68set_kernel_constant(const LVector3f &constant) {
69
70 _kernel.constant = PhysxManager::vec3_to_nxVec3(constant);
71}
72
73/**
74 *
75 */
76void PhysxForceFieldDesc::
77set_kernel_position_target(const LPoint3f &target) {
78
79 _kernel.positionTarget = PhysxManager::point3_to_nxVec3(target);
80}
81
82/**
83 *
84 */
85void PhysxForceFieldDesc::
86set_kernel_velocity_target(const LVector3f &target) {
87
88 _kernel.velocityTarget = PhysxManager::vec3_to_nxVec3(target);
89}
90
91/**
92 *
93 */
94void PhysxForceFieldDesc::
95set_kernel_torus_radius(float radius) {
96
97 _kernel.torusRadius = radius;
98}
99
100/**
101 *
102 */
103void PhysxForceFieldDesc::
104set_kernel_falloff_linear(const LVector3f &falloff) {
105
106 _kernel.falloffLinear = PhysxManager::vec3_to_nxVec3(falloff);
107}
108
109/**
110 *
111 */
112void PhysxForceFieldDesc::
113set_kernel_falloff_quadratic(const LVector3f &falloff) {
114
115 _kernel.falloffQuadratic = PhysxManager::vec3_to_nxVec3(falloff);
116}
117
118/**
119 *
120 */
121void PhysxForceFieldDesc::
122set_kernel_noise(const LVector3f &noise) {
123
124 _kernel.noise = PhysxManager::vec3_to_nxVec3(noise);
125}
126
127/**
128 *
129 */
130void PhysxForceFieldDesc::
131set_kernel_position_multiplier(const LMatrix3f &multiplier) {
132
133 _kernel.positionMultiplier = PhysxManager::mat3_to_nxMat33(multiplier);
134}
135
136/**
137 *
138 */
139void PhysxForceFieldDesc::
140set_kernel_velocity_multiplier(const LMatrix3f &multiplier) {
141
142 _kernel.velocityMultiplier = PhysxManager::mat3_to_nxMat33(multiplier);
143}
144
145/**
146 *
147 */
148void PhysxForceFieldDesc::
149create_kernel(NxScene *scenePtr) {
150
151 _desc.kernel = scenePtr->createForceFieldLinearKernel(_kernel);
152}
153
154/**
155 *
156 */
157void PhysxForceFieldDesc::
158set_coordinates(PhysxForceFieldCoordinates coordinates) {
159
160 _desc.coordinates = (NxForceFieldCoordinates) coordinates;
161}
162
163/**
164 *
165 */
166void PhysxForceFieldDesc::
167add_include_group_shape(PhysxForceFieldShapeDesc &desc) {
168
169 _desc.includeGroupShapes.push_back(desc.ptr());
170}
171
172/**
173 *
174 */
175void PhysxForceFieldDesc::
176add_shape_group(PhysxForceFieldShapeGroup *group) {
177
178 _desc.shapeGroups.push_back(group->ptr());
179}
180
181/**
182 *
183 */
184void PhysxForceFieldDesc::
185set_actor(PhysxActor *actor) {
186
187 _desc.actor = actor->ptr();
188}
Actors are the main simulation objects.
Definition physxActor.h:44
Abstract base class for descriptors for force field shapes descriptors.
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 NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.