forked from mirror/openmw-tes3mp
Use a shader if required to display the composite map
Fixes composited terrain not respecting the 'clamp lighting' setting.
This commit is contained in:
parent
7f5beb3172
commit
088d5604bf
2 changed files with 11 additions and 7 deletions
|
@ -201,12 +201,14 @@ osg::ref_ptr<osg::Node> ChunkManager::createChunk(float chunkSize, const osg::Ve
|
||||||
|
|
||||||
mCompositeMapRenderer->addCompositeMap(compositeMap.get(), false);
|
mCompositeMapRenderer->addCompositeMap(compositeMap.get(), false);
|
||||||
|
|
||||||
std::vector<osg::ref_ptr<osg::StateSet> > passes2;
|
|
||||||
passes2.push_back(new osg::StateSet);
|
|
||||||
passes2[0]->setTextureAttributeAndModes(0, compositeMap->mTexture, osg::StateAttribute::ON);
|
|
||||||
geometry->setPasses(passes2);
|
|
||||||
|
|
||||||
transform->getOrCreateUserDataContainer()->setUserData(compositeMap);
|
transform->getOrCreateUserDataContainer()->setUserData(compositeMap);
|
||||||
|
|
||||||
|
TextureLayer layer;
|
||||||
|
layer.mDiffuseMap = compositeMap->mTexture;
|
||||||
|
layer.mParallax = false;
|
||||||
|
layer.mSpecular = false;
|
||||||
|
geometry->setPasses(::Terrain::createPasses(mSceneManager->getForceShaders() || !mSceneManager->getClampLighting(), mSceneManager->getForcePerPixelLighting(),
|
||||||
|
mSceneManager->getClampLighting(), &mSceneManager->getShaderManager(), std::vector<TextureLayer>(1, layer), std::vector<osg::ref_ptr<osg::Texture2D> >(), 1.f, 1.f));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,7 @@ namespace Terrain
|
||||||
{
|
{
|
||||||
stateset->setTextureAttributeAndModes(texunit, it->mDiffuseMap);
|
stateset->setTextureAttributeAndModes(texunit, it->mDiffuseMap);
|
||||||
|
|
||||||
|
if (layerTileSize != 1.f)
|
||||||
stateset->setTextureAttributeAndModes(texunit, getLayerTexMat(layerTileSize), osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(texunit, getLayerTexMat(layerTileSize), osg::StateAttribute::ON);
|
||||||
|
|
||||||
stateset->addUniform(new osg::Uniform("diffuseMap", texunit));
|
stateset->addUniform(new osg::Uniform("diffuseMap", texunit));
|
||||||
|
@ -147,6 +148,7 @@ namespace Terrain
|
||||||
osg::ref_ptr<osg::Texture2D> tex = it->mDiffuseMap;
|
osg::ref_ptr<osg::Texture2D> tex = it->mDiffuseMap;
|
||||||
stateset->setTextureAttributeAndModes(texunit, tex.get());
|
stateset->setTextureAttributeAndModes(texunit, tex.get());
|
||||||
|
|
||||||
|
if (layerTileSize != 1.f)
|
||||||
stateset->setTextureAttributeAndModes(texunit, getLayerTexMat(layerTileSize), osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(texunit, getLayerTexMat(layerTileSize), osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue