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