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