mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 15:41:32 +00:00
Merge branch 'reflection-uniform' into 'master'
Added a uniform to indicate whether rendering is occurring in a reflection See merge request OpenMW/openmw!2340
This commit is contained in:
commit
525b904a44
2 changed files with 6 additions and 2 deletions
|
@ -173,6 +173,7 @@ namespace MWRender
|
||||||
stateset->addUniform(new osg::Uniform("far", 0.f));
|
stateset->addUniform(new osg::Uniform("far", 0.f));
|
||||||
stateset->addUniform(new osg::Uniform("skyBlendingStart", 0.f));
|
stateset->addUniform(new osg::Uniform("skyBlendingStart", 0.f));
|
||||||
stateset->addUniform(new osg::Uniform("screenRes", osg::Vec2f{}));
|
stateset->addUniform(new osg::Uniform("screenRes", osg::Vec2f{}));
|
||||||
|
stateset->addUniform(new osg::Uniform("isReflection", false));
|
||||||
if (mUsePlayerUniforms)
|
if (mUsePlayerUniforms)
|
||||||
{
|
{
|
||||||
stateset->addUniform(new osg::Uniform("windSpeed", 0.0f));
|
stateset->addUniform(new osg::Uniform("windSpeed", 0.0f));
|
||||||
|
|
|
@ -351,6 +351,9 @@ public:
|
||||||
camera->setName("ReflectionCamera");
|
camera->setName("ReflectionCamera");
|
||||||
camera->addCullCallback(new InheritViewPointCallback);
|
camera->addCullCallback(new InheritViewPointCallback);
|
||||||
|
|
||||||
|
// Inform the shader that we're in a reflection
|
||||||
|
camera->getOrCreateStateSet()->addUniform(new osg::Uniform("isReflection", true));
|
||||||
|
|
||||||
// XXX: should really flip the FrontFace on each renderable instead of forcing clockwise.
|
// XXX: should really flip the FrontFace on each renderable instead of forcing clockwise.
|
||||||
osg::ref_ptr<osg::FrontFace> frontFace(new osg::FrontFace);
|
osg::ref_ptr<osg::FrontFace> frontFace(new osg::FrontFace);
|
||||||
frontFace->setMode(osg::FrontFace::CLOCKWISE);
|
frontFace->setMode(osg::FrontFace::CLOCKWISE);
|
||||||
|
@ -474,7 +477,7 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
|
||||||
geom2->setNodeMask(Mask_SimpleWater);
|
geom2->setNodeMask(Mask_SimpleWater);
|
||||||
geom2->setName("Simple Water Geometry");
|
geom2->setName("Simple Water Geometry");
|
||||||
mWaterNode->addChild(geom2);
|
mWaterNode->addChild(geom2);
|
||||||
|
|
||||||
mSceneRoot->addChild(mWaterNode);
|
mSceneRoot->addChild(mWaterNode);
|
||||||
|
|
||||||
setHeight(mTop);
|
setHeight(mTop);
|
||||||
|
@ -701,7 +704,7 @@ void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, R
|
||||||
normalMap->setMaxAnisotropy(16);
|
normalMap->setMaxAnisotropy(16);
|
||||||
normalMap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
|
normalMap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
|
||||||
normalMap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
normalMap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
||||||
|
|
||||||
|
|
||||||
mRainIntensityUpdater = new RainIntensityUpdater();
|
mRainIntensityUpdater = new RainIntensityUpdater();
|
||||||
node->setUpdateCallback(mRainIntensityUpdater);
|
node->setUpdateCallback(mRainIntensityUpdater);
|
||||||
|
|
Loading…
Reference in a new issue