Skip to content

Commit

Permalink
OpenGL: fixed static geometry normals and dynamic model normals, fixe…
Browse files Browse the repository at this point in the history
…d 'waterd' shader when gbuffer optimization is on
  • Loading branch information
SkyLoader committed Nov 9, 2018
1 parent 685e47d commit 5098bb9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
6 changes: 1 addition & 5 deletions res/gamedata/shaders/gl/deffer_base_bump.vs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ v2p_bumped _main( v_in I )
float3 N = unpack_bx4(I.Nh); // just scale (assume normal in the -.5f, .5f)
float3 T = unpack_bx4(I.T); //
float3 B = unpack_bx4(I.B); //
float3x3 xform = mul (float3x3(m_WV), float3x3(
T.x,B.x,N.x,
T.y,B.y,N.y,
T.z,B.z,N.z
));
float3x3 xform = mul (float3x3(m_WV), float3x3(T,B,N));
// The pixel shader operates on the bump-map in [0..1] range
// Remap this range in the matrix, anyway we are pixel-shader limited :)
// ...... [ 2 0 0 0]
Expand Down
6 changes: 1 addition & 5 deletions res/gamedata/shaders/gl/deffer_model_bump.vs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ v2p_bumped _main( v_model I )
float3 N = I.N; // just scale (assume normal in the -.5f, .5f)
float3 T = I.T; //
float3 B = I.B; //
float3x3 xform = mul (float3x3(m_WV), float3x3(
2*T.x,2*B.x,2*N.x,
2*T.y,2*B.y,2*N.y,
2*T.z,2*B.z,2*N.z
));
float3x3 xform = mul (float3x3(m_WV), float3x3(2.f*T,2.f*B,2.f*N));
// The pixel shader operates on the bump-map in [0..1] range
// Remap this range in the matrix, anyway we are pixel-shader limited :)
// ...... [ 2 0 0 0]
Expand Down
3 changes: 3 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_waterd.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

out vec4 SV_Target;
in vec4 gl_FragCoord;

struct v2p
{
Expand All @@ -9,6 +10,7 @@ struct v2p
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
float4 tctexgen; // TEXCOORD3;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
float4 hpos ; // SV_Position;
};

layout(location = TEXCOORD0) in float2 v2p_waterd_tbase ; // TEXCOORD0;
Expand All @@ -29,5 +31,6 @@ void main()
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
I.tctexgen = v2p_waterd_tctexgen;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
I.hpos = gl_FragCoord;
SV_Target = _main (I);
}

0 comments on commit 5098bb9

Please sign in to comment.