mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 12:26:39 +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().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);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
compositor Water
 | 
					compositor UnderwaterNoMRT
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    technique
 | 
					    technique
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -13,9 +13,34 @@ compositor Water
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            pass render_quad
 | 
					            pass render_quad
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                material Water/Compositor
 | 
					                material Water/CompositorNoMRT
 | 
				
			||||||
                input 0 rt0
 | 
					                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
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ material Water
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
material Water/Compositor
 | 
					material Water/CompositorNoMRT
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    technique
 | 
					    technique
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -146,3 +146,50 @@ material Water/Compositor
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            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 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