Panda3D
odeTriMeshGeom.I
1 // Filename: odeTriMeshGeom.I
2 // Created by: joswilso (27Dec06)
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 INLINE void OdeTriMeshGeom::
16 set_data(OdeTriMeshData &data) {
17  odetrimeshdata_cat.warning()
18  << "OdeTriMeshGeom::set_data() is deprecated, use OdeTriMeshGeom::set_tri_mesh_data() instead!\n";
19  set_tri_mesh_data(data);
20 }
21 
22 INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
23 get_data() const {
24  odetrimeshdata_cat.warning()
25  << "OdeTriMeshGeom::get_data() is deprecated, use OdeTriMeshGeom::get_tri_mesh_data() instead!\n";
26  return get_tri_mesh_data();
27 }
28 
29 INLINE void OdeTriMeshGeom::
30 set_tri_mesh_data(OdeTriMeshData &data) {
31  nassertv(_id != 0);
32  dGeomTriMeshSetData(_id, data.get_id());
33  OdeTriMeshData::link_data(_id, &data);
34 }
35 
36 INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
37 get_tri_mesh_data() const {
38  nassertr(_id != 0, NULL);
39  return OdeTriMeshData::get_data(_id);
40 }
41 
42 INLINE void OdeTriMeshGeom::
43 enable_TC(int geom_class, int enable){
44  nassertv(_id != 0);
45  dGeomTriMeshEnableTC(_id, geom_class, enable);
46 }
47 
48 INLINE int OdeTriMeshGeom::
49 is_TC_enabled(int geom_class) const {
50  nassertr(_id != 0, 0);
51  return dGeomTriMeshIsTCEnabled(_id, geom_class);
52 }
53 
54 INLINE void OdeTriMeshGeom::
55 clear_TC_cache(const OdeGeom &geom){
56  nassertv(_id != 0);
57  dGeomTriMeshClearTCCache(_id);
58 }
59 
60 INLINE void OdeTriMeshGeom::
61 get_triangle(int face_index, LPoint3f &v0, LPoint3f &v1, LPoint3f &v2) const {
62  nassertv(_id != 0);
63  dVector3 dv0, dv1, dv2;
64  dGeomTriMeshGetTriangle(_id, face_index, &dv0, &dv1, &dv2);
65 
66  v0.set(dv0[0], dv0[1], dv0[2]);
67  v1.set(dv1[0], dv1[1], dv1[2]);
68  v2.set(dv2[0], dv2[1], dv2[2]);
69 }
70 
71 INLINE LPoint3f OdeTriMeshGeom::
72 get_point(int face_index, dReal u, dReal v) const {
73  nassertr(_id != 0, LPoint3f(0));
74  dVector3 out;
75  dGeomTriMeshGetPoint(_id, face_index, u, v, out);
76  return LPoint3f(out[0], out[1], out[2]);
77 }
78 
79 INLINE int OdeTriMeshGeom::
80 get_num_triangles() const {
81  nassertr(_id != 0, 0);
82  return dGeomTriMeshGetTriangleCount(_id);
83 }
84 
85 INLINE dTriMeshDataID OdeTriMeshGeom::
86 get_data_id() const {
87  odetrimeshdata_cat.warning()
88  << "OdeTriMeshGeom::get_data_id() is deprecated, use OdeTriMeshGeom::get_tri_mesh_data_id() instead!\n";
89  return get_tri_mesh_data_id();
90 }
91 
92 INLINE dTriMeshDataID OdeTriMeshGeom::
93 get_tri_mesh_data_id() const {
94  nassertr(_id != 0, 0);
95  return dGeomTriMeshGetTriMeshDataID(_id);
96 }
97 
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99