WaterFilter now use the built in global uniform ViewProjectionMatrixInverse instead of a custome material parameter

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10751 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent afa9376b26
commit b20905f08d
  1. 4
      engine/src/core-effects/Common/MatDefs/Water/Water.frag
  2. 2
      engine/src/core-effects/Common/MatDefs/Water/Water.j3md
  3. 4
      engine/src/core-effects/Common/MatDefs/Water/Water15.frag
  4. 2
      engine/src/core-effects/com/jme3/water/WaterFilter.java

@ -12,7 +12,7 @@ uniform sampler2D m_FoamMap;
uniform sampler2D m_CausticsMap;
uniform sampler2D m_ReflectionMap;
uniform mat4 m_ViewProjectionMatrixInverse;
uniform mat4 g_ViewProjectionMatrixInverse;
uniform mat4 m_TextureProjMatrix;
uniform vec3 m_CameraPosition;
@ -107,7 +107,7 @@ vec3 saturate(in vec3 val){
vec3 getPosition(in float depth, in vec2 uv){
vec4 pos = vec4(uv, depth, 1.0) * 2.0 - 1.0;
pos = m_ViewProjectionMatrixInverse * pos;
pos = g_ViewProjectionMatrixInverse * pos;
return pos.xyz / pos.w;
}

@ -14,7 +14,6 @@ MaterialDef Advanced Water {
Float Time
Vector3 frustumCorner
Matrix4 TextureProjMatrix
Matrix4 ViewProjectionMatrixInverse
Float WaterHeight
Vector3 LightDir
Float WaterTransparency
@ -56,6 +55,7 @@ MaterialDef Advanced Water {
FragmentShader GLSL150 : Common/MatDefs/Water/Water15.frag
WorldParameters {
ViewProjectionMatrixInverse
}
Defines {

@ -16,7 +16,7 @@ uniform sampler2D m_FoamMap;
uniform sampler2D m_CausticsMap;
uniform sampler2D m_ReflectionMap;
uniform mat4 m_ViewProjectionMatrixInverse;
uniform mat4 g_ViewProjectionMatrixInverse;
uniform mat4 m_TextureProjMatrix;
uniform vec3 m_CameraPosition;
@ -104,7 +104,7 @@ vec3 saturate(in vec3 val){
vec3 getPosition(in float depth, in vec2 uv){
vec4 pos = vec4(uv, depth, 1.0) * 2.0 - 1.0;
pos = m_ViewProjectionMatrixInverse * pos;
pos = g_ViewProjectionMatrixInverse * pos;
return pos.xyz / pos.w;
}

@ -151,8 +151,6 @@ public class WaterFilter extends Filter {
biasMatrix.mult(sceneCam.getViewProjectionMatrix(), textureProjMatrix);
material.setMatrix4("TextureProjMatrix", textureProjMatrix);
material.setVector3("CameraPosition", sceneCam.getLocation());
material.setMatrix4("ViewProjectionMatrixInverse", sceneCam.getViewProjectionMatrix().invert());
material.setFloat("WaterHeight", waterHeight);
//update reflection cam

Loading…
Cancel
Save