forked from mirror/openmw-tes3mp
Move updateTextureFiltering and material into the base class
This commit is contained in:
parent
5eff286c71
commit
c487df0abb
4 changed files with 14 additions and 15 deletions
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <osg/Material>
|
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
|
|
||||||
#include "texturemanager.hpp"
|
|
||||||
#include "chunkmanager.hpp"
|
#include "chunkmanager.hpp"
|
||||||
|
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
|
@ -15,9 +13,6 @@ TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::
|
||||||
: Terrain::World(parent, compileRoot, resourceSystem, ico, storage, nodeMask, preCompileMask)
|
: Terrain::World(parent, compileRoot, resourceSystem, ico, storage, nodeMask, preCompileMask)
|
||||||
, mNumSplits(4)
|
, mNumSplits(4)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Material> material (new osg::Material);
|
|
||||||
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
|
|
||||||
mTerrainRoot->getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TerrainGrid::~TerrainGrid()
|
TerrainGrid::~TerrainGrid()
|
||||||
|
@ -89,9 +84,4 @@ void TerrainGrid::unloadCell(int x, int y)
|
||||||
mGrid.erase(it);
|
mGrid.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainGrid::updateTextureFiltering()
|
|
||||||
{
|
|
||||||
mTextureManager->updateTextureFiltering();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,6 @@ namespace Terrain
|
||||||
/// @note Not thread safe.
|
/// @note Not thread safe.
|
||||||
virtual void unloadCell(int x, int y);
|
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:
|
private:
|
||||||
osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
|
osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "world.hpp"
|
#include "world.hpp"
|
||||||
|
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
|
#include <osg/Material>
|
||||||
|
|
||||||
#include <osgUtil/IncrementalCompileOperation>
|
#include <osgUtil/IncrementalCompileOperation>
|
||||||
|
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
@ -23,6 +25,10 @@ World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSyst
|
||||||
mTerrainRoot = new osg::Group;
|
mTerrainRoot = new osg::Group;
|
||||||
mTerrainRoot->setNodeMask(nodeMask);
|
mTerrainRoot->setNodeMask(nodeMask);
|
||||||
mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN);
|
mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN);
|
||||||
|
osg::ref_ptr<osg::Material> material (new osg::Material);
|
||||||
|
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
|
||||||
|
mTerrainRoot->getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON);
|
||||||
|
|
||||||
mTerrainRoot->setName("Terrain Root");
|
mTerrainRoot->setName("Terrain Root");
|
||||||
|
|
||||||
osg::ref_ptr<CompositeMapRenderer> renderer (new CompositeMapRenderer);
|
osg::ref_ptr<CompositeMapRenderer> renderer (new CompositeMapRenderer);
|
||||||
|
@ -55,4 +61,9 @@ float World::getHeightAt(const osg::Vec3f &worldPos)
|
||||||
return mStorage->getHeightAt(worldPos);
|
return mStorage->getHeightAt(worldPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::updateTextureFiltering()
|
||||||
|
{
|
||||||
|
mTextureManager->updateTextureFiltering();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,9 @@ namespace Terrain
|
||||||
Storage* storage, int nodeMask, int preCompileMask);
|
Storage* storage, int nodeMask, int preCompileMask);
|
||||||
virtual ~World();
|
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);
|
float getHeightAt (const osg::Vec3f& worldPos);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue