Back to index

supertuxkart  0.5+dfsg1
triangle_mesh.hpp
Go to the documentation of this file.
00001 //  $Id: triangle_mesh.hpp 839 2006-10-24 00:01:56Z hiker $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2006 Joerg Henrichs
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_TRIANGLE_MESH_H
00021 #define HEADER_TRIANGLE_MESH_H
00022 
00023 #include <vector>
00024 #include "user_pointer.hpp"
00025 #include "btBulletDynamicsCommon.h"
00026 #include "material.hpp"
00027 
00031 class TriangleMesh
00032 {
00033 private:
00034     UserPointer                  m_user_pointer;
00035     std::vector<const Material*> m_triangleIndex2Material;
00036     btRigidBody                 *m_body;
00037     btTriangleMesh               m_mesh;
00038     btDefaultMotionState        *m_motion_state;
00039     btCollisionShape            *m_collision_shape;
00040 public:
00041     TriangleMesh() : m_mesh() {};
00042         ~TriangleMesh();
00043     void addTriangle(btVector3 t1, btVector3 t2, btVector3 t3,
00044                      const Material* m);
00045     void createBody(btCollisionObject::CollisionFlags flags=
00046                          (btCollisionObject::CollisionFlags)0);
00047     const Material* getMaterial(int n) const {return m_triangleIndex2Material[n];}
00048 };
00049 #endif
00050 /* EOF */
00051