mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:23:51 +00:00
Merge remote branch 'zini/master' into nif-cleanup
Conflicts: apps/openmw/mwrender/sky.cpp
This commit is contained in:
commit
44975854e5
9 changed files with 64 additions and 29 deletions
|
@ -75,12 +75,9 @@ namespace
|
|||
return boost::lexical_cast<std::string>(xaspect) + " : " + boost::lexical_cast<std::string>(yaspect);
|
||||
}
|
||||
|
||||
std::string hlslGlsl ()
|
||||
bool hasGLSL ()
|
||||
{
|
||||
if (Ogre::Root::getSingleton ().getRenderSystem ()->getName ().find("OpenGL") == std::string::npos)
|
||||
return "hlsl";
|
||||
else
|
||||
return "glsl";
|
||||
return (Ogre::Root::getSingleton ().getRenderSystem ()->getName ().find("OpenGL") != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,6 +238,12 @@ namespace MWGui
|
|||
mReflectTerrainButton->setEnabled(false);
|
||||
}
|
||||
|
||||
if (shaders == "off")
|
||||
{
|
||||
mUnderwaterButton->setEnabled (false);
|
||||
mShadowsEnabledButton->setEnabled(false);
|
||||
}
|
||||
|
||||
mFullscreenButton->setCaptionWithReplacing(Settings::Manager::getBool("fullscreen", "Video") ? "#{sOn}" : "#{sOff}");
|
||||
mVSyncButton->setCaptionWithReplacing(Settings::Manager::getBool("vsync", "Video") ? "#{sOn}": "#{sOff}");
|
||||
mFPSButton->setCaptionWithReplacing(fpsLevelToStr(Settings::Manager::getInt("fps", "HUD")));
|
||||
|
@ -389,8 +392,13 @@ namespace MWGui
|
|||
{
|
||||
std::string val = static_cast<MyGUI::Button*>(_sender)->getCaption();
|
||||
if (val == "off")
|
||||
val = hlslGlsl();
|
||||
else if (val == hlslGlsl())
|
||||
{
|
||||
if (hasGLSL ())
|
||||
val = "glsl";
|
||||
else
|
||||
val = "cg";
|
||||
}
|
||||
else if (val == "glsl")
|
||||
val = "cg";
|
||||
else
|
||||
val = "off";
|
||||
|
@ -407,7 +415,9 @@ namespace MWGui
|
|||
mReflectObjectsButton->setEnabled(false);
|
||||
mReflectActorsButton->setEnabled(false);
|
||||
mReflectTerrainButton->setEnabled(false);
|
||||
mUnderwaterButton->setEnabled(false);
|
||||
Settings::Manager::setBool("shader", "Water", false);
|
||||
Settings::Manager::setBool("underwater effect", "Water", false);
|
||||
|
||||
// shadows not supported
|
||||
mShadowsEnabledButton->setEnabled(false);
|
||||
|
@ -416,15 +426,19 @@ namespace MWGui
|
|||
}
|
||||
else
|
||||
{
|
||||
Settings::Manager::setBool("shaders", "Objects", true);
|
||||
Settings::Manager::setString("shader mode", "General", val);
|
||||
|
||||
// re-enable
|
||||
if (MWRender::RenderingManager::waterShaderSupported())
|
||||
{
|
||||
mWaterShaderButton->setEnabled(true);
|
||||
mReflectObjectsButton->setEnabled(true);
|
||||
mReflectActorsButton->setEnabled(true);
|
||||
mReflectTerrainButton->setEnabled(true);
|
||||
}
|
||||
mUnderwaterButton->setEnabled(true);
|
||||
mShadowsEnabledButton->setEnabled(true);
|
||||
|
||||
Settings::Manager::setBool("shaders", "Objects", true);
|
||||
Settings::Manager::setString("shader mode", "General", val);
|
||||
}
|
||||
|
||||
apply();
|
||||
|
|
|
@ -46,7 +46,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
if (Settings::Manager::getString("shader mode", "General") == "")
|
||||
{
|
||||
if (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") == std::string::npos)
|
||||
Settings::Manager::setString("shader mode", "General", "hlsl");
|
||||
Settings::Manager::setString("shader mode", "General", "cg");
|
||||
else
|
||||
Settings::Manager::setString("shader mode", "General", "glsl");
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
if (!Settings::Manager::getBool("shaders", "Objects"))
|
||||
Settings::Manager::setBool("enabled", "Shadows", false);
|
||||
|
||||
sh::Factory::getInstance ().setShadersEnabled (Settings::Manager::getBool("shaders", "Objects"));
|
||||
|
||||
sh::Factory::getInstance ().setGlobalSetting ("mrt_output", useMRT() ? "true" : "false");
|
||||
sh::Factory::getInstance ().setGlobalSetting ("fog", "true");
|
||||
sh::Factory::getInstance ().setGlobalSetting ("lighting", "true");
|
||||
|
@ -113,6 +115,10 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
|
||||
sh::Factory::getInstance ().setSharedParameter ("viewportBackground", sh::makeProperty<sh::Vector3> (new sh::Vector3(0,0,0)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterEnabled", sh::makeProperty<sh::FloatValue> (new sh::FloatValue(0.0)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterLevel", sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterTimer", sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("windDir_windSpeed", sh::makeProperty<sh::Vector3>(new sh::Vector3(0.5, -0.8, 0.2)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(1, 0.6)));
|
||||
|
||||
applyCompositors();
|
||||
|
||||
|
@ -269,6 +275,7 @@ void RenderingManager::update (float duration){
|
|||
|
||||
checkUnderwater();
|
||||
|
||||
if (mWater)
|
||||
mWater->update(duration);
|
||||
}
|
||||
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
|
||||
|
|
|
@ -291,6 +291,18 @@ void SkyManager::create()
|
|||
|
||||
sh::Factory::getInstance().setSharedParameter ("cloudBlendFactor",
|
||||
sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
||||
sh::Factory::getInstance().setSharedParameter ("cloudOpacity",
|
||||
sh::makeProperty<sh::FloatValue>(new sh::FloatValue(1)));
|
||||
sh::Factory::getInstance().setSharedParameter ("cloudColour",
|
||||
sh::makeProperty<sh::Vector3>(new sh::Vector3(1,1,1)));
|
||||
sh::Factory::getInstance().setSharedParameter ("cloudAnimationTimer",
|
||||
sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
||||
sh::Factory::getInstance().setSharedParameter ("nightFade",
|
||||
sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
||||
sh::Factory::getInstance().setSharedParameter ("atmosphereColour", sh::makeProperty<sh::Vector4>(new sh::Vector4(0,0,0,1)));
|
||||
|
||||
sh::Factory::getInstance().setTextureAlias ("cloud_texture_1", "");
|
||||
sh::Factory::getInstance().setTextureAlias ("cloud_texture_2", "");
|
||||
|
||||
// Create light used for thunderstorm
|
||||
mLightning = mSceneMgr->createLight();
|
||||
|
|
|
@ -37,10 +37,6 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
|
|||
{
|
||||
mSky = rend->getSkyManager();
|
||||
|
||||
sh::Factory::getInstance ().setSharedParameter ("windDir_windSpeed", sh::makeProperty<sh::Vector3>(new sh::Vector3(0.5, -0.8, 0.2)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterTimer", sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(1, 0.6)));
|
||||
|
||||
mMaterial = MaterialManager::getSingleton().getByName("Water");
|
||||
|
||||
mTop = cell->water;
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#if SH_HLSL == 1 || SH_CG == 1
|
||||
#if SH_HLSL == 1
|
||||
#error "HLSL is unsupported"
|
||||
#endif
|
||||
|
||||
#if SH_CG == 1
|
||||
|
||||
#define shTexture2D sampler2D
|
||||
#define shSample(tex, coord) tex2D(tex, coord)
|
||||
|
|
|
@ -10,6 +10,6 @@ shader_set openmw_objects_fragment
|
|||
{
|
||||
source objects.shader
|
||||
type fragment
|
||||
profiles_cg ps_2_x ps_2_0 ps fp40 arbfp1
|
||||
profiles_cg ps_3_0 ps_2_x ps_2_0 fp40 arbfp1
|
||||
profiles_hlsl ps_2_0
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
|
||||
#define FIXED_BIAS 0.005
|
||||
|
||||
float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
|
||||
{
|
||||
shadowMapPos /= shadowMapPos.w;
|
||||
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
||||
//float3 o = float3(0,0,0);
|
||||
float c = (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1 : 0; // top left
|
||||
c += (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy + o.xy).r) ? 1 : 0; // bottom right
|
||||
c += (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy + o.zy).r) ? 1 : 0; // bottom left
|
||||
c += (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1 : 0; // top right
|
||||
float c = (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1 : 0; // top left
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.xy).r) ? 1 : 0; // bottom right
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy + o.zy).r) ? 1 : 0; // bottom left
|
||||
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1 : 0; // top right
|
||||
return c / 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ shader_set terrain_fragment
|
|||
{
|
||||
source terrain.shader
|
||||
type fragment
|
||||
profiles_cg ps_2_x ps_2_0 ps fp40 arbfp1
|
||||
profiles_cg ps_3_0 ps_2_x ps_2_0 fp40 arbfp1
|
||||
profiles_hlsl ps_2_0
|
||||
}
|
||||
|
|
|
@ -189,10 +189,10 @@
|
|||
|
||||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="42 200 120 24" align="Left Top">
|
||||
<Widget type="TextBox" skin="SandText" position="42 135 300 24" align="Left Top">
|
||||
<Property key="Caption" value="Underwater effects (caustics, fog)"/>
|
||||
</Widget>
|
||||
<Widget type="Button" skin="MW_Button" position="4 200 34 24" align="Left Top" name="UnderwaterButton"/>
|
||||
<Widget type="Button" skin="MW_Button" position="4 135 34 24" align="Left Top" name="UnderwaterButton"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="TabItem" skin="" position="4 28 344 272">
|
||||
|
|
Loading…
Reference in a new issue