Panda3D
 All Classes Functions Variables Enumerations
bulletHeightfieldShape.h
1 // Filename: bulletHeightfieldShape.h
2 // Created by: enn0x (05Feb10)
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 __BULLET_HEIGHTFIELD_SHAPE_H__
16 #define __BULLET_HEIGHTFIELD_SHAPE_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 #include "bullet_utils.h"
22 #include "bulletShape.h"
23 
24 #include "pnmImage.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : BulletHeightfieldShape
28 // Description :
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDABULLET BulletHeightfieldShape : public BulletShape {
31 
32 PUBLISHED:
33  BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up=Z_up);
35  INLINE void operator = (const BulletHeightfieldShape &copy);
36  INLINE ~BulletHeightfieldShape();
37 
38  void set_use_diamond_subdivision(bool flag=true);
39 
40 public:
41  virtual btCollisionShape *ptr() const;
42 
43 private:
44  int _num_rows;
45  int _num_cols;
46  float *_data;
47  btHeightfieldTerrainShape *_shape;
48 
49 ////////////////////////////////////////////////////////////////////
50 public:
51  static TypeHandle get_class_type() {
52  return _type_handle;
53  }
54  static void init_type() {
55  BulletShape::init_type();
56  register_type(_type_handle, "BulletHeightfieldShape",
57  BulletShape::get_class_type());
58  }
59  virtual TypeHandle get_type() const {
60  return get_class_type();
61  }
62  virtual TypeHandle force_init_type() {
63  init_type();
64  return get_class_type();
65  }
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 #include "bulletHeightfieldShape.I"
72 
73 #endif // __BULLET_HEIGHTFIELD_SHAPE_H__
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
Definition: pnmImage.h:68
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85