00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __BULLET_TRIANGLE_MESH_H__
00016 #define __BULLET_TRIANGLE_MESH_H__
00017
00018 #include "pandabase.h"
00019
00020 #include "bullet_includes.h"
00021 #include "bullet_utils.h"
00022
00023 #include "typedReferenceCount.h"
00024 #include "nodePath.h"
00025 #include "luse.h"
00026 #include "geom.h"
00027 #include "pta_LVecBase3.h"
00028 #include "pta_int.h"
00029
00030
00031
00032
00033
00034 class EXPCL_PANDABULLET BulletTriangleMesh : public TypedReferenceCount {
00035
00036 PUBLISHED:
00037 BulletTriangleMesh();
00038 INLINE ~BulletTriangleMesh();
00039
00040 void add_triangle(const LPoint3 &p0,
00041 const LPoint3 &p1,
00042 const LPoint3 &p2,
00043 bool remove_duplicate_vertices=false);
00044 void add_array(const PTA_LVecBase3 &points,
00045 const PTA_int &indices,
00046 bool remove_duplicate_vertices=false);
00047 void add_geom(const Geom *geom,
00048 bool remove_duplicate_vertices=false);
00049
00050 void set_welding_distance(PN_stdfloat distance);
00051 void preallocate(int num_verts, int num_indices);
00052
00053 int get_num_triangles() const;
00054 PN_stdfloat get_welding_distance() const;
00055
00056 virtual void output(ostream &out) const;
00057 virtual void write(ostream &out, int indent_level) const;
00058
00059 public:
00060 INLINE btTriangleMesh *ptr() const;
00061
00062 private:
00063 btTriangleMesh *_mesh;
00064
00065
00066 public:
00067 static TypeHandle get_class_type() {
00068 return _type_handle;
00069 }
00070 static void init_type() {
00071 TypedReferenceCount::init_type();
00072 register_type(_type_handle, "BulletTriangleMesh",
00073 TypedReferenceCount::get_class_type());
00074 }
00075 virtual TypeHandle get_type() const {
00076 return get_class_type();
00077 }
00078 virtual TypeHandle force_init_type() {
00079 init_type();
00080 return get_class_type();
00081 }
00082
00083 private:
00084 static TypeHandle _type_handle;
00085 };
00086
00087 INLINE ostream &operator << (ostream &out, const BulletTriangleMesh &obj);
00088
00089 #include "bulletTriangleMesh.I"
00090
00091 #endif // __BULLET_TRIANGLE_MESH_H__