Panda3D
 All Classes Functions Variables Enumerations
physxForceFieldShapeDesc.cxx
00001 // Filename: physxForceFieldShapeDesc.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 "physxForceFieldShapeDesc.h"
00016 #include "physxManager.h"
00017 
00018 ////////////////////////////////////////////////////////////////////
00019 //     Function: PhysxForceFieldShapeDesc::set_name
00020 //       Access: Published
00021 //  Description: Sets a possible debug name.
00022 ////////////////////////////////////////////////////////////////////
00023 void PhysxForceFieldShapeDesc::
00024 set_name(const char *name) {
00025 
00026   _name = name ? name : "";
00027   ptr()->name = _name.c_str();
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: PhysxForceFieldShapeDesc::set_pos
00032 //       Access: Published
00033 //  Description: 
00034 ////////////////////////////////////////////////////////////////////
00035 void PhysxForceFieldShapeDesc::
00036 set_pos(const LPoint3f &pos) {
00037 
00038   nassertv(!pos.is_nan());
00039   ptr()->pose.t = PhysxManager::point3_to_nxVec3(pos);
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: PhysxForceFieldShapeDesc::set_mat
00044 //       Access: Published
00045 //  Description: 
00046 ////////////////////////////////////////////////////////////////////
00047 void PhysxForceFieldShapeDesc::
00048 set_mat(const LMatrix4f &mat) {
00049 
00050   nassertv(!mat.is_nan());
00051   ptr()->pose = PhysxManager::mat4_to_nxMat34(mat);
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: PhysxForceFieldShapeDesc::set_hpr
00056 //       Access: Published
00057 //  Description: 
00058 ////////////////////////////////////////////////////////////////////
00059 void PhysxForceFieldShapeDesc::
00060 set_hpr(float h, float p, float r) {
00061 
00062   LQuaternionf q;
00063   LMatrix3f rot;
00064   NxMat34 m;
00065 
00066   q.set_hpr(LVector3f(h, p, r));
00067   q.extract_to_matrix(rot);
00068 
00069   ptr()->pose.M = PhysxManager::mat3_to_nxMat33(rot);
00070 }
00071 
00072 ////////////////////////////////////////////////////////////////////
00073 //     Function: PhysxForceFieldShapeDesc::get_name
00074 //       Access: Published
00075 //  Description: 
00076 ////////////////////////////////////////////////////////////////////
00077 const char *PhysxForceFieldShapeDesc::
00078 get_name() const {
00079 
00080   return ptr()->name;
00081 }
00082 
00083 ////////////////////////////////////////////////////////////////////
00084 //     Function: PhysxForceFieldShapeDesc::get_pos
00085 //       Access: Published
00086 //  Description: 
00087 ////////////////////////////////////////////////////////////////////
00088 LPoint3f PhysxForceFieldShapeDesc::
00089 get_pos() const {
00090 
00091   return PhysxManager::nxVec3_to_point3(ptr()->pose.t);
00092 }
00093 
00094 ////////////////////////////////////////////////////////////////////
00095 //     Function: PhysxForceFieldShapeDesc::get_mat
00096 //       Access: Published
00097 //  Description: 
00098 ////////////////////////////////////////////////////////////////////
00099 LMatrix4f PhysxForceFieldShapeDesc::
00100 get_mat() const {
00101 
00102   return PhysxManager::nxMat34_to_mat4(ptr()->pose);
00103 }
00104 
 All Classes Functions Variables Enumerations