00001 00005 /* Copyright © 2009, 2010 James Legg. 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 */ 00011 #ifndef LIBTRACK_BULLET_MESH_H 00012 #define LIBTRACK_BULLET_MESH_H 00013 00014 #include <string> 00015 #include <vector> 00016 #include <utility> 00017 00018 #include <btBulletDynamicsCommon.h> 00019 #include <btBulletCollisionCommon.h> 00020 00021 #include "DrawableMesh.h" 00022 00023 namespace Track 00024 { 00025 00034 class BulletMesh 00035 : public DrawableMesh 00036 { 00037 // no public copy constructor, since we could delete Bullet objects in use. 00038 BulletMesh(const BulletMesh & source); 00039 // no assignment operator, since we could delete Bullet objects in use. 00040 BulletMesh & operator=(const BulletMesh & source); 00041 public: 00043 static const unsigned int genererator_convex_hull_bit = 2; 00045 static const unsigned int genererator_triangle_mesh_bit = 4; 00046 00054 BulletMesh(std::string filename, 00055 unsigned int generators = genererator_triangle_mesh_bit, 00056 DrawableMesh::RenderMode render_mode = DrawableMesh::RM_SOLID); 00057 00064 BulletMesh(std::istream & source, 00065 unsigned int generators = genererator_triangle_mesh_bit, 00066 DrawableMesh::RenderMode render_mode = DrawableMesh::RM_SOLID); 00067 00069 typedef std::pair<std::string, unsigned int> ConstructionInformation; 00070 00072 BulletMesh(ConstructionInformation construction_information); 00073 00074 virtual ~BulletMesh(); 00075 00081 btConvexHullShape * get_convex_hull_shape(); 00086 btBvhTriangleMeshShape * get_triangle_shape(); 00087 private: 00089 void create(unsigned int generators = genererator_triangle_mesh_bit); 00090 00091 // pointers to the shapes created. 00092 // 0 if the apprpriate bit was not set when creating the mesh. 00093 btConvexHullShape * simplified_convex_shape; 00094 btBvhTriangleMeshShape * triangle_mesh_shape; 00095 btTriangleMesh * triangle_mesh; 00096 }; 00097 00098 } 00099 00100 #endif /*LIBTRACK_BULLET_MESH_H*/
Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.