diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index fb2bfb3c5..b3457a5fa 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -450,3 +450,18 @@ void Objects::update(const float dt) it = mLights.erase(it); } } + +void Objects::rebuildStaticGeometry() +{ + for (std::map::iterator it = mStaticGeometry.begin(); it != mStaticGeometry.end(); ++it) + { + it->second->destroy(); + it->second->build(); + } + + for (std::map::iterator it = mStaticGeometrySmall.begin(); it != mStaticGeometrySmall.end(); ++it) + { + it->second->destroy(); + it->second->build(); + } +} diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index e240b11c9..443f25ecf 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -93,6 +93,8 @@ public: void removeCell(MWWorld::CellStore* store); void buildStaticGeometry(MWWorld::CellStore &cell); void setMwRoot(Ogre::SceneNode* root); + + void rebuildStaticGeometry(); }; } #endif diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 5d9395460..fa20cd48d 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -81,12 +81,14 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const //mRendering.getScene()->setCameraRelativeRendering(true); // disable unsupported effects - const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities(); + //const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities(); if (!waterShaderSupported()) Settings::Manager::setBool("shader", "Water", false); if (!Settings::Manager::getBool("shaders", "Objects")) Settings::Manager::setBool("enabled", "Shadows", false); + sh::Factory::getInstance ().setGlobalSetting ("mrt_output", useMRT() ? "true" : "false"); + applyCompositors(); // Turn the entire scene (represented by the 'root' node) -90 @@ -614,6 +616,8 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec else if (it->second == "shader" && it->first == "Water") { applyCompositors(); + sh::Factory::getInstance ().setGlobalSetting ("mrt_output", useMRT() ? "true" : "false"); + mObjects.rebuildStaticGeometry (); } } diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index f32883fdd..f79ab6116 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -631,18 +631,9 @@ void SkyManager::create() // Make a unique "modifiable" copy of the materials to be sure //mCloudMaterial = mCloudMaterial->clone("Clouds"); //clouds_ent->getSubEntity(0)->setMaterial(mCloudMaterial); - //mAtmosphereMaterial = mAtmosphereMaterial->clone("Atmosphere"); - //atmosphere_ent->getSubEntity(0)->setMaterial(mAtmosphereMaterial); - /* - - mAtmosphereMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1.0, 1.0, 1.0); - mAtmosphereMaterial->getTechnique(0)->getPass(0)->setDiffuse(0.0, 0.0, 0.0, 0.0); - mAtmosphereMaterial->getTechnique(0)->getPass(0)->setAmbient(0.0, 0.0, 0.0); mCloudMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1.0, 1.0, 1.0); mCloudMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); - mAtmosphereMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); - mAtmosphereMaterial->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA); mCloudMaterial->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA); mCloudMaterial->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); diff --git a/extern/shiny b/extern/shiny index b3cfd41df..27a128c41 160000 --- a/extern/shiny +++ b/extern/shiny @@ -1 +1 @@ -Subproject commit b3cfd41dff2758e268ce16f366b7e7857eee80ea +Subproject commit 27a128c414e2f92d6bcda379b9c9df04e69b7472 diff --git a/files/materials/atmosphere.shader b/files/materials/atmosphere.shader index 484381a1f..831ba1138 100644 --- a/files/materials/atmosphere.shader +++ b/files/materials/atmosphere.shader @@ -27,10 +27,10 @@ SH_START_PROGRAM { - shOutputColor(0) = colourPassthrough * atmosphereColour; + shOutputColour(0) = colourPassthrough * atmosphereColour; #if MRT - shOutputColor(1) = float4(1,1,1,1); + shOutputColour(1) = float4(1,1,1,1); #endif } diff --git a/files/materials/clouds.shader b/files/materials/clouds.shader index a772e3c5e..1a80a27dd 100644 --- a/files/materials/clouds.shader +++ b/files/materials/clouds.shader @@ -8,9 +8,12 @@ shUniform(float4x4 wvp) @shAutoConstant(wvp, worldviewproj_matrix) shInput(float2, uv0) shOutput(float2, UV) + shColourInput(float4) + shOutput(float4, colourPassthrough) SH_START_PROGRAM { + shOutputPosition = shMatrixMult(wvp, shInputPosition); UV = uv0; } @@ -28,10 +31,10 @@ SH_START_PROGRAM { - shOutputColor(0) = float4(1,1,1,materialDiffuse.a) * float4(materialEmissive.xyz, 1) * shSample(diffuseMap, UV); + shOutputColour(0) = float4(1,1,1,materialDiffuse.a) * float4(materialEmissive.xyz, 1) * shSample(diffuseMap, UV); #if MRT - shOutputColor(1) = float4(1,1,1,1); + shOutputColour(1) = float4(1,1,1,1); #endif } diff --git a/files/materials/core.h b/files/materials/core.h index 0ee95057f..b5d784dae 100644 --- a/files/materials/core.h +++ b/files/materials/core.h @@ -36,7 +36,7 @@ #ifdef SH_FRAGMENT_SHADER - #define shOutputColor(num) oColor##num + #define shOutputColour(num) oColor##num #define shDeclareMrtOutput(num) , out float4 oColor##num : COLOR##num @@ -75,7 +75,7 @@ #define shInputPosition vertex #define shOutputPosition gl_Position - #define shOutputColor(num) oColor##num + #define shOutputColour(num) oColor##num #define float4x4 mat4 diff --git a/files/materials/objects.shader b/files/materials/objects.shader index dd1b489d5..517845cb5 100644 --- a/files/materials/objects.shader +++ b/files/materials/objects.shader @@ -4,13 +4,13 @@ #define FOG @shPropertyBool(fog) -#define MRT @shPropertyNotBool(is_transparent) && @shPropertyBool(mrt_output) +#define MRT @shPropertyNotBool(is_transparent) && @shPropertyBool(mrt_output) && @shGlobalSettingBool(mrt_output) #define LIGHTING @shPropertyBool(lighting) #define SHADOWS LIGHTING && 0 #define SHADOWS_PSSM LIGHTING -#define SHADOWS 1 && LIGHTING +#define SHADOWS 0 && LIGHTING #define SHADOWS_PSSM 0 && LIGHTING #if FOG || MRT || SHADOWS_PSSM @@ -132,13 +132,13 @@ #if SHADOWS shInput(float4, lightSpacePos0) shSampler2D(shadowMap0) - shUniform(float2 invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, 0) + shUniform(float2 invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, 1) #endif #if SHADOWS_PSSM @shForeach(3) shInput(float4, lightSpacePos@shIterator) shSampler2D(shadowMap@shIterator) - shUniform(float2 invShadowmapSize@shIterator) @shAutoConstant(invShadowmapSize@shIterator, inverse_texture_size, @shIterator) + shUniform(float2 invShadowmapSize@shIterator) @shAutoConstant(invShadowmapSize@shIterator, inverse_texture_size, @shIterator(1)) @shEndForeach shUniform(float4 pssmSplitPoints) @shSharedParameter(pssmSplitPoints) #endif @@ -148,7 +148,7 @@ #endif SH_START_PROGRAM { - shOutputColor(0) = shSample(diffuseMap, UV); + shOutputColour(0) = shSample(diffuseMap, UV); #if LIGHTING float3 normal = normalize(normalPassthrough); @@ -194,24 +194,24 @@ ambient *= colorPassthrough.xyz; #endif - shOutputColor(0).xyz *= (ambient + diffuse + materialEmissive.xyz); + shOutputColour(0).xyz *= (ambient + diffuse + materialEmissive.xyz); #endif #if HAS_VERTEXCOLOR && !LIGHTING - shOutputColor(0).xyz *= colorPassthrough.xyz; + shOutputColour(0).xyz *= colorPassthrough.xyz; #endif #if FOG float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w); - shOutputColor(0).xyz = shLerp (shOutputColor(0).xyz, fogColor, fogValue); + shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue); #endif // prevent negative color output (for example with negative lights) - shOutputColor(0).xyz = max(shOutputColor(0).xyz, float3(0,0,0)); + shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0,0,0)); #if MRT - shOutputColor(1) = float4(depthPassthrough / far,1,1,1); + shOutputColour(1) = float4(depthPassthrough / far,1,1,1); #endif } diff --git a/files/materials/shadowcaster.mat b/files/materials/shadowcaster.mat index 7c11fddf6..5c5c8e088 100644 --- a/files/materials/shadowcaster.mat +++ b/files/materials/shadowcaster.mat @@ -1,6 +1,7 @@ material openmw_shadowcaster_default { create_configuration Default + allow_fixed_function false pass { fog_override true @@ -18,6 +19,7 @@ material openmw_shadowcaster_default material openmw_shadowcaster_noalpha { create_configuration Default + allow_fixed_function false pass { fog_override true diff --git a/files/materials/shadowcaster.shader b/files/materials/shadowcaster.shader index f772066a6..500207778 100644 --- a/files/materials/shadowcaster.shader +++ b/files/materials/shadowcaster.shader @@ -50,7 +50,7 @@ discard; #endif - shOutputColor(0) = float4(finalDepth, finalDepth, finalDepth, 1); + shOutputColour(0) = float4(finalDepth, finalDepth, finalDepth, 1); } #endif diff --git a/files/materials/sky.mat b/files/materials/sky.mat index c78570f7f..6465476dd 100644 --- a/files/materials/sky.mat +++ b/files/materials/sky.mat @@ -44,13 +44,13 @@ material openmw_clouds // second diffuse map is used for weather transitions texture_unit diffuseMap1 { - texture $diffuseMap1 + texture_alias cloud_texture_1 create_in_ffp true } texture_unit diffuseMap2 { - texture $diffuseMap2 + texture_alias cloud_texture_2 } } } diff --git a/files/materials/sun.shader b/files/materials/sun.shader index 811d45031..03ec7665c 100644 --- a/files/materials/sun.shader +++ b/files/materials/sun.shader @@ -29,10 +29,10 @@ SH_START_PROGRAM { - shOutputColor(0) = float4(1,1,1,materialDiffuse.a) * float4(materialEmissive.xyz, 1) * shSample(diffuseMap, UV); + shOutputColour(0) = float4(1,1,1,materialDiffuse.a) * float4(materialEmissive.xyz, 1) * shSample(diffuseMap, UV); #if MRT - shOutputColor(1) = float4(1,1,1,1); + shOutputColour(1) = float4(1,1,1,1); #endif }