forked from mirror/openmw-tes3mp
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);
|
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 (Ogre::Root::getSingleton ().getRenderSystem ()->getName ().find("OpenGL") != std::string::npos);
|
||||||
return "hlsl";
|
|
||||||
else
|
|
||||||
return "glsl";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +238,12 @@ namespace MWGui
|
||||||
mReflectTerrainButton->setEnabled(false);
|
mReflectTerrainButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shaders == "off")
|
||||||
|
{
|
||||||
|
mUnderwaterButton->setEnabled (false);
|
||||||
|
mShadowsEnabledButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
mFullscreenButton->setCaptionWithReplacing(Settings::Manager::getBool("fullscreen", "Video") ? "#{sOn}" : "#{sOff}");
|
mFullscreenButton->setCaptionWithReplacing(Settings::Manager::getBool("fullscreen", "Video") ? "#{sOn}" : "#{sOff}");
|
||||||
mVSyncButton->setCaptionWithReplacing(Settings::Manager::getBool("vsync", "Video") ? "#{sOn}": "#{sOff}");
|
mVSyncButton->setCaptionWithReplacing(Settings::Manager::getBool("vsync", "Video") ? "#{sOn}": "#{sOff}");
|
||||||
mFPSButton->setCaptionWithReplacing(fpsLevelToStr(Settings::Manager::getInt("fps", "HUD")));
|
mFPSButton->setCaptionWithReplacing(fpsLevelToStr(Settings::Manager::getInt("fps", "HUD")));
|
||||||
|
@ -389,8 +392,13 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
std::string val = static_cast<MyGUI::Button*>(_sender)->getCaption();
|
std::string val = static_cast<MyGUI::Button*>(_sender)->getCaption();
|
||||||
if (val == "off")
|
if (val == "off")
|
||||||
val = hlslGlsl();
|
{
|
||||||
else if (val == hlslGlsl())
|
if (hasGLSL ())
|
||||||
|
val = "glsl";
|
||||||
|
else
|
||||||
|
val = "cg";
|
||||||
|
}
|
||||||
|
else if (val == "glsl")
|
||||||
val = "cg";
|
val = "cg";
|
||||||
else
|
else
|
||||||
val = "off";
|
val = "off";
|
||||||
|
@ -407,7 +415,9 @@ namespace MWGui
|
||||||
mReflectObjectsButton->setEnabled(false);
|
mReflectObjectsButton->setEnabled(false);
|
||||||
mReflectActorsButton->setEnabled(false);
|
mReflectActorsButton->setEnabled(false);
|
||||||
mReflectTerrainButton->setEnabled(false);
|
mReflectTerrainButton->setEnabled(false);
|
||||||
|
mUnderwaterButton->setEnabled(false);
|
||||||
Settings::Manager::setBool("shader", "Water", false);
|
Settings::Manager::setBool("shader", "Water", false);
|
||||||
|
Settings::Manager::setBool("underwater effect", "Water", false);
|
||||||
|
|
||||||
// shadows not supported
|
// shadows not supported
|
||||||
mShadowsEnabledButton->setEnabled(false);
|
mShadowsEnabledButton->setEnabled(false);
|
||||||
|
@ -416,15 +426,19 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// re-enable
|
|
||||||
mWaterShaderButton->setEnabled(true);
|
|
||||||
mReflectObjectsButton->setEnabled(true);
|
|
||||||
mReflectActorsButton->setEnabled(true);
|
|
||||||
mReflectTerrainButton->setEnabled(true);
|
|
||||||
mShadowsEnabledButton->setEnabled(true);
|
|
||||||
|
|
||||||
Settings::Manager::setBool("shaders", "Objects", true);
|
Settings::Manager::setBool("shaders", "Objects", true);
|
||||||
Settings::Manager::setString("shader mode", "General", val);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
|
|
|
@ -46,7 +46,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
if (Settings::Manager::getString("shader mode", "General") == "")
|
if (Settings::Manager::getString("shader mode", "General") == "")
|
||||||
{
|
{
|
||||||
if (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") == std::string::npos)
|
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
|
else
|
||||||
Settings::Manager::setString("shader mode", "General", "glsl");
|
Settings::Manager::setString("shader mode", "General", "glsl");
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
if (!Settings::Manager::getBool("shaders", "Objects"))
|
if (!Settings::Manager::getBool("shaders", "Objects"))
|
||||||
Settings::Manager::setBool("enabled", "Shadows", false);
|
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 ("mrt_output", useMRT() ? "true" : "false");
|
||||||
sh::Factory::getInstance ().setGlobalSetting ("fog", "true");
|
sh::Factory::getInstance ().setGlobalSetting ("fog", "true");
|
||||||
sh::Factory::getInstance ().setGlobalSetting ("lighting", "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 ("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 ("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();
|
applyCompositors();
|
||||||
|
|
||||||
|
@ -269,7 +275,8 @@ void RenderingManager::update (float duration){
|
||||||
|
|
||||||
checkUnderwater();
|
checkUnderwater();
|
||||||
|
|
||||||
mWater->update(duration);
|
if (mWater)
|
||||||
|
mWater->update(duration);
|
||||||
}
|
}
|
||||||
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
|
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
|
||||||
if(store->cell->data.flags & store->cell->HasWater
|
if(store->cell->data.flags & store->cell->HasWater
|
||||||
|
|
|
@ -291,6 +291,18 @@ void SkyManager::create()
|
||||||
|
|
||||||
sh::Factory::getInstance().setSharedParameter ("cloudBlendFactor",
|
sh::Factory::getInstance().setSharedParameter ("cloudBlendFactor",
|
||||||
sh::makeProperty<sh::FloatValue>(new sh::FloatValue(0)));
|
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
|
// Create light used for thunderstorm
|
||||||
mLightning = mSceneMgr->createLight();
|
mLightning = mSceneMgr->createLight();
|
||||||
|
|
|
@ -37,10 +37,6 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
|
||||||
{
|
{
|
||||||
mSky = rend->getSkyManager();
|
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");
|
mMaterial = MaterialManager::getSingleton().getByName("Water");
|
||||||
|
|
||||||
mTop = cell->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 shTexture2D sampler2D
|
||||||
#define shSample(tex, coord) tex2D(tex, coord)
|
#define shSample(tex, coord) tex2D(tex, coord)
|
||||||
|
|
|
@ -10,6 +10,6 @@ shader_set openmw_objects_fragment
|
||||||
{
|
{
|
||||||
source objects.shader
|
source objects.shader
|
||||||
type fragment
|
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
|
profiles_hlsl ps_2_0
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
|
|
||||||
|
#define FIXED_BIAS 0.005
|
||||||
|
|
||||||
float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
|
float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
|
||||||
{
|
{
|
||||||
shadowMapPos /= shadowMapPos.w;
|
shadowMapPos /= shadowMapPos.w;
|
||||||
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
float3 o = float3(offset.xy, -offset.x) * 0.3;
|
||||||
//float3 o = float3(0,0,0);
|
//float3 o = float3(0,0,0);
|
||||||
float c = (shadowMapPos.z <= shSample(shadowMap, shadowMapPos.xy - o.xy).r) ? 1 : 0; // top left
|
float c = (shadowMapPos.z <= FIXED_BIAS + 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 <= FIXED_BIAS + 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 <= FIXED_BIAS + 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
|
c += (shadowMapPos.z <= FIXED_BIAS + shSample(shadowMap, shadowMapPos.xy - o.zy).r) ? 1 : 0; // top right
|
||||||
return c / 4;
|
return c / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ shader_set terrain_fragment
|
||||||
{
|
{
|
||||||
source terrain.shader
|
source terrain.shader
|
||||||
type fragment
|
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
|
profiles_hlsl ps_2_0
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,10 +189,10 @@
|
||||||
|
|
||||||
</Widget>
|
</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)"/>
|
<Property key="Caption" value="Underwater effects (caustics, fog)"/>
|
||||||
</Widget>
|
</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>
|
||||||
|
|
||||||
<Widget type="TabItem" skin="" position="4 28 344 272">
|
<Widget type="TabItem" skin="" position="4 28 344 272">
|
||||||
|
|
Loading…
Reference in a new issue