diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index d6887fe6d8..e03b2ccfcf 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include "../mwworld/esmstore.hpp" #include "../mwworld/class.hpp" @@ -1020,7 +1020,7 @@ void RenderingManager::enableTerrain(bool enable) { Loading::Listener* listener = MWBase::Environment::get().getWindowManager()->getLoadingScreen(); Loading::ScopedLoad load(listener); - mTerrain = new Terrain::Terrain(listener, mRendering.getScene(), new MWRender::TerrainStorage(), RV_Terrain, + mTerrain = new Terrain::World(listener, mRendering.getScene(), new MWRender::TerrainStorage(), RV_Terrain, Settings::Manager::getBool("distant land", "Terrain"), Settings::Manager::getBool("shader", "Terrain")); mTerrain->applyMaterials(Settings::Manager::getBool("enabled", "Shadows"), diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 45929f0640..2d08139128 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -40,7 +40,7 @@ namespace sh namespace Terrain { - class Terrain; + class World; } namespace MWRender @@ -234,7 +234,7 @@ private: OcclusionQuery* mOcclusionQuery; - Terrain::Terrain* mTerrain; + Terrain::World* mTerrain; MWRender::Water *mWater; diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 1dd6816acd..04423dc6f0 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -67,7 +67,7 @@ add_component_dir (translation ) add_component_dir (terrain - quadtreenode chunk terrain storage material + quadtreenode chunk world storage material ) add_component_dir (loadinglistener diff --git a/components/terrain/chunk.cpp b/components/terrain/chunk.cpp index 87222af8b8..ce2118cdbd 100644 --- a/components/terrain/chunk.cpp +++ b/components/terrain/chunk.cpp @@ -4,7 +4,7 @@ #include #include "quadtreenode.hpp" -#include "terrain.hpp" +#include "world.hpp" #include "storage.hpp" namespace Terrain diff --git a/components/terrain/quadtreenode.cpp b/components/terrain/quadtreenode.cpp index e581c40ea1..95daa0afbc 100644 --- a/components/terrain/quadtreenode.cpp +++ b/components/terrain/quadtreenode.cpp @@ -3,7 +3,7 @@ #include #include -#include "terrain.hpp" +#include "world.hpp" #include "chunk.hpp" #include "storage.hpp" @@ -132,7 +132,7 @@ namespace } } -QuadTreeNode::QuadTreeNode(Terrain* terrain, ChildDirection dir, float size, const Ogre::Vector2 ¢er, QuadTreeNode* parent) +QuadTreeNode::QuadTreeNode(World* terrain, ChildDirection dir, float size, const Ogre::Vector2 ¢er, QuadTreeNode* parent) : mSize(size) , mCenter(center) , mParent(parent) diff --git a/components/terrain/quadtreenode.hpp b/components/terrain/quadtreenode.hpp index 5adb9676a3..9f6fb5d242 100644 --- a/components/terrain/quadtreenode.hpp +++ b/components/terrain/quadtreenode.hpp @@ -14,7 +14,7 @@ namespace Ogre namespace Terrain { - class Terrain; + class World; class Chunk; class MaterialGenerator; @@ -48,7 +48,7 @@ namespace Terrain /// @param size size (in *cell* units!) /// @param center center (in *cell* units!) /// @param parent parent node - QuadTreeNode (Terrain* terrain, ChildDirection dir, float size, const Ogre::Vector2& center, QuadTreeNode* parent); + QuadTreeNode (World* terrain, ChildDirection dir, float size, const Ogre::Vector2& center, QuadTreeNode* parent); ~QuadTreeNode(); void setVisible(bool visible); @@ -95,7 +95,7 @@ namespace Terrain /// Get bounding box in local coordinates const Ogre::AxisAlignedBox& getBoundingBox(); - Terrain* getTerrain() { return mTerrain; } + World* getTerrain() { return mTerrain; } /// Adjust LODs for the given camera position, possibly splitting up chunks or merging them. void update (const Ogre::Vector3& cameraPos, Loading::Listener* loadingListener); @@ -148,7 +148,7 @@ namespace Terrain Chunk* mChunk; - Terrain* mTerrain; + World* mTerrain; Ogre::TexturePtr mCompositeMap; diff --git a/components/terrain/terrain.cpp b/components/terrain/world.cpp similarity index 94% rename from components/terrain/terrain.cpp rename to components/terrain/world.cpp index 31a6ff5268..711ebbc8fa 100644 --- a/components/terrain/terrain.cpp +++ b/components/terrain/world.cpp @@ -1,4 +1,4 @@ -#include "terrain.hpp" +#include "world.hpp" #include #include @@ -52,7 +52,7 @@ namespace namespace Terrain { - Terrain::Terrain(Loading::Listener* loadingListener, Ogre::SceneManager* sceneMgr, + World::World(Loading::Listener* loadingListener, Ogre::SceneManager* sceneMgr, Storage* storage, int visibilityFlags, bool distantLand, bool shaders) : mStorage(storage) , mMinBatchSize(1) @@ -65,6 +65,7 @@ namespace Terrain , mLoadingListener(loadingListener) { loadingListener->setLabel("Creating terrain"); + loadingListener->indicateProgress(); mCompositeMapSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); @@ -98,13 +99,13 @@ namespace Terrain loadingListener->indicateProgress(); } - Terrain::~Terrain() + World::~World() { delete mRootNode; delete mStorage; } - void Terrain::buildQuadTree(QuadTreeNode *node) + void World::buildQuadTree(QuadTreeNode *node) { float halfSize = node->getSize()/2.f; @@ -151,7 +152,7 @@ namespace Terrain node->markAsDummy(); } - void Terrain::update(const Ogre::Vector3& cameraPos) + void World::update(const Ogre::Vector3& cameraPos) { if (!mVisible) return; @@ -159,7 +160,7 @@ namespace Terrain mRootNode->updateIndexBuffers(); } - Ogre::AxisAlignedBox Terrain::getWorldBoundingBox (const Ogre::Vector2& center) + Ogre::AxisAlignedBox World::getWorldBoundingBox (const Ogre::Vector2& center) { if (center.x > mBounds.getMaximum().x || center.x < mBounds.getMinimum().x @@ -173,7 +174,7 @@ namespace Terrain return box; } - Ogre::HardwareVertexBufferSharedPtr Terrain::getVertexBuffer(int numVertsOneSide) + Ogre::HardwareVertexBufferSharedPtr World::getVertexBuffer(int numVertsOneSide) { if (mUvBufferMap.find(numVertsOneSide) != mUvBufferMap.end()) { @@ -205,7 +206,7 @@ namespace Terrain return buffer; } - Ogre::HardwareIndexBufferSharedPtr Terrain::getIndexBuffer(int flags, size_t& numIndices) + Ogre::HardwareIndexBufferSharedPtr World::getIndexBuffer(int flags, size_t& numIndices) { if (mIndexBufferMap.find(flags) != mIndexBufferMap.end()) { @@ -366,31 +367,31 @@ namespace Terrain return buffer; } - void Terrain::renderCompositeMap(Ogre::TexturePtr target) + void World::renderCompositeMap(Ogre::TexturePtr target) { mCompositeMapRenderTarget->update(); target->getBuffer()->blit(mCompositeMapRenderTexture->getBuffer()); } - void Terrain::clearCompositeMapSceneManager() + void World::clearCompositeMapSceneManager() { mCompositeMapSceneMgr->destroyAllManualObjects(); mCompositeMapSceneMgr->clearScene(); } - float Terrain::getHeightAt(const Ogre::Vector3 &worldPos) + float World::getHeightAt(const Ogre::Vector3 &worldPos) { return mStorage->getHeightAt(worldPos); } - void Terrain::applyMaterials(bool shadows, bool splitShadows) + void World::applyMaterials(bool shadows, bool splitShadows) { mShadows = shadows; mSplitShadows = splitShadows; mRootNode->applyMaterials(); } - void Terrain::setVisible(bool visible) + void World::setVisible(bool visible) { if (visible && !mVisible) mSceneMgr->getRootSceneNode()->addChild(mRootSceneNode); @@ -400,7 +401,7 @@ namespace Terrain mVisible = visible; } - bool Terrain::getVisible() + bool World::getVisible() { return mVisible; } diff --git a/components/terrain/terrain.hpp b/components/terrain/world.hpp similarity index 97% rename from components/terrain/terrain.hpp rename to components/terrain/world.hpp index ad829cb478..b8c1b0a7d6 100644 --- a/components/terrain/terrain.hpp +++ b/components/terrain/world.hpp @@ -29,7 +29,7 @@ namespace Terrain * Cracks at LOD transitions are avoided using stitching. * @note Multiple cameras are not supported yet */ - class Terrain + class World { public: /// @note takes ownership of \a storage @@ -41,9 +41,9 @@ namespace Terrain /// This is a temporary option until it can be streamlined. /// @param shaders Whether to use splatting shader, or multi-pass fixed function splatting. Shader is usually /// faster so this is just here for compatibility. - Terrain(Loading::Listener* loadingListener, Ogre::SceneManager* sceneMgr, + World(Loading::Listener* loadingListener, Ogre::SceneManager* sceneMgr, Storage* storage, int visiblityFlags, bool distantLand, bool shaders); - ~Terrain(); + ~World(); void setLoadingListener(Loading::Listener* loadingListener) { mLoadingListener = loadingListener; }