Panda3D
physxConvexMesh.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxConvexMesh.cxx
10  * @author enn0x
11  * @date 2009-10-13
12  */
13 
14 #include "physxConvexMesh.h"
15 #include "physxMeshPool.h"
16 
17 TypeHandle PhysxConvexMesh::_type_handle;
18 
19 /**
20  *
21  */
22 void PhysxConvexMesh::
23 link(NxConvexMesh *meshPtr) {
24 
25  // Link self
26  PhysxManager::get_global_ptr()->_convex_meshes.add(this);
27  _ptr = meshPtr;
28  _error_type = ET_ok;
29 }
30 
31 /**
32  *
33  */
34 void PhysxConvexMesh::
35 unlink() {
36 
37  // Unlink self
38  _error_type = ET_released;
39  PhysxManager::get_global_ptr()->_convex_meshes.remove(this);
40 }
41 
42 /**
43  *
44  */
45 void PhysxConvexMesh::
46 release() {
47 
48  nassertv(_error_type == ET_ok);
49 
50  unlink();
51  NxGetPhysicsSDK()->releaseConvexMesh(*_ptr);
52  _ptr = nullptr;
53 
54  PhysxMeshPool::release_convex_mesh(this);
55 }
56 
57 /**
58  * Returns the reference count for shared meshes.
59  */
60 unsigned int PhysxConvexMesh::
62 
63  nassertr(_error_type == ET_ok, 0);
64 
65  return _ptr->getReferenceCount();
66 }
static PhysxManager * get_global_ptr()
Returns a pointer to the global PhysxManager object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
unsigned int get_reference_count() const
Returns the reference count for shared meshes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81