mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 04:45:32 +00:00
reversed sun and moon paths (sunrise at east)
This commit is contained in:
parent
8316a4c2ec
commit
456eb95209
7 changed files with 142 additions and 61 deletions
|
@ -61,8 +61,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", true);
|
||||
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbufferFinalizer");
|
||||
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
|
||||
// degrees around the x axis. This makes Z go upwards, and Y go into
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "water.hpp"
|
||||
#include <components/settings/settings.hpp>
|
||||
#include "sky.hpp"
|
||||
#include "renderingmanager.hpp"
|
||||
|
||||
using namespace Ogre;
|
||||
|
||||
|
@ -68,6 +69,8 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
|
|||
mReflectionTarget = rtt;
|
||||
}
|
||||
|
||||
mCompositorName = RenderingManager::useMRT() ? "Underwater" : "UnderwaterNoMRT";
|
||||
|
||||
createMaterial();
|
||||
mWater->setMaterial(mMaterial);
|
||||
}
|
||||
|
@ -118,7 +121,7 @@ void Water::checkUnderwater(float y)
|
|||
if ((mIsUnderwater && y > mTop) || !mWater->isVisible() || mCamera->getPolygonMode() != Ogre::PM_SOLID)
|
||||
{
|
||||
try {
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Water", false);
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, false);
|
||||
} catch(...) {}
|
||||
|
||||
// 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)
|
||||
{
|
||||
try {
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Water", true);
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, true);
|
||||
} catch(...) {}
|
||||
|
||||
// tell the shader we are underwater
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace MWRender {
|
|||
|
||||
SkyManager* mSky;
|
||||
|
||||
std::string mCompositorName;
|
||||
|
||||
void createMaterial();
|
||||
Ogre::MaterialPtr mMaterial;
|
||||
|
||||
|
|
|
@ -585,8 +585,8 @@ void WeatherManager::update(float duration)
|
|||
int facing = (mHour > 13.f) ? 1 : -1;
|
||||
|
||||
Vector3 final(
|
||||
(1-height)*facing,
|
||||
(1-height)*facing,
|
||||
-(1-height)*facing,
|
||||
-(1-height)*facing,
|
||||
height);
|
||||
mRendering->setSunDirection(final);
|
||||
|
||||
|
@ -606,13 +606,13 @@ void WeatherManager::update(float duration)
|
|||
float moonHeight = 1-std::abs((night-0.5)*2);
|
||||
int facing = (mHour > 0.f && mHour<12.f) ? 1 : -1;
|
||||
Vector3 masser(
|
||||
(1-moonHeight)*facing,
|
||||
(1-moonHeight)*facing,
|
||||
-(1-moonHeight)*facing,
|
||||
-(1-moonHeight)*facing,
|
||||
moonHeight);
|
||||
|
||||
Vector3 secunda(
|
||||
(1-moonHeight)*facing*0.8,
|
||||
(1-moonHeight)*facing*1.25,
|
||||
-(1-moonHeight)*facing*0.8,
|
||||
-(1-moonHeight)*facing*1.25,
|
||||
moonHeight);
|
||||
|
||||
mRendering->getSkyManager()->setMasserDirection(masser);
|
||||
|
|
|
@ -19,9 +19,9 @@ void main_vp
|
|||
oDepth = oPos.z;
|
||||
|
||||
float4x4 scalemat = float4x4( 0.5, 0, 0, 0.5,
|
||||
0, -0.5, 0, 0.5,
|
||||
0, 0, 0.5, 0.5,
|
||||
0, 0, 0, 1 );
|
||||
0, -0.5, 0, 0.5,
|
||||
0, 0, 0.5, 0.5,
|
||||
0, 0, 0, 1 );
|
||||
float4 texcoordProj = mul(scalemat, oPos);
|
||||
oScreenCoords = float3(texcoordProj.x, texcoordProj.y, texcoordProj.w);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
compositor Water
|
||||
compositor UnderwaterNoMRT
|
||||
{
|
||||
technique
|
||||
{
|
||||
|
@ -13,9 +13,34 @@ compositor Water
|
|||
|
||||
pass render_quad
|
||||
{
|
||||
material Water/Compositor
|
||||
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
|
||||
{
|
||||
// Start with clear output
|
||||
input none
|
||||
|
||||
pass render_quad
|
||||
{
|
||||
material Water/Compositor
|
||||
input 0 rt0
|
||||
input 3 scene 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
vertex_program Water/GlassVP cg
|
||||
{
|
||||
source GlassVP.cg
|
||||
entry_point glass_vp
|
||||
profiles vs_1_1 arbvp1
|
||||
source GlassVP.cg
|
||||
entry_point glass_vp
|
||||
profiles vs_1_1 arbvp1
|
||||
|
||||
default_params
|
||||
{
|
||||
param_named_auto worldViewProj worldviewproj_matrix
|
||||
}
|
||||
default_params
|
||||
{
|
||||
param_named_auto worldViewProj worldviewproj_matrix
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fragment_program Water/GlassFP cg
|
||||
{
|
||||
source GlassFP.cg
|
||||
entry_point main_ps
|
||||
profiles ps_2_0 arbfp1
|
||||
source GlassFP.cg
|
||||
entry_point main_ps
|
||||
profiles ps_2_0 arbfp1
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
depth_check off
|
||||
vertex_program_ref Water/GlassVP
|
||||
{
|
||||
param_named_auto timeVal time 0.25
|
||||
param_named scale float 0.1
|
||||
}
|
||||
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
|
||||
}
|
||||
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 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
|
||||
}
|
||||
}
|
||||
}
|
||||
texture_unit
|
||||
{
|
||||
texture WaterNormal2.tga 2d
|
||||
tex_coord_set 2
|
||||
//tex_address_mode clamp
|
||||
filtering linear linear linear
|
||||
}
|
||||
texture_unit
|
||||
{
|
||||
texture caustic_0.png 2d
|
||||
tex_coord_set 3
|
||||
//tex_address_mode clamp
|
||||
filtering linear linear linear
|
||||
}
|
||||
|
||||
texture_unit DepthMap
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue