Skip to content

Commit

Permalink
OpenGL: fixed tree normals - seems all normals look nice, fixed calcu…
Browse files Browse the repository at this point in the history
…lation of sky reflection on water
  • Loading branch information
SkyLoader committed Nov 9, 2018
1 parent ca1b93b commit 4ac5bb3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 1 addition & 5 deletions res/gamedata/shaders/gl/deffer_tree_bump.vs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ v2p_bumped _main (v_tree 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_xform_v), float3x3(
T.x,B.x,N.x,
T.y,B.y,N.y,
T.z,B.z,N.z
));
float3x3 xform = mul (float3x3(m_xform_v), 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 :)
Expand Down
6 changes: 6 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_waterd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

out vec4 SV_Target;
#ifdef GBUFFER_OPTIMIZATION
in vec4 gl_FragCoord;
#endif

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

layout(location = TEXCOORD0) in float2 v2p_waterd_tbase ; // TEXCOORD0;
Expand All @@ -31,6 +35,8 @@ 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)
#ifdef GBUFFER_OPTIMIZATION
I.hpos = gl_FragCoord;
#endif
SV_Target = _main (I);
}
Binary file modified res/gamedata/shaders/gl/water.ps
Binary file not shown.
8 changes: 4 additions & 4 deletions res/gamedata/shaders/gl/waterd.vs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ uniform float4x4 m_texgen;

v2p _main (v_vert v)
{
//v.N = unpack_D3DCOLOR(v.N);
//v.T = unpack_D3DCOLOR(v.T);
//v.B = unpack_D3DCOLOR(v.B);
//v.color = unpack_D3DCOLOR(v.color);
v.N = unpack_D3DCOLOR(v.N);
v.T = unpack_D3DCOLOR(v.T);
v.B = unpack_D3DCOLOR(v.B);
v.color = unpack_D3DCOLOR(v.color);

v2p o;

Expand Down

0 comments on commit 4ac5bb3

Please sign in to comment.