Skip to content

Commit a1e13c8

Browse files
committed
shaders: Fix various oversights in GLSL ports.
1 parent 5ad54e9 commit a1e13c8

File tree

10 files changed

+34
-35
lines changed

10 files changed

+34
-35
lines changed

res/gamedata/shaders/gl/deffer_detail_s_flat.vs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ v2p_flat _main (v_detail v)
3636
O.hpos = Pp;
3737
O.N = mul (m_WV, normalize(norm) );
3838
float3 Pe = mul (m_WV, pos );
39+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
3940
O.tcdh = float4 ((v.misc * consts).xyyy );
41+
#else
42+
O.tcdh = float2 ((v.misc * consts).xyyy );
43+
#endif
4044

4145
# if defined(USE_R2_STATIC_SUN)
4246
O.tcdh.w = c0.x; // (,,,dir-occlusion)
@@ -46,4 +50,3 @@ v2p_flat _main (v_detail v)
4650

4751
return O;
4852
}
49-
FXVS;

res/gamedata/shaders/gl/deffer_detail_w_flat.vs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ v2p_flat _main (v_detail v)
4848
O.N = mul (m_WV, normalize(norm) );
4949
float3 Pe = mul (m_WV, pos );
5050
// O.tcdh = float4 ((v.misc * consts).xy );
51+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
5152
O.tcdh = float4 ((v.misc * consts).xyyy );
53+
#else
54+
O.tcdh = float2 ((v.misc * consts).xyyy );
55+
#endif
5256

5357
# if defined(USE_R2_STATIC_SUN)
5458
O.tcdh.w = c0.x; // (,,,dir-occlusion)
@@ -57,4 +61,3 @@ v2p_flat _main (v_detail v)
5761

5862
return O;
5963
}
60-
FXVS;
-458 Bytes
Binary file not shown.

res/gamedata/shaders/gl/deffer_tree_bump.vs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ v2p_bumped _main (v_tree I)
1717
float3 pos = mul (m_xform, I.P);
1818

1919
//
20-
float base = m_xform._24 ; // take base height from matrix
20+
float base = m_xform._42 ; // take base height from matrix
2121
float dp = calc_cyclic (wave.w+dot(pos,float3(wave)));
2222
float H = pos.y - base ; // height of vertex (scaled, rotated, etc.)
2323
float frac = I.tc.z*consts.x; // fractional (or rigidity)
2424
float inten = H * dp; // intensity
2525
float2 result = calc_xz_wave (wind.xz*inten, frac);
2626
#ifdef USE_TREEWAVE
27-
result = 0;
27+
result = float2(0);
2828
#endif
2929
float4 w_pos = float4(pos.x+result.x, pos.y, pos.z+result.y, 1);
3030
float2 tc = (I.tc * consts).xy;
@@ -34,7 +34,6 @@ v2p_bumped _main (v_tree I)
3434
// Eye-space pos/normal
3535
v2p_bumped O;
3636
float3 Pe = mul (m_V, w_pos );
37-
O.tcdh = float4 (tc.xyyy );
3837
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
3938
O.tcdh = float4 (tc.xyyy );
4039
#else

res/gamedata/shaders/gl/deffer_tree_flat.vs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ v2p_flat _main (v_tree I)
1919
float3 pos = mul (m_xform, I.P);
2020

2121
//
22-
float base = m_xform._24; // take base height from matrix
22+
float base = m_xform._42; // take base height from matrix
2323
float dp = calc_cyclic (wave.w+dot(pos,float3(wave)));
2424
float H = pos.y - base; // height of vertex (scaled, rotated, etc.)
2525
float frac = I.tc.z*consts.x; // fractional (or rigidity)
@@ -37,7 +37,11 @@ v2p_flat _main (v_tree I)
3737
//float hemi = I.Nh.w;
3838
o.hpos = mul (m_VP, f_pos );
3939
o.N = mul (float3x3(m_xform_v), unpack_bx2(I.Nh) );
40-
o.tcdh = float4 ((I.tc * consts).xyyy );
40+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
41+
o.tcdh = float4 ((I.tc * consts).xyyy );
42+
#else
43+
o.tcdh = float2 ((I.tc * consts).xyyy );
44+
#endif
4145
o.position = float4 (Pe, hemi );
4246

4347
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)

res/gamedata/shaders/gl/iostructs/p_simple.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct v2p
66
float2 tc0 ; // TEXCOORD0; // base
77
};
88

9-
layout(location = TEXCOORD0) in float4 p_simple_tc0 ; // TEXCOORD0; // base
9+
layout(location = TEXCOORD0) in float2 p_simple_tc0 ; // TEXCOORD0; // base
1010

1111
float4 _main ( v2p I );
1212

res/gamedata/shaders/gl/iostructs/v_tree_shadow.h

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
11

22
out gl_PerVertex { vec4 gl_Position; };
33

4-
layout(location = POSITION) in float4 v_tree_P ; // POSITION; // (float,float,float,1)
5-
layout(location = NORMAL) in float4 v_tree_Nh ; // NORMAL; // (nx,ny,nz)
6-
layout(location = TANGENT) in float3 v_tree_T ; // TANGENT; // tangent
7-
layout(location = BINORMAL) in float3 v_tree_B ; // BINORMAL; // binormal
8-
layout(location = TEXCOORD0) in int4 v_tree_tc ; // TEXCOORD0; // (u,v,frac,???)
4+
layout(location = POSITION) in float4 v_shadow_P ; // POSITION; // (float,float,float,1)
5+
#ifdef USE_AREF
6+
layout(location = TEXCOORD0) in int4 v_shadow_tc ; // TEXCOORD0; // (u,v,frac,???)
7+
#endif // USE_AREF
98

10-
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
11-
layout(location = TEXCOORD0) out float4 v2p_flat_tcdh ; // TEXCOORD0; // Texture coordinates, w=sun_occlusion
12-
#else
13-
layout(location = TEXCOORD0) out float2 v2p_flat_tcdh ; // TEXCOORD0; // Texture coordinates
14-
#endif
15-
layout(location = TEXCOORD1) out float4 v2p_flat_position; // TEXCOORD1; // position + hemi
16-
layout(location = TEXCOORD2) out float3 v2p_flat_N ; // TEXCOORD2; // Eye-space normal (for lighting)
17-
#ifdef USE_TDETAIL
18-
layout(location = TEXCOORD3) out float2 v2p_flat_tcdbump; // TEXCOORD3; // d-bump
19-
#endif
20-
#ifdef USE_LM_HEMI
21-
layout(location = TEXCOORD4) out float2 v2p_flat_lmh ; // TEXCOORD4; // lm-hemi
22-
#endif
9+
#ifdef USE_AREF
10+
layout(location = TEXCOORD1) out float2 v2p_shadow_tc0 ; // TEXCOORD1; // Diffuse map for aref
11+
#endif // USE_AREF
2312

2413
#ifdef USE_AREF
2514
v2p_shadow_direct_aref _main ( v_shadow_direct_aref I );
@@ -29,12 +18,13 @@ v2p_shadow_direct _main ( v_shadow_direct I );
2918

3019
void main()
3120
{
32-
v_tree I;
33-
I.P = v_tree_P;
34-
I.Nh = v_tree_Nh;
35-
I.T = v_tree_T;
36-
I.B = v_tree_B;
37-
I.tc = v_tree_tc;
21+
#ifdef USE_AREF
22+
v_shadow_direct_aref I;
23+
I.tc = v_shadow_tc;
24+
#else // USE_AREF
25+
v_shadow_direct I;
26+
#endif // USE_AREF
27+
I.P = v_shadow_P;
3828

3929
#ifdef USE_AREF
4030
v2p_shadow_direct_aref O = _main (I);
8 Bytes
Binary file not shown.

res/gamedata/shaders/gl/shadow_direct_tree.vs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ v2p_shadow_direct _main ( v_shadow_direct I )
2525
float3 pos = mul (m_xform , I.P);
2626

2727
//
28-
float base = m_xform._24; // take base height from matrix
29-
float dp = calc_cyclic (wave.w+dot(pos,(float3)wave));
28+
float base = m_xform._42; // take base height from matrix
29+
float dp = calc_cyclic (wave.w+dot(pos,float3(wave)));
3030
float H = pos.y - base; // height of vertex (scaled, rotated, etc.)
3131
float inten = H * dp; // intensity
3232
float2 result;
3333
#ifdef USE_TREEWAVE
34-
result = 0;
34+
result = float2(0);
3535
#else // USE_TREEWAVE
3636
#ifdef USE_AREF
3737
float frac = I.tc.z*consts.x; // fractional (or rigidity)

res/gamedata/shaders/gl/simple.ps

-52 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)