00001 // Filename: physxCapsuleForceFieldShape.cxx 00002 // Created by: enn0x (15Nov09) 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 "physxCapsuleForceFieldShape.h" 00016 #include "physxCapsuleForceFieldShapeDesc.h" 00017 00018 TypeHandle PhysxCapsuleForceFieldShape::_type_handle; 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: PhysxCapsuleForceFieldShape::link 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 void PhysxCapsuleForceFieldShape:: 00026 link(NxForceFieldShape *shapePtr) { 00027 00028 _ptr = shapePtr->isCapsule(); 00029 _ptr->userData = this; 00030 _error_type = ET_ok; 00031 00032 set_name(shapePtr->getName()); 00033 00034 PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; 00035 group->_shapes.add(this); 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: PhysxCapsuleForceFieldShape::unlink 00040 // Access: Public 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 void PhysxCapsuleForceFieldShape:: 00044 unlink() { 00045 00046 _ptr->userData = NULL; 00047 _error_type = ET_released; 00048 00049 PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; 00050 group->_shapes.remove(this); 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function : PhysxCapsuleForceFieldShape::save_to_desc 00055 // Access : Published 00056 // Description : Saves the state of the shape object to a 00057 // descriptor. 00058 //////////////////////////////////////////////////////////////////// 00059 void PhysxCapsuleForceFieldShape:: 00060 save_to_desc(PhysxCapsuleForceFieldShapeDesc &shapeDesc) const { 00061 00062 nassertv(_error_type == ET_ok); 00063 _ptr->saveToDesc(shapeDesc._desc); 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: PhysxCapsuleForceFieldShape::set_radius 00068 // Access: Published 00069 // Description: Alters the radius of the capsule. 00070 //////////////////////////////////////////////////////////////////// 00071 void PhysxCapsuleForceFieldShape:: 00072 set_radius(float radius) { 00073 00074 nassertv(_error_type == ET_ok); 00075 _ptr->setRadius(radius); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: PhysxCapsuleForceFieldShape::set_height 00080 // Access: Published 00081 // Description: Alters the height of the capsule. 00082 //////////////////////////////////////////////////////////////////// 00083 void PhysxCapsuleForceFieldShape:: 00084 set_height(float height) { 00085 00086 nassertv(_error_type == ET_ok); 00087 _ptr->setHeight(height); 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: PhysxCapsuleForceFieldShape::get_radius 00092 // Access: Published 00093 // Description: Retrieves the radius of the capsule. 00094 //////////////////////////////////////////////////////////////////// 00095 float PhysxCapsuleForceFieldShape:: 00096 get_radius() const { 00097 00098 nassertr(_error_type == ET_ok, 0.0f); 00099 return _ptr->getRadius(); 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: PhysxCapsuleForceFieldShape::get_height 00104 // Access: Published 00105 // Description: Retrieves the height of the capsule. 00106 //////////////////////////////////////////////////////////////////// 00107 float PhysxCapsuleForceFieldShape:: 00108 get_height() const { 00109 00110 nassertr(_error_type == ET_ok, 0.0f); 00111 return _ptr->getHeight(); 00112 } 00113