reversed sun and moon paths (sunrise at east)

actorid
scrawl 13 years ago
parent 8316a4c2ec
commit 456eb95209

@ -61,8 +61,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", true); CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", true);
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbufferFinalizer"); CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbufferFinalizer");
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", true); CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", true);
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "Underwater");
}
else
{
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "UnderwaterNoMRT");
} }
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "Water");
// Turn the entire scene (represented by the 'root' node) -90 // Turn the entire scene (represented by the 'root' node) -90
// degrees around the x axis. This makes Z go upwards, and Y go into // degrees around the x axis. This makes Z go upwards, and Y go into

@ -1,6 +1,7 @@
#include "water.hpp" #include "water.hpp"
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "sky.hpp" #include "sky.hpp"
#include "renderingmanager.hpp"
using namespace Ogre; using namespace Ogre;
@ -68,6 +69,8 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
mReflectionTarget = rtt; mReflectionTarget = rtt;
} }
mCompositorName = RenderingManager::useMRT() ? "Underwater" : "UnderwaterNoMRT";
createMaterial(); createMaterial();
mWater->setMaterial(mMaterial); mWater->setMaterial(mMaterial);
} }
@ -118,7 +121,7 @@ void Water::checkUnderwater(float y)
if ((mIsUnderwater && y > mTop) || !mWater->isVisible() || mCamera->getPolygonMode() != Ogre::PM_SOLID) if ((mIsUnderwater && y > mTop) || !mWater->isVisible() || mCamera->getPolygonMode() != Ogre::PM_SOLID)
{ {
try { try {
CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Water", false); CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, false);
} catch(...) {} } catch(...) {}
// tell the shader we are not underwater // tell the shader we are not underwater
@ -137,7 +140,7 @@ void Water::checkUnderwater(float y)
if (!mIsUnderwater && y < mTop && mWater->isVisible() && mCamera->getPolygonMode() == Ogre::PM_SOLID) if (!mIsUnderwater && y < mTop && mWater->isVisible() && mCamera->getPolygonMode() == Ogre::PM_SOLID)
{ {
try { try {
CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Water", true); CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, true);
} catch(...) {} } catch(...) {}
// tell the shader we are underwater // tell the shader we are underwater

@ -34,6 +34,8 @@ namespace MWRender {
SkyManager* mSky; SkyManager* mSky;
std::string mCompositorName;
void createMaterial(); void createMaterial();
Ogre::MaterialPtr mMaterial; Ogre::MaterialPtr mMaterial;

@ -585,8 +585,8 @@ void WeatherManager::update(float duration)
int facing = (mHour > 13.f) ? 1 : -1; int facing = (mHour > 13.f) ? 1 : -1;
Vector3 final( Vector3 final(
(1-height)*facing, -(1-height)*facing,
(1-height)*facing, -(1-height)*facing,
height); height);
mRendering->setSunDirection(final); mRendering->setSunDirection(final);
@ -606,13 +606,13 @@ void WeatherManager::update(float duration)
float moonHeight = 1-std::abs((night-0.5)*2); float moonHeight = 1-std::abs((night-0.5)*2);
int facing = (mHour > 0.f && mHour<12.f) ? 1 : -1; int facing = (mHour > 0.f && mHour<12.f) ? 1 : -1;
Vector3 masser( Vector3 masser(
(1-moonHeight)*facing, -(1-moonHeight)*facing,
(1-moonHeight)*facing, -(1-moonHeight)*facing,
moonHeight); moonHeight);
Vector3 secunda( Vector3 secunda(
(1-moonHeight)*facing*0.8, -(1-moonHeight)*facing*0.8,
(1-moonHeight)*facing*1.25, -(1-moonHeight)*facing*1.25,
moonHeight); moonHeight);
mRendering->getSkyManager()->setMasserDirection(masser); mRendering->getSkyManager()->setMasserDirection(masser);

@ -19,9 +19,9 @@ void main_vp
oDepth = oPos.z; oDepth = oPos.z;
float4x4 scalemat = float4x4( 0.5, 0, 0, 0.5, float4x4 scalemat = float4x4( 0.5, 0, 0, 0.5,
0, -0.5, 0, 0.5, 0, -0.5, 0, 0.5,
0, 0, 0.5, 0.5, 0, 0, 0.5, 0.5,
0, 0, 0, 1 ); 0, 0, 0, 1 );
float4 texcoordProj = mul(scalemat, oPos); float4 texcoordProj = mul(scalemat, oPos);
oScreenCoords = float3(texcoordProj.x, texcoordProj.y, texcoordProj.w); oScreenCoords = float3(texcoordProj.x, texcoordProj.y, texcoordProj.w);

@ -1,4 +1,4 @@
compositor Water compositor UnderwaterNoMRT
{ {
technique technique
{ {
@ -6,6 +6,30 @@ compositor Water
target rt0 { input previous } target rt0 { input previous }
target_output
{
// Start with clear output
input none
pass render_quad
{
material Water/CompositorNoMRT
input 0 rt0
}
}
}
}
compositor Underwater
{
technique
{
texture_ref scene gbuffer mrt_output
texture rt0 target_width target_height PF_R8G8B8
target rt0 { input previous }
target_output target_output
{ {
// Start with clear output // Start with clear output
@ -15,7 +39,8 @@ compositor Water
{ {
material Water/Compositor material Water/Compositor
input 0 rt0 input 0 rt0
input 3 scene 1
} }
} }
} }
} }

@ -1,21 +1,21 @@
vertex_program Water/GlassVP cg vertex_program Water/GlassVP cg
{ {
source GlassVP.cg source GlassVP.cg
entry_point glass_vp entry_point glass_vp
profiles vs_1_1 arbvp1 profiles vs_1_1 arbvp1
default_params default_params
{ {
param_named_auto worldViewProj worldviewproj_matrix param_named_auto worldViewProj worldviewproj_matrix
} }
} }
fragment_program Water/GlassFP cg fragment_program Water/GlassFP cg
{ {
source GlassFP.cg source GlassFP.cg
entry_point main_ps entry_point main_ps
profiles ps_2_0 arbfp1 profiles ps_2_0 arbfp1
} }
vertex_program Water_VP cg vertex_program Water_VP cg
@ -104,45 +104,92 @@ material Water
} }
} }
material Water/CompositorNoMRT
{
technique
{
pass
{
depth_check off
vertex_program_ref Water/GlassVP
{
param_named_auto timeVal time 0.25
param_named scale float 0.1
}
fragment_program_ref Water/GlassFP
{
param_named tintColour float4 0 0.35 0.35 1
}
texture_unit RT
{
tex_coord_set 0
tex_address_mode clamp
filtering linear linear linear
}
texture_unit
{
texture WaterNormal2.tga 2d
tex_coord_set 1
//tex_address_mode clamp
filtering linear linear linear
}
texture_unit
{
texture caustic_0.png 2d
tex_coord_set 2
//tex_address_mode clamp
filtering linear linear linear
}
}
}
}
material Water/Compositor material Water/Compositor
{ {
technique technique
{ {
pass pass
{ {
depth_check off depth_check off
vertex_program_ref Water/GlassVP vertex_program_ref Water/GlassVP
{ {
param_named_auto timeVal time 0.25 param_named_auto timeVal time 0.25
param_named scale float 0.1 param_named scale float 0.1
} }
fragment_program_ref Water/GlassFP fragment_program_ref Water/GlassFP
{ {
param_named tintColour float4 0 0.35 0.35 1 param_named tintColour float4 0 0.35 0.35 1
} }
texture_unit RT texture_unit RT
{ {
tex_coord_set 0 tex_coord_set 0
tex_address_mode clamp tex_address_mode clamp
filtering linear linear linear filtering linear linear linear
} }
texture_unit texture_unit
{ {
texture WaterNormal2.tga 2d texture WaterNormal2.tga 2d
tex_coord_set 1 tex_coord_set 2
//tex_address_mode clamp //tex_address_mode clamp
filtering linear linear linear filtering linear linear linear
} }
texture_unit texture_unit
{ {
texture caustic_0.png 2d texture caustic_0.png 2d
tex_coord_set 2 tex_coord_set 3
//tex_address_mode clamp //tex_address_mode clamp
filtering linear linear linear filtering linear linear linear
} }
}
} texture_unit DepthMap
{
}
}
}
} }

Loading…
Cancel
Save