Set the osg::Material on the terrain root node

move
scrawl 9 years ago
parent 6000e48bba
commit ca0e1fe0e0

@ -154,10 +154,6 @@ namespace Terrain
, mBlendmapScale(blendmapScale) , mBlendmapScale(blendmapScale)
, mLayerTileSize(layerTileSize) , mLayerTileSize(layerTileSize)
{ {
osg::ref_ptr<osg::Material> material (new osg::Material);
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON);
selectTechnique(0); selectTechnique(0);
} }

@ -3,6 +3,7 @@
#include <memory> #include <memory>
#include <osg/UserDataContainer> #include <osg/UserDataContainer>
#include <osg/Material>
#include <OpenThreads/ScopedLock> #include <OpenThreads/ScopedLock>
@ -56,6 +57,9 @@ TerrainGrid::TerrainGrid(osg::Group* parent, Resource::ResourceSystem* resourceS
, mCache((storage->getCellVertices()-1)/static_cast<float>(mNumSplits) + 1) , mCache((storage->getCellVertices()-1)/static_cast<float>(mNumSplits) + 1)
, mUnrefQueue(unrefQueue) , mUnrefQueue(unrefQueue)
{ {
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()

Loading…
Cancel
Save