diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 4f8ad77c9..599783e42 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -75,12 +75,9 @@ namespace return boost::lexical_cast(xaspect) + " : " + boost::lexical_cast(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); } } @@ -389,8 +386,13 @@ namespace MWGui { std::string val = static_cast(_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"; diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index b535cb6ae..bcf9f2101 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -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"); } @@ -113,6 +113,10 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const sh::Factory::getInstance ().setSharedParameter ("viewportBackground", sh::makeProperty (new sh::Vector3(0,0,0))); sh::Factory::getInstance ().setSharedParameter ("waterEnabled", sh::makeProperty (new sh::FloatValue(0.0))); + sh::Factory::getInstance ().setSharedParameter ("waterLevel", sh::makeProperty(new sh::FloatValue(0))); + sh::Factory::getInstance ().setSharedParameter ("waterTimer", sh::makeProperty(new sh::FloatValue(0))); + sh::Factory::getInstance ().setSharedParameter ("windDir_windSpeed", sh::makeProperty(new sh::Vector3(0.5, -0.8, 0.2))); + sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty(new sh::Vector2(1, 0.6))); applyCompositors(); @@ -269,7 +273,8 @@ void RenderingManager::update (float duration){ checkUnderwater(); - mWater->update(duration); + if (mWater) + mWater->update(duration); } void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){ if(store->cell->data.flags & store->cell->HasWater diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 2a2df7943..aeefb95d1 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -297,6 +297,7 @@ void SkyManager::create() sh::makeProperty(new sh::FloatValue(0))); sh::Factory::getInstance().setSharedParameter ("nightFade", sh::makeProperty(new sh::FloatValue(0))); + sh::Factory::getInstance().setSharedParameter ("atmosphereColour", sh::makeProperty(new sh::Vector4(0,0,0,1))); sh::Factory::getInstance().setTextureAlias ("cloud_texture_1", ""); sh::Factory::getInstance().setTextureAlias ("cloud_texture_2", ""); diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index 3aff334d1..92fc97b3b 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -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(new sh::Vector3(0.5, -0.8, 0.2))); - sh::Factory::getInstance ().setSharedParameter ("waterTimer", sh::makeProperty(new sh::FloatValue(0))); - sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty(new sh::Vector2(1, 0.6))); - mMaterial = MaterialManager::getSingleton().getByName("Water"); mTop = cell->water; diff --git a/files/materials/core.h b/files/materials/core.h index 306073a77..6e27d349c 100644 --- a/files/materials/core.h +++ b/files/materials/core.h @@ -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) diff --git a/files/materials/objects.shaderset b/files/materials/objects.shaderset index e84368a5b..ccb975fe9 100644 --- a/files/materials/objects.shaderset +++ b/files/materials/objects.shaderset @@ -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 } diff --git a/files/materials/terrain.shaderset b/files/materials/terrain.shaderset index 4132b8e9c..be8ecd7d8 100644 --- a/files/materials/terrain.shaderset +++ b/files/materials/terrain.shaderset @@ -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 }