Panda3D

physxSoftBodyMesh.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 physxSoftBodyMesh.cxx
10 * @author enn0x
11 * @date 2010-09-12
12 */
13
14 #include "physxSoftBodyMesh.h"
15 #include "physxMeshPool.h"
16
17 TypeHandle PhysxSoftBodyMesh::_type_handle;
18
19 /**
20 *
21 */
22 void PhysxSoftBodyMesh::
23 link(NxSoftBodyMesh *meshPtr) {
24
25 // Link self
26 PhysxManager::get_global_ptr()->_softbody_meshes.add(this);
27 _ptr = meshPtr;
28 _error_type = ET_ok;
29 }
30
31 /**
32 *
33 */
34 void PhysxSoftBodyMesh::
35 unlink() {
36
37 // Unlink self
38 _error_type = ET_released;
39 PhysxManager::get_global_ptr()->_softbody_meshes.remove(this);
40 }
41
42 /**
43 *
44 */
45 void PhysxSoftBodyMesh::
46 release() {
47
48 nassertv(_error_type == ET_ok);
49
50 unlink();
51 NxGetPhysicsSDK()->releaseSoftBodyMesh(*_ptr);
52 _ptr = nullptr;
53
54 PhysxMeshPool::release_soft_body_mesh(this);
55 }
56
57 /**
58 * Returns the reference count for shared meshes.
59 */
60 unsigned int PhysxSoftBodyMesh::
61 get_reference_count() const {
62
63 nassertr(_error_type == ET_ok, 0);
64
65 return _ptr->getReferenceCount();
66 }
PhysxManager::get_global_ptr
static PhysxManager * get_global_ptr()
Returns a pointer to the global PhysxManager object.
Definition: physxManager.cxx:98
PhysxSoftBodyMesh::get_reference_count
unsigned int get_reference_count() const
Returns the reference count for shared meshes.
Definition: physxSoftBodyMesh.cxx:61
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
physxMeshPool.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxSoftBodyMesh.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.