Panda3D
 All Classes Functions Variables Enumerations
physxPlaneShape.cxx
00001 // Filename: physxPlaneShape.cxx
00002 // Created by:  enn0x (16Sep09)
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 "physxPlaneShape.h"
00016 #include "physxPlaneShapeDesc.h"
00017 #include "physxManager.h"
00018 
00019 TypeHandle PhysxPlaneShape::_type_handle;
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: PhysxPlaneShape::link
00023 //       Access: Public
00024 //  Description: 
00025 ////////////////////////////////////////////////////////////////////
00026 void PhysxPlaneShape::
00027 link(NxShape *shapePtr) {
00028 
00029   _ptr = shapePtr->isPlane();
00030   _ptr->userData = this;
00031   _error_type = ET_ok;
00032 
00033   set_name(shapePtr->getName());
00034 
00035   PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
00036   actor->_shapes.add(this);
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: PhysxPlaneShape::unlink
00041 //       Access: Public
00042 //  Description: 
00043 ////////////////////////////////////////////////////////////////////
00044 void PhysxPlaneShape::
00045 unlink() {
00046 
00047   _ptr->userData = NULL;
00048   _error_type = ET_released;
00049 
00050   PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
00051   actor->_shapes.remove(this);
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function : PhysxPlaneShape::save_to_desc
00056 //       Access : Published
00057 //  Description : Saves the state of the shape object to a 
00058 //                descriptor.
00059 ////////////////////////////////////////////////////////////////////
00060 void PhysxPlaneShape::
00061 save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const {
00062 
00063   nassertv(_error_type == ET_ok);
00064   _ptr->saveToDesc(shapeDesc._desc);
00065 }
00066 
00067 ////////////////////////////////////////////////////////////////////
00068 //     Function: PhysxPlaneShape::set_plane
00069 //       Access: Published
00070 //  Description: Sets the plane equation. 
00071 //               - normal:  Normal for the plane, in the global
00072 //                          frame. Range: direction vector  
00073 //               - d: Distance coefficient of the plane equation.
00074 //                    Range: (-inf,inf) 
00075 ////////////////////////////////////////////////////////////////////
00076 void PhysxPlaneShape::
00077 set_plane(const LVector3f &normal, float d) {
00078 
00079   nassertv(_error_type == ET_ok);
00080   _ptr->setPlane(PhysxManager::vec3_to_nxVec3(normal), d);
00081 }
00082 
 All Classes Functions Variables Enumerations