diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index ed18af74b..c4e69bab1 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -2,10 +2,8 @@ #include -#include #include -#include "texturemanager.hpp" #include "chunkmanager.hpp" namespace Terrain @@ -15,9 +13,6 @@ TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource:: : Terrain::World(parent, compileRoot, resourceSystem, ico, storage, nodeMask, preCompileMask) , mNumSplits(4) { - osg::ref_ptr material (new osg::Material); - material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); - mTerrainRoot->getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON); } TerrainGrid::~TerrainGrid() @@ -89,9 +84,4 @@ void TerrainGrid::unloadCell(int x, int y) mGrid.erase(it); } -void TerrainGrid::updateTextureFiltering() -{ - mTextureManager->updateTextureFiltering(); -} - } diff --git a/components/terrain/terraingrid.hpp b/components/terrain/terraingrid.hpp index 0bfc43075..f481c62e4 100644 --- a/components/terrain/terraingrid.hpp +++ b/components/terrain/terraingrid.hpp @@ -33,10 +33,6 @@ namespace Terrain /// @note Not thread safe. virtual void unloadCell(int x, int y); - /// Apply the scene manager's texture filtering settings to all cached textures. - /// @note Thread safe. - void updateTextureFiltering(); - private: osg::ref_ptr buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter); diff --git a/components/terrain/world.cpp b/components/terrain/world.cpp index 015270a43..ac6b5a6aa 100644 --- a/components/terrain/world.cpp +++ b/components/terrain/world.cpp @@ -1,6 +1,8 @@ #include "world.hpp" #include +#include + #include #include @@ -23,6 +25,10 @@ World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSyst mTerrainRoot = new osg::Group; mTerrainRoot->setNodeMask(nodeMask); mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN); + osg::ref_ptr material (new osg::Material); + material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); + mTerrainRoot->getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON); + mTerrainRoot->setName("Terrain Root"); osg::ref_ptr renderer (new CompositeMapRenderer); @@ -55,4 +61,9 @@ float World::getHeightAt(const osg::Vec3f &worldPos) return mStorage->getHeightAt(worldPos); } +void World::updateTextureFiltering() +{ + mTextureManager->updateTextureFiltering(); +} + } diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index f5cb10c37..132d5720b 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -46,7 +46,9 @@ namespace Terrain Storage* storage, int nodeMask, int preCompileMask); virtual ~World(); - virtual void updateTextureFiltering() {} + /// Apply the scene manager's texture filtering settings to all cached textures. + /// @note Thread safe. + void updateTextureFiltering(); float getHeightAt (const osg::Vec3f& worldPos);