Panda3D

physxHeightFieldShape.cxx

00001 // Filename: physxHeightFieldShape.cxx
00002 // Created by:  enn0x (15Oct09)
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 "physxHeightFieldShape.h"
00016 #include "physxHeightFieldShapeDesc.h"
00017 
00018 TypeHandle PhysxHeightFieldShape::_type_handle;
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: PhysxHeightFieldShape::link
00022 //       Access: Public
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 void PhysxHeightFieldShape::
00026 link(NxShape *shapePtr) {
00027 
00028   _ptr = shapePtr->isHeightField();
00029   _ptr->userData = this;
00030   _error_type = ET_ok;
00031 
00032   set_name(shapePtr->getName());
00033 
00034   PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
00035   actor->_shapes.add(this);
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: PhysxHeightFieldShape::unlink
00040 //       Access: Public
00041 //  Description: 
00042 ////////////////////////////////////////////////////////////////////
00043 void PhysxHeightFieldShape::
00044 unlink() {
00045 
00046   _ptr->userData = NULL;
00047   _error_type = ET_released;
00048 
00049   PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
00050   actor->_shapes.remove(this);
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function : PhysxHeightFieldShape::save_to_desc
00055 //       Access : Published
00056 //  Description : Saves the state of the shape object to a 
00057 //                descriptor.
00058 ////////////////////////////////////////////////////////////////////
00059 void PhysxHeightFieldShape::
00060 save_to_desc(PhysxHeightFieldShapeDesc &shapeDesc) const {
00061 
00062   nassertv(_error_type == ET_ok);
00063   _ptr->saveToDesc(shapeDesc._desc);
00064 }
00065 
 All Classes Functions Variables Enumerations