Panda3D
physxHeightField.h
1 // Filename: physxHeightField.h
2 // Created by: enn0x (15Oct09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PHYSXHEIGHTFIELD_H
16 #define PHYSXHEIGHTFIELD_H
17 
18 #include "pandabase.h"
19 #include "luse.h"
20 
21 #include "physxObject.h"
22 #include "physxContactReport.h"
23 #include "physxControllerReport.h"
24 #include "physxTriggerReport.h"
25 #include "physx_includes.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : PhysxHeightField
29 // Description : A height field object.
30 // Height fields work in a similar way as triangle
31 // meshes specified to act as height fields, with
32 // some important differences:
33 //
34 // Triangle meshes can be made of nonuniform geometry,
35 // while height fields are regular, rectangular grids.
36 // This means that with PhysxHeightField, you
37 // sacrifice flexibility in return for improved
38 // performance and decreased memory consumption.
39 //
40 // Height fields are referenced by shape instances of
41 // type PhysxHeightFieldShape.
42 //
43 // To create an instance of this class call
44 // PhysxManager::create_height_field(), and
45 // PhysxHeightField::release() to release it. This is
46 // only possible once you have released all of its
47 // PhysxHeightFiedShape instances before.
48 ////////////////////////////////////////////////////////////////////
49 class EXPCL_PANDAPHYSX PhysxHeightField : public PhysxObject {
50 
51 PUBLISHED:
52  void release();
53 
54  unsigned int get_reference_count() const;
55  float get_height(float x, float y) const;
56 
57  INLINE void ls() const;
58  INLINE void ls(ostream &out, int indent_level=0) const;
59 
60 public:
61  INLINE PhysxHeightField();
62  INLINE ~PhysxHeightField();
63 
64  INLINE NxHeightField *ptr() const { return _ptr; };
65 
66  void link(NxHeightField *ptr);
67  void unlink();
68 
69 private:
70  NxHeightField *_ptr;
71 
72 ////////////////////////////////////////////////////////////////////
73 public:
74  static TypeHandle get_class_type() {
75  return _type_handle;
76  }
77  static void init_type() {
78  PhysxObject::init_type();
79  register_type(_type_handle, "PhysxHeightField",
80  PhysxObject::get_class_type());
81  }
82  virtual TypeHandle get_type() const {
83  return get_class_type();
84  }
85  virtual TypeHandle force_init_type() {
86  init_type();
87  return get_class_type();
88  }
89 
90 private:
91  static TypeHandle _type_handle;
92 };
93 
94 #include "physxHeightField.I"
95 
96 #endif // PHYSXHEIGHTFIELD_H
A height field object.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85