diff --git a/components/terrain/material.cpp b/components/terrain/material.cpp index fe32fe543..c1aef1f9d 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 ddbb2fe23..cbafe1677 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()