Panda3D
|
00001 // Filename: bulletHeightfieldShape.h 00002 // Created by: enn0x (05Feb10) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef __BULLET_HEIGHTFIELD_SHAPE_H__ 00016 #define __BULLET_HEIGHTFIELD_SHAPE_H__ 00017 00018 #include "pandabase.h" 00019 00020 #include "bullet_includes.h" 00021 #include "bullet_utils.h" 00022 #include "bulletShape.h" 00023 00024 #include "pnmImage.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : BulletHeightfieldShape 00028 // Description : 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDABULLET BulletHeightfieldShape : public BulletShape { 00031 00032 PUBLISHED: 00033 BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up=Z_up); 00034 INLINE BulletHeightfieldShape(const BulletHeightfieldShape ©); 00035 INLINE void operator = (const BulletHeightfieldShape ©); 00036 INLINE ~BulletHeightfieldShape(); 00037 00038 void set_use_diamond_subdivision(bool flag=true); 00039 00040 public: 00041 virtual btCollisionShape *ptr() const; 00042 00043 private: 00044 int _num_rows; 00045 int _num_cols; 00046 float *_data; 00047 btHeightfieldTerrainShape *_shape; 00048 00049 //////////////////////////////////////////////////////////////////// 00050 public: 00051 static TypeHandle get_class_type() { 00052 return _type_handle; 00053 } 00054 static void init_type() { 00055 BulletShape::init_type(); 00056 register_type(_type_handle, "BulletHeightfieldShape", 00057 BulletShape::get_class_type()); 00058 } 00059 virtual TypeHandle get_type() const { 00060 return get_class_type(); 00061 } 00062 virtual TypeHandle force_init_type() { 00063 init_type(); 00064 return get_class_type(); 00065 } 00066 00067 private: 00068 static TypeHandle _type_handle; 00069 }; 00070 00071 #include "bulletHeightfieldShape.I" 00072 00073 #endif // __BULLET_HEIGHTFIELD_SHAPE_H__