Panda3D
Loading...
Searching...
No Matches
odeTriMeshGeom.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file odeTriMeshGeom.I
10 * @author joswilso
11 * @date 2006-12-27
12 */
13
14INLINE void OdeTriMeshGeom::
15set_data(OdeTriMeshData &data) {
16 odetrimeshdata_cat.warning()
17 << "OdeTriMeshGeom::set_data() is deprecated, use OdeTriMeshGeom::set_tri_mesh_data() instead!\n";
18 set_tri_mesh_data(data);
19}
20
21INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
22get_data() const {
23 odetrimeshdata_cat.warning()
24 << "OdeTriMeshGeom::get_data() is deprecated, use OdeTriMeshGeom::get_tri_mesh_data() instead!\n";
25 return get_tri_mesh_data();
26}
27
28INLINE void OdeTriMeshGeom::
29set_tri_mesh_data(OdeTriMeshData &data) {
30 nassertv(_id != 0);
31 dGeomTriMeshSetData(_id, data.get_id());
32 OdeTriMeshData::link_data(_id, &data);
33}
34
35INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
36get_tri_mesh_data() const {
37 nassertr(_id != 0, nullptr);
38 return OdeTriMeshData::get_data(_id);
39}
40
41INLINE void OdeTriMeshGeom::
42enable_TC(int geom_class, int enable){
43 nassertv(_id != 0);
44 dGeomTriMeshEnableTC(_id, geom_class, enable);
45}
46
47INLINE int OdeTriMeshGeom::
48is_TC_enabled(int geom_class) const {
49 nassertr(_id != 0, 0);
50 return dGeomTriMeshIsTCEnabled(_id, geom_class);
51}
52
53INLINE void OdeTriMeshGeom::
54clear_TC_cache(const OdeGeom &geom){
55 nassertv(_id != 0);
56 dGeomTriMeshClearTCCache(_id);
57}
58
59INLINE void OdeTriMeshGeom::
60get_triangle(int face_index, LPoint3f &v0, LPoint3f &v1, LPoint3f &v2) const {
61 nassertv(_id != 0);
62 dVector3 dv0, dv1, dv2;
63 dGeomTriMeshGetTriangle(_id, face_index, &dv0, &dv1, &dv2);
64
65 v0.set(dv0[0], dv0[1], dv0[2]);
66 v1.set(dv1[0], dv1[1], dv1[2]);
67 v2.set(dv2[0], dv2[1], dv2[2]);
68}
69
70INLINE LPoint3f OdeTriMeshGeom::
71get_point(int face_index, dReal u, dReal v) const {
72 nassertr(_id != 0, LPoint3f(0));
73 dVector3 out;
74 dGeomTriMeshGetPoint(_id, face_index, u, v, out);
75 return LPoint3f(out[0], out[1], out[2]);
76}
77
78INLINE int OdeTriMeshGeom::
79get_num_triangles() const {
80 nassertr(_id != 0, 0);
81 return dGeomTriMeshGetTriangleCount(_id);
82}
83
84INLINE dTriMeshDataID OdeTriMeshGeom::
85get_data_id() const {
86 odetrimeshdata_cat.warning()
87 << "OdeTriMeshGeom::get_data_id() is deprecated, use OdeTriMeshGeom::get_tri_mesh_data_id() instead!\n";
88 return get_tri_mesh_data_id();
89}
90
91INLINE dTriMeshDataID OdeTriMeshGeom::
92get_tri_mesh_data_id() const {
93 nassertr(_id != 0, 0);
94 return dGeomTriMeshGetTriMeshDataID(_id);
95}