OpenMW
|
00001 #ifndef COMPONENTS_TERRAIN_TERRAINBATCH_H 00002 #define COMPONENTS_TERRAIN_TERRAINBATCH_H 00003 00004 #include <OgreRenderable.h> 00005 #include <OgreMovableObject.h> 00006 00007 namespace Terrain 00008 { 00009 00010 class QuadTreeNode; 00011 00015 class Chunk : public Ogre::Renderable, public Ogre::MovableObject 00016 { 00017 public: 00019 Chunk (QuadTreeNode* node, short lodLevel); 00020 virtual ~Chunk(); 00021 00022 void setMaterial (const Ogre::MaterialPtr& material); 00023 00026 void setAdditionalLod (size_t lod) { mAdditionalLod = lod; } 00027 size_t getAdditionalLod() { return mAdditionalLod; } 00028 00029 void updateIndexBuffer(); 00030 00031 // Inherited from MovableObject 00032 virtual const Ogre::String& getMovableType(void) const { static Ogre::String t = "MW_TERRAIN"; return t; } 00033 virtual const Ogre::AxisAlignedBox& getBoundingBox(void) const; 00034 virtual Ogre::Real getBoundingRadius(void) const; 00035 virtual void _updateRenderQueue(Ogre::RenderQueue* queue); 00036 virtual void visitRenderables(Renderable::Visitor* visitor, 00037 bool debugRenderables = false); 00038 00039 // Inherited from Renderable 00040 virtual const Ogre::MaterialPtr& getMaterial(void) const; 00041 virtual void getRenderOperation(Ogre::RenderOperation& op); 00042 virtual void getWorldTransforms(Ogre::Matrix4* xform) const; 00043 virtual Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const; 00044 virtual const Ogre::LightList& getLights(void) const; 00045 00046 private: 00047 QuadTreeNode* mNode; 00048 Ogre::MaterialPtr mMaterial; 00049 00050 size_t mVertexLod; 00051 size_t mAdditionalLod; 00052 00053 Ogre::VertexData* mVertexData; 00054 Ogre::IndexData* mIndexData; 00055 Ogre::HardwareVertexBufferSharedPtr mVertexBuffer; 00056 Ogre::HardwareVertexBufferSharedPtr mNormalBuffer; 00057 Ogre::HardwareVertexBufferSharedPtr mColourBuffer; 00058 Ogre::HardwareIndexBufferSharedPtr mIndexBuffer; 00059 }; 00060 00061 } 00062 00063 #endif