From ca0e1fe0e00232d2c94ef02fe978b3468dcecc8b Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 19 Feb 2016 01:45:28 +0100 Subject: [PATCH] Set the osg::Material on the terrain root node --- components/terrain/material.cpp | 4 ---- components/terrain/terraingrid.cpp | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/terrain/material.cpp b/components/terrain/material.cpp index fe32fe543a..c1aef1f9df 100644 --- a/components/terrain/material.cpp +++ b/components/terrain/material.cpp @@ -154,10 +154,6 @@ namespace Terrain , mBlendmapScale(blendmapScale) , mLayerTileSize(layerTileSize) { - osg::ref_ptr material (new osg::Material); - material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); - getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON); - selectTechnique(0); } diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index ddbb2fe230..cbafe16777 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -3,6 +3,7 @@ #include #include +#include #include @@ -56,6 +57,9 @@ TerrainGrid::TerrainGrid(osg::Group* parent, Resource::ResourceSystem* resourceS , mCache((storage->getCellVertices()-1)/static_cast(mNumSplits) + 1) , mUnrefQueue(unrefQueue) { + osg::ref_ptr material (new osg::Material); + material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); + mTerrainRoot->getOrCreateStateSet()->setAttributeAndModes(material, osg::StateAttribute::ON); } TerrainGrid::~TerrainGrid()