Panda3D
bulletTriangleMesh.h
1 // Filename: bulletTriangleMesh.h
2 // Created by: enn0x (09Feb10)
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_TRIANGLE_MESH_H__
16 #define __BULLET_TRIANGLE_MESH_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 #include "bullet_utils.h"
22 
23 #include "typedReferenceCount.h"
24 #include "nodePath.h"
25 #include "luse.h"
26 #include "geom.h"
27 #include "pta_LVecBase3.h"
28 #include "pta_int.h"
29 
30 ////////////////////////////////////////////////////////////////////
31 // Class : BulletTriangleMesh
32 // Description :
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDABULLET BulletTriangleMesh : public TypedReferenceCount {
35 
36 PUBLISHED:
38  INLINE ~BulletTriangleMesh();
39 
40  void add_triangle(const LPoint3 &p0,
41  const LPoint3 &p1,
42  const LPoint3 &p2,
43  bool remove_duplicate_vertices=false);
44  void add_array(const PTA_LVecBase3 &points,
45  const PTA_int &indices,
46  bool remove_duplicate_vertices=false);
47  void add_geom(const Geom *geom,
48  bool remove_duplicate_vertices=false,
49  const TransformState *ts=TransformState::make_identity());
50 
51  void set_welding_distance(PN_stdfloat distance);
52  void preallocate(int num_verts, int num_indices);
53 
54  int get_num_triangles() const;
55  PN_stdfloat get_welding_distance() const;
56 
57  virtual void output(ostream &out) const;
58  virtual void write(ostream &out, int indent_level) const;
59 
60 public:
61  INLINE btTriangleMesh *ptr() const;
62 
63 private:
64  btTriangleMesh *_mesh;
65 
66 ////////////////////////////////////////////////////////////////////
67 public:
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  TypedReferenceCount::init_type();
73  register_type(_type_handle, "BulletTriangleMesh",
74  TypedReferenceCount::get_class_type());
75  }
76  virtual TypeHandle get_type() const {
77  return get_class_type();
78  }
79  virtual TypeHandle force_init_type() {
80  init_type();
81  return get_class_type();
82  }
83 
84 private:
85  static TypeHandle _type_handle;
86 };
87 
88 INLINE ostream &operator << (ostream &out, const BulletTriangleMesh &obj);
89 
90 #include "bulletTriangleMesh.I"
91 
92 #endif // __BULLET_TRIANGLE_MESH_H__
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A container for geometry primitives.
Definition: geom.h:58
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85