Panda3D
 All Classes Functions Variables Enumerations
physxForceFieldDesc.cxx
00001 // Filename: physxForceFieldDesc.cxx
00002 // Created by:  enn0x (06Nov09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "physxForceFieldDesc.h"
00016 #include "physxForceFieldShapeDesc.h"
00017 #include "physxForceFieldShapeGroup.h"
00018 #include "physxManager.h"
00019 #include "physxActor.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: PhysxForceFieldDesc::set_name
00023 //       Access: Published
00024 //  Description: 
00025 ////////////////////////////////////////////////////////////////////
00026 void PhysxForceFieldDesc::
00027 set_name(const char *name) {
00028 
00029   _name = name ? name : "";
00030   _desc.name = _name.c_str();
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: PhysxForceFieldDesc::set_pos
00035 //       Access: Published
00036 //  Description: 
00037 ////////////////////////////////////////////////////////////////////
00038 void PhysxForceFieldDesc::
00039 set_pos(const LPoint3f &pos) {
00040 
00041   _desc.pose.t = PhysxManager::point3_to_nxVec3(pos);
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: PhysxForceFieldDesc::set_mat
00046 //       Access: Published
00047 //  Description: 
00048 ////////////////////////////////////////////////////////////////////
00049 void PhysxForceFieldDesc::
00050 set_mat(const LMatrix4f &mat) {
00051 
00052   _desc.pose = PhysxManager::mat4_to_nxMat34(mat);
00053 }
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 //     Function: PhysxForceFieldDesc::set_hpr
00057 //       Access: Published
00058 //  Description: 
00059 ////////////////////////////////////////////////////////////////////
00060 void PhysxForceFieldDesc::
00061 set_hpr(float h, float p, float r) {
00062 
00063   LQuaternionf q;
00064   LMatrix3f rot;
00065   NxMat34 m;
00066 
00067   q.set_hpr(LVector3f(h, p, r));
00068   q.extract_to_matrix(rot);
00069 
00070   _desc.pose.M = PhysxManager::mat3_to_nxMat33(rot);
00071 }
00072 
00073 ////////////////////////////////////////////////////////////////////
00074 //     Function: PhysxForceFieldDesc::set_kernel_constant
00075 //       Access: Published
00076 //  Description: 
00077 ////////////////////////////////////////////////////////////////////
00078 void PhysxForceFieldDesc::
00079 set_kernel_constant(const LVector3f &constant) {
00080 
00081   _kernel.constant = PhysxManager::vec3_to_nxVec3(constant);
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: PhysxForceFieldDesc::set_kernel_position_target
00086 //       Access: Published
00087 //  Description: 
00088 ////////////////////////////////////////////////////////////////////
00089 void PhysxForceFieldDesc::
00090 set_kernel_position_target(const LPoint3f &target) {
00091 
00092   _kernel.positionTarget = PhysxManager::point3_to_nxVec3(target);
00093 }
00094 
00095 ////////////////////////////////////////////////////////////////////
00096 //     Function: PhysxForceFieldDesc::set_kernel_velocity_target
00097 //       Access: Published
00098 //  Description: 
00099 ////////////////////////////////////////////////////////////////////
00100 void PhysxForceFieldDesc::
00101 set_kernel_velocity_target(const LVector3f &target) {
00102 
00103   _kernel.velocityTarget = PhysxManager::vec3_to_nxVec3(target);
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: PhysxForceFieldDesc::set_kernel_torus_radius
00108 //       Access: Published
00109 //  Description: 
00110 ////////////////////////////////////////////////////////////////////
00111 void PhysxForceFieldDesc::
00112 set_kernel_torus_radius(float radius) {
00113 
00114   _kernel.torusRadius = radius;
00115 }
00116 
00117 ////////////////////////////////////////////////////////////////////
00118 //     Function: PhysxForceFieldDesc::set_kernel_falloff_linear
00119 //       Access: Published
00120 //  Description: 
00121 ////////////////////////////////////////////////////////////////////
00122 void PhysxForceFieldDesc::
00123 set_kernel_falloff_linear(const LVector3f &falloff) {
00124 
00125   _kernel.falloffLinear = PhysxManager::vec3_to_nxVec3(falloff);
00126 }
00127 
00128 ////////////////////////////////////////////////////////////////////
00129 //     Function: PhysxForceFieldDesc::set_kernel_falloff_quadratic
00130 //       Access: Published
00131 //  Description: 
00132 ////////////////////////////////////////////////////////////////////
00133 void PhysxForceFieldDesc::
00134 set_kernel_falloff_quadratic(const LVector3f &falloff) {
00135 
00136   _kernel.falloffQuadratic = PhysxManager::vec3_to_nxVec3(falloff);
00137 }
00138 
00139 ////////////////////////////////////////////////////////////////////
00140 //     Function: PhysxForceFieldDesc::set_kernel_noise
00141 //       Access: Published
00142 //  Description: 
00143 ////////////////////////////////////////////////////////////////////
00144 void PhysxForceFieldDesc::
00145 set_kernel_noise(const LVector3f &noise) {
00146 
00147   _kernel.noise = PhysxManager::vec3_to_nxVec3(noise);
00148 }
00149 
00150 ////////////////////////////////////////////////////////////////////
00151 //     Function: PhysxForceFieldDesc::set_kernel_position_multiplier
00152 //       Access: Published
00153 //  Description: 
00154 ////////////////////////////////////////////////////////////////////
00155 void PhysxForceFieldDesc::
00156 set_kernel_position_multiplier(const LMatrix3f &multiplier) {
00157 
00158   _kernel.positionMultiplier = PhysxManager::mat3_to_nxMat33(multiplier);
00159 }
00160 
00161 ////////////////////////////////////////////////////////////////////
00162 //     Function: PhysxForceFieldDesc::set_kernel_velocity_multiplier
00163 //       Access: Published
00164 //  Description: 
00165 ////////////////////////////////////////////////////////////////////
00166 void PhysxForceFieldDesc::
00167 set_kernel_velocity_multiplier(const LMatrix3f &multiplier) {
00168 
00169   _kernel.velocityMultiplier = PhysxManager::mat3_to_nxMat33(multiplier);
00170 }
00171 
00172 ////////////////////////////////////////////////////////////////////
00173 //     Function: PhysxForceFieldDesc::create_kernel
00174 //       Access: Public
00175 //  Description: 
00176 ////////////////////////////////////////////////////////////////////
00177 void PhysxForceFieldDesc::
00178 create_kernel(NxScene *scenePtr) {
00179 
00180   _desc.kernel = scenePtr->createForceFieldLinearKernel(_kernel);
00181 }
00182 
00183 ////////////////////////////////////////////////////////////////////
00184 //     Function: PhysxForceFieldDesc::set_coordinates
00185 //       Access: Published
00186 //  Description: 
00187 ////////////////////////////////////////////////////////////////////
00188 void PhysxForceFieldDesc::
00189 set_coordinates(PhysxForceFieldCoordinates coordinates) {
00190 
00191   _desc.coordinates = (NxForceFieldCoordinates) coordinates;
00192 }
00193 
00194 ////////////////////////////////////////////////////////////////////
00195 //     Function: PhysxForceFieldDesc::add_include_group_shape
00196 //       Access: Published
00197 //  Description: 
00198 ////////////////////////////////////////////////////////////////////
00199 void PhysxForceFieldDesc::
00200 add_include_group_shape(PhysxForceFieldShapeDesc &desc) {
00201 
00202   _desc.includeGroupShapes.push_back(desc.ptr());
00203 }
00204 
00205 ////////////////////////////////////////////////////////////////////
00206 //     Function: PhysxForceFieldDesc::add_shape_group
00207 //       Access: Published
00208 //  Description: 
00209 ////////////////////////////////////////////////////////////////////
00210 void PhysxForceFieldDesc::
00211 add_shape_group(PhysxForceFieldShapeGroup *group) {
00212 
00213   _desc.shapeGroups.push_back(group->ptr());
00214 }
00215 
00216 ////////////////////////////////////////////////////////////////////
00217 //     Function: PhysxForceFieldDesc::set_actor
00218 //       Access: Published
00219 //  Description: 
00220 ////////////////////////////////////////////////////////////////////
00221 void PhysxForceFieldDesc::
00222 set_actor(PhysxActor *actor) {
00223 
00224   _desc.actor = actor->ptr();
00225 }
00226 
 All Classes Functions Variables Enumerations