Panda3D
 All Classes Functions Variables Enumerations
odeTriMeshGeom.I
00001 // Filename: odeTriMeshGeom.I
00002 // Created by:  joswilso (27Dec06)
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 INLINE void OdeTriMeshGeom::
00016 set_data(OdeTriMeshData &data) {
00017   odetrimeshdata_cat.warning()
00018     << "OdeTriMeshGeom::set_data() is deprecated, use OdeTriMeshGeom::set_tri_mesh_data() instead!\n";
00019   set_tri_mesh_data(data);
00020 }
00021 
00022 INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
00023 get_data() const {
00024   odetrimeshdata_cat.warning()
00025     << "OdeTriMeshGeom::get_data() is deprecated, use OdeTriMeshGeom::get_tri_mesh_data() instead!\n";
00026   return get_tri_mesh_data();
00027 }
00028 
00029 INLINE void OdeTriMeshGeom::
00030 set_tri_mesh_data(OdeTriMeshData &data) {
00031   nassertv(_id != 0);
00032   dGeomTriMeshSetData(_id, data.get_id());
00033   OdeTriMeshData::link_data(_id, &data);
00034 }
00035 
00036 INLINE PT(OdeTriMeshData) OdeTriMeshGeom::
00037 get_tri_mesh_data() const {
00038   nassertr(_id != 0 ,0);
00039   return OdeTriMeshData::get_data(_id);
00040 }
00041 
00042 INLINE void OdeTriMeshGeom::
00043 enable_TC(int geom_class, int enable){
00044   nassertv(_id != 0);
00045   dGeomTriMeshEnableTC(_id, geom_class, enable);
00046 }
00047 
00048 INLINE int OdeTriMeshGeom::
00049 is_TC_enabled(int geom_class) const {
00050   nassertr(_id != 0, 0);
00051   return dGeomTriMeshIsTCEnabled(_id, geom_class);
00052 }
00053 
00054 INLINE void OdeTriMeshGeom::
00055 clear_TC_cache(const OdeGeom &geom){
00056   nassertv(_id != 0);
00057   dGeomTriMeshClearTCCache(_id);
00058 }
00059 
00060 INLINE void OdeTriMeshGeom::
00061 get_triangle(int face_index, LPoint3f &v0, LPoint3f &v1, LPoint3f &v2) const {
00062   nassertv(_id != 0);
00063   dVector3 dv0, dv1, dv2;
00064   dGeomTriMeshGetTriangle(_id, face_index, &dv0, &dv1, &dv2);
00065   
00066   v0.set(dv0[0], dv0[1], dv0[2]);
00067   v1.set(dv1[0], dv1[1], dv1[2]);
00068   v2.set(dv2[0], dv2[1], dv2[2]);
00069 }
00070 
00071 INLINE LPoint3f OdeTriMeshGeom::
00072 get_point(int face_index, dReal u, dReal v) const {
00073   nassertr(_id != 0, LPoint3f(0));
00074   dVector3 out;
00075   dGeomTriMeshGetPoint(_id, face_index, u, v, out);
00076   return LPoint3f(out[0], out[1], out[2]);
00077 }
00078 
00079 INLINE int OdeTriMeshGeom::
00080 get_num_triangles() const {
00081   nassertr(_id != 0, 0);
00082   return dGeomTriMeshGetTriangleCount(_id);
00083 }
00084 
00085 INLINE dTriMeshDataID OdeTriMeshGeom::
00086 get_data_id() const {
00087   odetrimeshdata_cat.warning()
00088     << "OdeTriMeshGeom::get_data_id() is deprecated, use OdeTriMeshGeom::get_tri_mesh_data_id() instead!\n";
00089   return get_tri_mesh_data_id();
00090 }
00091 
00092 INLINE dTriMeshDataID OdeTriMeshGeom::
00093 get_tri_mesh_data_id() const {
00094   nassertr(_id != 0, 0);
00095   return dGeomTriMeshGetTriMeshDataID(_id);
00096 }
00097 
 All Classes Functions Variables Enumerations