00001 // Filename: physxConvexMesh.cxx 00002 // Created by: enn0x (13Oct09) 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 "physxConvexMesh.h" 00016 #include "physxMeshPool.h" 00017 00018 TypeHandle PhysxConvexMesh::_type_handle; 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: PhysxConvexMesh::link 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 void PhysxConvexMesh:: 00026 link(NxConvexMesh *meshPtr) { 00027 00028 // Link self 00029 PhysxManager::get_global_ptr()->_convex_meshes.add(this); 00030 _ptr = meshPtr; 00031 _error_type = ET_ok; 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: PhysxConvexMesh::unlink 00036 // Access: Public 00037 // Description: 00038 //////////////////////////////////////////////////////////////////// 00039 void PhysxConvexMesh:: 00040 unlink() { 00041 00042 // Unlink self 00043 _error_type = ET_released; 00044 PhysxManager::get_global_ptr()->_convex_meshes.remove(this); 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: PhysxConvexMesh::release 00049 // Access: Published 00050 // Description: 00051 //////////////////////////////////////////////////////////////////// 00052 void PhysxConvexMesh:: 00053 release() { 00054 00055 nassertv(_error_type == ET_ok); 00056 00057 unlink(); 00058 NxGetPhysicsSDK()->releaseConvexMesh(*_ptr); 00059 _ptr = NULL; 00060 00061 PhysxMeshPool::release_convex_mesh(this); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: PhysxConvexMesh::get_reference_count 00066 // Access: Published 00067 // Description: Returns the reference count for shared meshes. 00068 //////////////////////////////////////////////////////////////////// 00069 unsigned int PhysxConvexMesh:: 00070 get_reference_count() const { 00071 00072 nassertr(_error_type == ET_ok, 0); 00073 00074 return _ptr->getReferenceCount(); 00075 } 00076