random_racer/src/ODETerrainLoader.h

Go to the documentation of this file.
00001 #ifndef _RR_ODETERRAINLOADER_H_
00002 #define _RR_ODETERRAINLOADER_H_
00003 
00004 #include <vector>
00005 
00006 #include "TerrainLoader.h"
00007 
00008 namespace vrsode
00009 {
00010 class CollisionBody;
00011 class TriangleData;
00012 } // namespace vrsode
00013 
00014 
00015 namespace random_racer
00016 {
00017 
00018 class ControlPointContainer;
00019 class VRSTerrainLoader;
00020 
00025 class ODETerrainLoader : public TerrainLoader
00026 {
00027     VRS::SO<vrsode::CollisionBody>  m_trimeshBody;
00028     VRS::SO<vrsode::TriangleData>   m_triangleData;
00029 
00034     VRS::SO<VRSTerrainLoader>       m_vrsLoader;
00035 
00040     void grabVertices(
00041         const VRS::Vector& position, std::vector<VRS::Vector>* target);
00042 
00048     void doubleVertices(
00049         std::vector<VRS::Vector>& source,
00050         std::vector<VRS::Vector>& target,
00051         unsigned int sourceLod,
00052         unsigned int targetLod);
00053 
00057     VRS::Vector interpolate(const VRS::Vector& a, const VRS::Vector& b);
00058 
00063     unsigned int indexForTarget(
00064         unsigned int x,
00065         unsigned int y,
00066         unsigned int lod,
00067         unsigned int newLod,
00068         unsigned int offsetX,
00069         unsigned int offsetY);
00070 
00076     template <class INDEX_ARRAY>
00077     void fillIndexArray(unsigned int lod, INDEX_ARRAY* target);
00078 
00083     template <class ITER, class FLOAT_ARRAY>
00084     void convertVertices(
00085         const ITER& begin, const ITER& end, FLOAT_ARRAY* target);
00086 
00087 public:
00098     ODETerrainLoader(
00099         VRS::SO<VRS::SceneThing> thing,
00100         VRS::SO<VRSTerrainLoader> vrsLoader,
00101         double boxSize,
00102         double viewSize);
00103 
00107     virtual ~ODETerrainLoader();
00108 
00114     virtual void replaceTerrain(
00115         const VRS::Vector& position, const VRS::Vector& center);
00116 
00120     inline void setDebug(bool debug = true)
00121     {
00122         m_trimeshBody->setDebugNode(debug);
00123     }
00124 };
00125 
00126 } // namespace random_racer
00127 
00128 #endif // _RR_ODETERRAINLOADER_H_

Generated on Fri May 11 21:01:58 2007 for Random Racer by  doxygen 1.5.1