forked from mirror/openmw-tes3mp
Some cleanup
This commit is contained in:
parent
51fb9e67cd
commit
fe9e6a732c
6 changed files with 6 additions and 300 deletions
|
@ -40,14 +40,12 @@ namespace MWRender {
|
|||
|
||||
Water::~Water() {
|
||||
Ogre::MeshManager::getSingleton().remove("water");
|
||||
//mCamera->removeListener(this);
|
||||
|
||||
mWaterNode->detachObject(mWater);
|
||||
mSceneManager->destroyEntity(mWater);
|
||||
mSceneManager->destroySceneNode(mWaterNode);
|
||||
|
||||
//Ogre::TextureManager::getSingleton().remove("refraction");
|
||||
//Ogre::TextureManager::getSingleton().remove("reflection");
|
||||
|
||||
Ogre::CompositorManager::getSingleton().removeCompositorChain(mViewport);
|
||||
}
|
||||
|
||||
|
@ -63,23 +61,6 @@ namespace MWRender {
|
|||
}
|
||||
|
||||
|
||||
void Water::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) {
|
||||
mWater->setVisible(false);
|
||||
|
||||
if (evt.source == mReflectionTarget) {
|
||||
mCamera->enableReflection(mWaterPlane);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void Water::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) {
|
||||
mWater->setVisible(true);
|
||||
|
||||
if (evt.source == mReflectionTarget) {
|
||||
mCamera->disableReflection();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void Water::checkUnderwater(float y) {
|
||||
|
||||
|
@ -101,21 +82,7 @@ namespace MWRender {
|
|||
}
|
||||
|
||||
|
||||
void Water::cameraPreRenderScene(Ogre::Camera *cam) {
|
||||
Ogre::Vector3 pos = cam->getPosition();
|
||||
|
||||
if (pos != mOldCameraPos) {
|
||||
mWaterNode->setPosition(pos.x, 0, pos.z);
|
||||
|
||||
mOldCameraPos = pos;
|
||||
}
|
||||
}
|
||||
|
||||
void Water::cameraPostRenderScene(Ogre::Camera *cam) {
|
||||
}
|
||||
|
||||
void Water::cameraDestroyed(Ogre::Camera *cam) {
|
||||
}
|
||||
|
||||
Ogre::Vector3 Water::getSceneNodeCoordinates(int gridX, int gridY){
|
||||
Ogre::Vector3 out = Ogre::Vector3(gridX * CELL_SIZE + (CELL_SIZE / 2), mTop, -gridY * CELL_SIZE - (CELL_SIZE / 2));
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ namespace MWRender {
|
|||
Ogre::SceneManager *mSceneManager;
|
||||
Ogre::Viewport *mViewport;
|
||||
|
||||
Ogre::RenderTarget *mRefractionTarget;
|
||||
Ogre::RenderTarget *mReflectionTarget;
|
||||
|
||||
|
||||
Ogre::Plane mWaterPlane;
|
||||
Ogre::SceneNode *mWaterNode;
|
||||
|
@ -26,12 +25,7 @@ namespace MWRender {
|
|||
|
||||
|
||||
|
||||
void preRenderTargetUpdate(const Ogre::RenderTargetEvent&);
|
||||
void postRenderTargetUpdate(const Ogre::RenderTargetEvent&);
|
||||
|
||||
void cameraPreRenderScene(Ogre::Camera *cam);
|
||||
void cameraPostRenderScene(Ogre::Camera *cam);
|
||||
void cameraDestroyed(Ogre::Camera *cam);
|
||||
|
||||
Ogre::Vector3 getSceneNodeCoordinates(int gridX, int gridY);
|
||||
|
||||
public:
|
||||
|
|
|
@ -8,5 +8,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/GlassVP.cg "${OpenMW_BINARY_DIR
|
|||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/perlinvolume.dds "${OpenMW_BINARY_DIR}/resources/water/perlinvolume.dds" COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/Water02.jpg "${OpenMW_BINARY_DIR}/resources/water/Water02.jpg" COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/water.compositor "${OpenMW_BINARY_DIR}/resources/water/water.compositor" COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/water.material "${OpenMW_BINARY_DIR}/resources/water/water.material" COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/waves2.dds "${OpenMW_BINARY_DIR}/resources/water/waves2.dds" COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/Examples-Water.material "${OpenMW_BINARY_DIR}/resources/water/Examples-Water.material" COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/water/WaterNormal1.tga "${OpenMW_BINARY_DIR}/resources/water/WaterNormal1.tga" COPYONLY)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 288 KiB |
|
@ -1,217 +0,0 @@
|
|||
// Derived from ogre samples
|
||||
|
||||
|
||||
vertex_program Water/GlassVP cg
|
||||
{
|
||||
source GlassVP.cg
|
||||
entry_point glass_vp
|
||||
profiles vs_1_1 arbvp1
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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 WaterNormal1.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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
vertex_program Water/RefractReflectVP cg
|
||||
{
|
||||
source Example_Fresnel.cg
|
||||
entry_point main_vp
|
||||
profiles vs_1_1 arbvp1
|
||||
}
|
||||
vertex_program Water/RefractReflectVPold cg
|
||||
{
|
||||
source Example_Fresnel.cg
|
||||
entry_point main_vp_old
|
||||
profiles vs_1_1 arbvp1
|
||||
}
|
||||
|
||||
fragment_program Water/RefractReflectFP cg
|
||||
{
|
||||
source Example_Fresnel.cg
|
||||
entry_point main_fp
|
||||
// sorry, ps_1_1 and fp20 can't do this
|
||||
profiles ps_2_0 arbfp1
|
||||
}
|
||||
|
||||
fragment_program Water/RefractReflectPS asm
|
||||
{
|
||||
source Example_FresnelPS.asm
|
||||
// sorry, only for ps_1_4 :)
|
||||
syntax ps_1_4
|
||||
|
||||
}
|
||||
|
||||
|
||||
material Water/ReflectionRefraction
|
||||
{
|
||||
// ps_2_0 / arbfp1
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
|
||||
vertex_program_ref Water/RefractReflectVP
|
||||
{
|
||||
param_named_auto worldViewProjMatrix worldviewproj_matrix
|
||||
param_named_auto eyePosition camera_position_object_space
|
||||
param_named_auto timeVal time 0.15
|
||||
param_named scroll float 1
|
||||
param_named scale float 1
|
||||
param_named noise float 1
|
||||
// scroll and noisePos will need updating per frame
|
||||
}
|
||||
fragment_program_ref Water/RefractReflectFP
|
||||
{
|
||||
param_named fresnelBias float -0.1
|
||||
param_named fresnelScale float 0.8
|
||||
param_named fresnelPower float 20
|
||||
param_named tintColour float4 0 0.15 0.15 1
|
||||
param_named noiseScale float 0.05
|
||||
}
|
||||
// Water
|
||||
texture_unit
|
||||
{
|
||||
// Water texture
|
||||
texture Water02.jpg
|
||||
// min / mag filtering, no mip
|
||||
filtering linear linear none
|
||||
}
|
||||
// Noise
|
||||
texture_unit
|
||||
{
|
||||
// Perlin noise volume
|
||||
texture waves2.dds
|
||||
// min / mag filtering, no mip
|
||||
filtering linear linear none
|
||||
}
|
||||
// Reflection
|
||||
texture_unit
|
||||
{
|
||||
// Will be filled in at runtime
|
||||
texture reflection
|
||||
tex_address_mode clamp
|
||||
}
|
||||
// Refraction
|
||||
texture_unit
|
||||
{
|
||||
// Will be filled in at runtime
|
||||
texture refraction
|
||||
tex_address_mode clamp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ATI 8500 +
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program_ref Water/RefractReflectVPold
|
||||
{
|
||||
param_named_auto worldViewProjMatrix worldviewproj_matrix
|
||||
param_named_auto eyePosition camera_position_object_space
|
||||
param_named fresnelBias float -0.3
|
||||
param_named fresnelScale float 1.4
|
||||
param_named fresnelPower float 8
|
||||
param_named_auto timeVal time_0_1 20
|
||||
param_named scroll float 1
|
||||
param_named scale float 4
|
||||
param_named noise float 1
|
||||
// scroll and noisePos will need updating per frame
|
||||
}
|
||||
|
||||
// for ATI RADEON 8500 - 9200
|
||||
fragment_program_ref Water/RefractReflectPS
|
||||
{
|
||||
// distortionRange
|
||||
param_indexed 0 float 0.025
|
||||
// tintColour
|
||||
param_indexed 1 float4 0.05 0.12 0.15 1
|
||||
}
|
||||
|
||||
// Noise
|
||||
texture_unit
|
||||
{
|
||||
// Perlin noise volume
|
||||
texture perlinvolume.dds 3d
|
||||
// min / mag filtering, no mip
|
||||
filtering linear linear none
|
||||
}
|
||||
// Reflection
|
||||
texture_unit
|
||||
{
|
||||
// Will be filled in at runtime
|
||||
texture Reflection
|
||||
tex_address_mode clamp
|
||||
}
|
||||
// Refraction
|
||||
texture_unit
|
||||
{
|
||||
// Will be filled in at runtime
|
||||
texture Refraction
|
||||
tex_address_mode clamp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
void main( in float4 fresnel : COLOR0,
|
||||
in float4 inTex0 : TEXCOORD0,
|
||||
in float4 inTex1 : TEXCOORD1,
|
||||
in float4 inTex2 : TEXCOORD2,
|
||||
in float4 inTex3 : TEXCOORD3,
|
||||
in float4 inTex4 : COLOR1,
|
||||
in float4 inTex5 : BCOL1,
|
||||
out float4 outCol : COLOR,
|
||||
uniform float4 matrix,
|
||||
uniform sampler2D offsetTexture : texunit0,
|
||||
uniform sampler2D reflexTexture : texunit1,
|
||||
uniform sampler2D refractTexture : texunit2,
|
||||
uniform sampler2D depthTexture : texunit3)
|
||||
{
|
||||
float4 norm = tex2D(offsetTexture, inTex0.xy);
|
||||
float4 refr = tex2D(depthTexture, inTex3.xy);
|
||||
|
||||
float4 norm2 = tex2D(offsetTexture, inTex0.xy/10.0f);
|
||||
|
||||
float4 projCoord = inTex1 / inTex1.w;
|
||||
projCoord = (projCoord + 1.0) * 0.5;
|
||||
projCoord += norm * 0.02;
|
||||
projCoord = clamp(projCoord, 0.001, 0.999);
|
||||
|
||||
float4 reflexe = tex2D(reflexTexture, projCoord.xy);
|
||||
float4 refrakce = tex2D(refractTexture, projCoord.xy);
|
||||
|
||||
float4 odrazy = reflexe*(0.7+0.3*refr);
|
||||
|
||||
reflexe = (float4(0,0.4,0.4,1.0) + reflexe*0.5);
|
||||
|
||||
outCol = lerp(refrakce, reflexe, fresnel.r)-refr*0.08;
|
||||
|
||||
//outCol = lerp(refrakce, reflexe, fresnel.r);
|
||||
|
||||
// outCol = norm;
|
||||
|
||||
outCol.a = 1;
|
||||
}
|
Loading…
Reference in a new issue