Renamed Terrain::Terrain to Terrain::World to make VC happy

pull/51/head
scrawl 12 years ago
parent d3d6dfbde8
commit 839d251cc5

@ -25,7 +25,7 @@
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/terrain/terrain.hpp> #include <components/terrain/world.hpp>
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -1020,7 +1020,7 @@ void RenderingManager::enableTerrain(bool enable)
{ {
Loading::Listener* listener = MWBase::Environment::get().getWindowManager()->getLoadingScreen(); Loading::Listener* listener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
Loading::ScopedLoad load(listener); 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("distant land", "Terrain"),
Settings::Manager::getBool("shader", "Terrain")); Settings::Manager::getBool("shader", "Terrain"));
mTerrain->applyMaterials(Settings::Manager::getBool("enabled", "Shadows"), mTerrain->applyMaterials(Settings::Manager::getBool("enabled", "Shadows"),

@ -40,7 +40,7 @@ namespace sh
namespace Terrain namespace Terrain
{ {
class Terrain; class World;
} }
namespace MWRender namespace MWRender
@ -234,7 +234,7 @@ private:
OcclusionQuery* mOcclusionQuery; OcclusionQuery* mOcclusionQuery;
Terrain::Terrain* mTerrain; Terrain::World* mTerrain;
MWRender::Water *mWater; MWRender::Water *mWater;

@ -67,7 +67,7 @@ add_component_dir (translation
) )
add_component_dir (terrain add_component_dir (terrain
quadtreenode chunk terrain storage material quadtreenode chunk world storage material
) )
add_component_dir (loadinglistener add_component_dir (loadinglistener

@ -4,7 +4,7 @@
#include <OgreHardwareBufferManager.h> #include <OgreHardwareBufferManager.h>
#include "quadtreenode.hpp" #include "quadtreenode.hpp"
#include "terrain.hpp" #include "world.hpp"
#include "storage.hpp" #include "storage.hpp"
namespace Terrain namespace Terrain

@ -3,7 +3,7 @@
#include <OgreSceneManager.h> #include <OgreSceneManager.h>
#include <OgreManualObject.h> #include <OgreManualObject.h>
#include "terrain.hpp" #include "world.hpp"
#include "chunk.hpp" #include "chunk.hpp"
#include "storage.hpp" #include "storage.hpp"
@ -132,7 +132,7 @@ namespace
} }
} }
QuadTreeNode::QuadTreeNode(Terrain* terrain, ChildDirection dir, float size, const Ogre::Vector2 &center, QuadTreeNode* parent) QuadTreeNode::QuadTreeNode(World* terrain, ChildDirection dir, float size, const Ogre::Vector2 &center, QuadTreeNode* parent)
: mSize(size) : mSize(size)
, mCenter(center) , mCenter(center)
, mParent(parent) , mParent(parent)

@ -14,7 +14,7 @@ namespace Ogre
namespace Terrain namespace Terrain
{ {
class Terrain; class World;
class Chunk; class Chunk;
class MaterialGenerator; class MaterialGenerator;
@ -48,7 +48,7 @@ namespace Terrain
/// @param size size (in *cell* units!) /// @param size size (in *cell* units!)
/// @param center center (in *cell* units!) /// @param center center (in *cell* units!)
/// @param parent parent node /// @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(); ~QuadTreeNode();
void setVisible(bool visible); void setVisible(bool visible);
@ -95,7 +95,7 @@ namespace Terrain
/// Get bounding box in local coordinates /// Get bounding box in local coordinates
const Ogre::AxisAlignedBox& getBoundingBox(); 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. /// Adjust LODs for the given camera position, possibly splitting up chunks or merging them.
void update (const Ogre::Vector3& cameraPos, Loading::Listener* loadingListener); void update (const Ogre::Vector3& cameraPos, Loading::Listener* loadingListener);
@ -148,7 +148,7 @@ namespace Terrain
Chunk* mChunk; Chunk* mChunk;
Terrain* mTerrain; World* mTerrain;
Ogre::TexturePtr mCompositeMap; Ogre::TexturePtr mCompositeMap;

@ -1,4 +1,4 @@
#include "terrain.hpp" #include "world.hpp"
#include <OgreAxisAlignedBox.h> #include <OgreAxisAlignedBox.h>
#include <OgreCamera.h> #include <OgreCamera.h>
@ -52,7 +52,7 @@ namespace
namespace Terrain 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) Storage* storage, int visibilityFlags, bool distantLand, bool shaders)
: mStorage(storage) : mStorage(storage)
, mMinBatchSize(1) , mMinBatchSize(1)
@ -65,6 +65,7 @@ namespace Terrain
, mLoadingListener(loadingListener) , mLoadingListener(loadingListener)
{ {
loadingListener->setLabel("Creating terrain"); loadingListener->setLabel("Creating terrain");
loadingListener->indicateProgress();
mCompositeMapSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); mCompositeMapSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
@ -98,13 +99,13 @@ namespace Terrain
loadingListener->indicateProgress(); loadingListener->indicateProgress();
} }
Terrain::~Terrain() World::~World()
{ {
delete mRootNode; delete mRootNode;
delete mStorage; delete mStorage;
} }
void Terrain::buildQuadTree(QuadTreeNode *node) void World::buildQuadTree(QuadTreeNode *node)
{ {
float halfSize = node->getSize()/2.f; float halfSize = node->getSize()/2.f;
@ -151,7 +152,7 @@ namespace Terrain
node->markAsDummy(); node->markAsDummy();
} }
void Terrain::update(const Ogre::Vector3& cameraPos) void World::update(const Ogre::Vector3& cameraPos)
{ {
if (!mVisible) if (!mVisible)
return; return;
@ -159,7 +160,7 @@ namespace Terrain
mRootNode->updateIndexBuffers(); mRootNode->updateIndexBuffers();
} }
Ogre::AxisAlignedBox Terrain::getWorldBoundingBox (const Ogre::Vector2& center) Ogre::AxisAlignedBox World::getWorldBoundingBox (const Ogre::Vector2& center)
{ {
if (center.x > mBounds.getMaximum().x if (center.x > mBounds.getMaximum().x
|| center.x < mBounds.getMinimum().x || center.x < mBounds.getMinimum().x
@ -173,7 +174,7 @@ namespace Terrain
return box; return box;
} }
Ogre::HardwareVertexBufferSharedPtr Terrain::getVertexBuffer(int numVertsOneSide) Ogre::HardwareVertexBufferSharedPtr World::getVertexBuffer(int numVertsOneSide)
{ {
if (mUvBufferMap.find(numVertsOneSide) != mUvBufferMap.end()) if (mUvBufferMap.find(numVertsOneSide) != mUvBufferMap.end())
{ {
@ -205,7 +206,7 @@ namespace Terrain
return buffer; 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()) if (mIndexBufferMap.find(flags) != mIndexBufferMap.end())
{ {
@ -366,31 +367,31 @@ namespace Terrain
return buffer; return buffer;
} }
void Terrain::renderCompositeMap(Ogre::TexturePtr target) void World::renderCompositeMap(Ogre::TexturePtr target)
{ {
mCompositeMapRenderTarget->update(); mCompositeMapRenderTarget->update();
target->getBuffer()->blit(mCompositeMapRenderTexture->getBuffer()); target->getBuffer()->blit(mCompositeMapRenderTexture->getBuffer());
} }
void Terrain::clearCompositeMapSceneManager() void World::clearCompositeMapSceneManager()
{ {
mCompositeMapSceneMgr->destroyAllManualObjects(); mCompositeMapSceneMgr->destroyAllManualObjects();
mCompositeMapSceneMgr->clearScene(); mCompositeMapSceneMgr->clearScene();
} }
float Terrain::getHeightAt(const Ogre::Vector3 &worldPos) float World::getHeightAt(const Ogre::Vector3 &worldPos)
{ {
return mStorage->getHeightAt(worldPos); return mStorage->getHeightAt(worldPos);
} }
void Terrain::applyMaterials(bool shadows, bool splitShadows) void World::applyMaterials(bool shadows, bool splitShadows)
{ {
mShadows = shadows; mShadows = shadows;
mSplitShadows = splitShadows; mSplitShadows = splitShadows;
mRootNode->applyMaterials(); mRootNode->applyMaterials();
} }
void Terrain::setVisible(bool visible) void World::setVisible(bool visible)
{ {
if (visible && !mVisible) if (visible && !mVisible)
mSceneMgr->getRootSceneNode()->addChild(mRootSceneNode); mSceneMgr->getRootSceneNode()->addChild(mRootSceneNode);
@ -400,7 +401,7 @@ namespace Terrain
mVisible = visible; mVisible = visible;
} }
bool Terrain::getVisible() bool World::getVisible()
{ {
return mVisible; return mVisible;
} }

@ -29,7 +29,7 @@ namespace Terrain
* Cracks at LOD transitions are avoided using stitching. * Cracks at LOD transitions are avoided using stitching.
* @note Multiple cameras are not supported yet * @note Multiple cameras are not supported yet
*/ */
class Terrain class World
{ {
public: public:
/// @note takes ownership of \a storage /// @note takes ownership of \a storage
@ -41,9 +41,9 @@ namespace Terrain
/// This is a temporary option until it can be streamlined. /// 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 /// @param shaders Whether to use splatting shader, or multi-pass fixed function splatting. Shader is usually
/// faster so this is just here for compatibility. /// 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); Storage* storage, int visiblityFlags, bool distantLand, bool shaders);
~Terrain(); ~World();
void setLoadingListener(Loading::Listener* loadingListener) { mLoadingListener = loadingListener; } void setLoadingListener(Loading::Listener* loadingListener) { mLoadingListener = loadingListener; }
Loading…
Cancel
Save