Panda3D
Loading...
Searching...
No Matches
physxHeightField.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 physxHeightField.cxx
10 * @author enn0x
11 * @date 2009-10-15
12 */
13
14#include "physxHeightField.h"
15
16TypeHandle PhysxHeightField::_type_handle;
17
18/**
19 *
20 */
21void PhysxHeightField::
22link(NxHeightField *hfPtr) {
23
24 PhysxManager::get_global_ptr()->_heightfields.add(this);
25 _ptr = hfPtr;
26 _error_type = ET_ok;
27}
28
29/**
30 *
31 */
32void PhysxHeightField::
33unlink() {
34
35 _error_type = ET_released;
36 PhysxManager::get_global_ptr()->_heightfields.remove(this);
37}
38
39/**
40 *
41 */
42void PhysxHeightField::
43release() {
44
45 nassertv(_error_type == ET_ok);
46
47 unlink();
48 NxGetPhysicsSDK()->releaseHeightField(*_ptr);
49 _ptr = nullptr;
50}
51
52/**
53 *
54 */
55float PhysxHeightField::
56get_height(float x, float y) const {
57
58 nassertr(_error_type == ET_ok, 0.0f);
59 return _ptr->getHeight(x, y);
60}
61
62/**
63 * Returns the reference count for shared meshes.
64 */
66get_reference_count() const {
67
68 nassertr(_error_type == ET_ok, 0);
69 return _ptr->getReferenceCount();
70}
unsigned int get_reference_count() const
Returns the reference count for shared meshes.
static PhysxManager * get_global_ptr()
Returns a pointer to the global PhysxManager object.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.