Skip to content

Commit 378e69f

Browse files
committed
OpenGL: added shaders: model_env_lq, wmark, base_lplanes, model_def_lplanes. Seems that's all
1 parent 2599e0d commit 378e69f

File tree

17 files changed

+481
-53
lines changed

17 files changed

+481
-53
lines changed
278 Bytes
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "common.h"
2+
#include "iostructs\v_lplanes.h"
3+
4+
v2p _main (v_static v)
5+
{
6+
v2p o;
7+
8+
o.hpos = mul (m_WVP, v.P); // xform, input in world coords
9+
o.tc0 = unpack_tc_base(v.tc,v.T.w,v.B.w); // copy tc
10+
11+
// calculate fade
12+
float3 dir_v = normalize (mul(m_WV,v.P));
13+
float3 norm_v = normalize (mul(m_WV,unpack_normal(v.Nh).zyx));
14+
float fade = abs (dot(dir_v,norm_v));
15+
o.c0 = float4(fade);
16+
17+
return o;
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
out vec4 SV_Target;
3+
4+
struct v2p
5+
{
6+
float2 tc0 ; // TEXCOORD0; // base
7+
float4 c0 ; // COLOR0; // sun
8+
};
9+
10+
layout(location = TEXCOORD0) in float2 v2p_lplanes_tc0 ; // TEXCOORD0; // base
11+
layout(location = COLOR0) in float4 v2p_lplanes_c0 ; // COLOR0; // sun
12+
13+
float4 _main ( v2p I );
14+
15+
void main()
16+
{
17+
v2p I;
18+
I.tc0 = v2p_lplanes_tc0;
19+
I.c0 = v2p_lplanes_c0;
20+
21+
SV_Target = _main (I);
22+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
out vec4 SV_Target;
3+
4+
struct v2p
5+
{
6+
float2 tc0 ; // TEXCOORD0; // base
7+
float3 tc1 ; // TEXCOORD1; // environment
8+
float3 c0 ; // COLOR0; // sun
9+
float fog ; // FOG;
10+
};
11+
12+
layout(location = TEXCOORD0) in float2 v2p_model_tc0 ; // TEXCOORD0;
13+
layout(location = TEXCOORD1) in float3 v2p_model_tc1 ; // TEXCOORD1;
14+
layout(location = COLOR0) in float3 v2p_model_c0 ; // COLOR0;
15+
layout(location = FOG) in float v2p_model_fog ; // FOG;
16+
17+
float4 _main ( v2p I );
18+
19+
void main()
20+
{
21+
v2p I;
22+
I.tc0 = v2p_model_tc0;
23+
I.tc1 = v2p_model_tc1;
24+
I.c0 = v2p_model_c0;
25+
I.fog = v2p_model_fog;
26+
27+
SV_Target = _main (I);
28+
}

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

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ in vec4 gl_FragCoord;
66

77
struct v2p
88
{
9-
float2 tbase ; // TEXCOORD0; // base
10-
float2 tnorm0 ; // TEXCOORD1; // nm0
11-
float2 tnorm1 ; // TEXCOORD2; // nm1
12-
float3 M1 ; // TEXCOORD3;
13-
float3 M2 ; // TEXCOORD4;
14-
float3 M3 ; // TEXCOORD5;
15-
float3 v2point ; // TEXCOORD6;
9+
float2 tbase ; // TEXCOORD0; // base
10+
float2 tnorm0 ; // TEXCOORD1; // nm0
11+
float2 tnorm1 ; // TEXCOORD2; // nm1
12+
float3 M1 ; // TEXCOORD3;
13+
float3 M2 ; // TEXCOORD4;
14+
float3 M3 ; // TEXCOORD5;
15+
float3 v2point ; // TEXCOORD6;
1616
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
17-
float4 tctexgen; // TEXCOORD7;
17+
float4 tctexgen; // TEXCOORD7;
1818
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
19-
float4 c0 ; // COLOR0;
20-
float fog ; // FOG;
19+
float4 c0 ; // COLOR0;
20+
float fog ; // FOG;
2121
};
2222

23-
layout(location = TEXCOORD0) in float2 v2p_vert_tbase ; // TEXCOORD0;
24-
layout(location = TEXCOORD1) in float2 v2p_vert_tnorm0 ; // TEXCOORD1;
25-
layout(location = TEXCOORD2) in float2 v2p_vert_tnorm1 ; // TEXCOORD2;
26-
layout(location = TEXCOORD3) in float3 v2p_vert_M1 ; // TEXCOORD3;
27-
layout(location = TEXCOORD4) in float3 v2p_vert_M2 ; // TEXCOORD4;
28-
layout(location = TEXCOORD5) in float3 v2p_vert_M3 ; // TEXCOORD5;
29-
layout(location = TEXCOORD6) in float3 v2p_vert_v2point ; // TEXCOORD6;
23+
layout(location = TEXCOORD0) in float2 v2p_water_tbase ; // TEXCOORD0;
24+
layout(location = TEXCOORD1) in float2 v2p_water_tnorm0 ; // TEXCOORD1;
25+
layout(location = TEXCOORD2) in float2 v2p_water_tnorm1 ; // TEXCOORD2;
26+
layout(location = TEXCOORD3) in float3 v2p_water_M1 ; // TEXCOORD3;
27+
layout(location = TEXCOORD4) in float3 v2p_water_M2 ; // TEXCOORD4;
28+
layout(location = TEXCOORD5) in float3 v2p_water_M3 ; // TEXCOORD5;
29+
layout(location = TEXCOORD6) in float3 v2p_water_v2point ; // TEXCOORD6;
3030
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
31-
layout(location = TEXCOORD7) in float4 v2p_vert_tctexgen ; // TEXCOORD7;
31+
layout(location = TEXCOORD7) in float4 v2p_water_tctexgen ; // TEXCOORD7;
3232
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
33-
layout(location = COLOR0) in float4 v2p_vert_c0 ; // COLOR0;
34-
layout(location = FOG) in float v2p_vert_fog ; // FOG;
33+
layout(location = COLOR0) in float4 v2p_water_c0 ; // COLOR0;
34+
layout(location = FOG) in float v2p_water_fog ; // FOG;
3535

3636
#ifdef GBUFFER_OPTIMIZATION
3737
float4 _main( v2p I, float4 pos2d );
@@ -43,18 +43,18 @@ void main()
4343
{
4444
v2p I;
4545

46-
I.tbase = v2p_vert_tbase;
47-
I.tnorm0 = v2p_vert_tnorm0;
48-
I.tnorm1 = v2p_vert_tnorm1;
49-
I.M1 = v2p_vert_M1;
50-
I.M2 = v2p_vert_M2;
51-
I.M3 = v2p_vert_M3;
52-
I.v2point = v2p_vert_v2point;
46+
I.tbase = v2p_water_tbase;
47+
I.tnorm0 = v2p_water_tnorm0;
48+
I.tnorm1 = v2p_water_tnorm1;
49+
I.M1 = v2p_water_M1;
50+
I.M2 = v2p_water_M2;
51+
I.M3 = v2p_water_M3;
52+
I.v2point = v2p_water_v2point;
5353
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
54-
I.tctexgen = v2p_vert_tctexgen;
54+
I.tctexgen = v2p_water_tctexgen;
5555
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
56-
I.c0 = v2p_vert_c0;
57-
I.fog = v2p_vert_fog;
56+
I.c0 = v2p_water_c0;
57+
I.fog = v2p_water_fog;
5858
#ifdef GBUFFER_OPTIMIZATION
5959
SV_Target = _main ( I, gl_FragCoord );
6060
#else

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ out vec4 SV_Target;
33

44
struct v2p
55
{
6-
float2 tbase ; // TEXCOORD0;
7-
float2 tdist0 ; // TEXCOORD1;
8-
float2 tdist1 ; // TEXCOORD2;
6+
float2 tbase ; // TEXCOORD0;
7+
float2 tdist0 ; // TEXCOORD1;
8+
float2 tdist1 ; // TEXCOORD2;
99
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
10-
float4 tctexgen; // TEXCOORD3;
10+
float4 tctexgen; // TEXCOORD3;
1111
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
1212
};
1313

14-
layout(location = TEXCOORD0) in float2 v2p_vert_tbase ; // TEXCOORD0;
15-
layout(location = TEXCOORD1) in float2 v2p_vert_tdist0 ; // TEXCOORD1;
16-
layout(location = TEXCOORD2) in float2 v2p_vert_tdist1 ; // TEXCOORD2;
14+
layout(location = TEXCOORD0) in float2 v2p_waterd_tbase ; // TEXCOORD0;
15+
layout(location = TEXCOORD1) in float2 v2p_waterd_tdist0 ; // TEXCOORD1;
16+
layout(location = TEXCOORD2) in float2 v2p_waterd_tdist1 ; // TEXCOORD2;
1717
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
18-
layout(location = TEXCOORD3) in float4 v2p_vert_tctexgen ; // TEXCOORD3;
18+
layout(location = TEXCOORD3) in float4 v2p_waterd_tctexgen ; // TEXCOORD3;
1919
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
2020

2121
float4 _main ( v2p I );
2222

2323
void main()
2424
{
2525
v2p I;
26-
I.tbase = v2p_vert_tbase;
27-
I.tdist0 = v2p_vert_tdist0;
28-
I.tdist1 = v2p_vert_tdist1;
26+
I.tbase = v2p_waterd_tbase;
27+
I.tdist0 = v2p_waterd_tdist0;
28+
I.tdist1 = v2p_waterd_tdist1;
2929
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
30-
I.tctexgen = v2p_vert_tctexgen;
30+
I.tctexgen = v2p_waterd_tctexgen;
3131
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
3232
SV_Target = _main (I);
3333
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
out gl_PerVertex { vec4 gl_Position; };
3+
4+
struct v_static
5+
{
6+
float4 Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion)
7+
float4 T ; // TANGENT; // tangent
8+
float4 B ; // BINORMAL; // binormal
9+
float2 tc ; // TEXCOORD0; // (u,v)
10+
#ifdef USE_LM_HEMI
11+
float2 lmh ; // TEXCOORD1; // (lmu,lmv)
12+
#endif
13+
float4 P ; // POSITION; // (float,float,float,1)
14+
};
15+
16+
struct v2p
17+
{
18+
float4 hpos ; // SV_Position;
19+
float2 tc0 ; // TEXCOORD0; // base
20+
float4 c0 ; // COLOR0; // color
21+
};
22+
23+
layout(location = POSITION) in float4 v_static_P ; // POSITION; // (float,float,float,1)
24+
layout(location = NORMAL) in float4 v_static_N ; // NORMAL; // (nx,ny,nz,hemi occlusion)
25+
layout(location = TANGENT) in float4 v_static_T ; // TANGENT; // tangent
26+
layout(location = BINORMAL) in float4 v_static_B ; // BINORMAL; // binormal
27+
layout(location = TEXCOORD0) in float2 v_static_tc ; // TEXCOORD0; // (u,v)
28+
#ifdef USE_LM_HEMI
29+
layout(location = TEXCOORD1) in float2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
30+
#endif
31+
32+
33+
layout(location = TEXCOORD0) out float2 v2p_lplanes_tc0 ; // TEXCOORD0; // base
34+
layout(location = COLOR0) out float4 v2p_lplanes_c0 ; // COLOR0; // color
35+
36+
v2p _main ( v_static v );
37+
38+
void main()
39+
{
40+
v_static I;
41+
I.P = v_static_P;
42+
I.Nh = v_static_N;
43+
I.T = v_static_T;
44+
I.B = v_static_B;
45+
I.tc = v_static_tc;
46+
#ifdef USE_LM_HEMI
47+
I.lmh = v_static_lmh;
48+
#endif
49+
50+
v2p O = _main (I);
51+
52+
v2p_lplanes_tc0 = O.tc0;
53+
v2p_lplanes_c0 = O.c0;
54+
gl_Position = O.hpos;
55+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
out gl_PerVertex { vec4 gl_Position; };
3+
4+
struct v2p
5+
{
6+
float2 tc0 ; // TEXCOORD0; // base
7+
float3 c0 ; // COLOR0; // color
8+
float4 hpos ; // SV_Position;
9+
};
10+
11+
layout(location = POSITION) in float4 v_model_P ; // POSITION; // (float,float,float,1)
12+
#ifdef SKIN_0
13+
layout(location = NORMAL) in float3 v_model_N ; // NORMAL; // (nx,ny,nz)
14+
#else
15+
layout(location = NORMAL) in float4 v_model_N ; // NORMAL; // (nx,ny,nz,index)
16+
#endif
17+
#if defined(SKIN_3) || defined(SKIN_4)
18+
layout(location = TANGENT) in float4 v_model_T ; // TANGENT; // (nx,ny,nz,weight0)
19+
layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,weight1)
20+
#else
21+
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
22+
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
23+
#endif
24+
#if defined(SKIN_2) || defined(SKIN_3)
25+
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
26+
#else
27+
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
28+
#endif
29+
#ifdef SKIN_4
30+
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
31+
#endif
32+
33+
34+
layout(location = TEXCOORD0) out float2 v2p_model_tc0 ; // TEXCOORD0; // base
35+
layout(location = COLOR0) out float3 v2p_model_c0 ; // COLOR0; // color
36+
37+
v2p _main ( v_model v );
38+
39+
void main()
40+
{
41+
#ifdef SKIN_NONE
42+
v_model I;
43+
#endif
44+
#ifdef SKIN_0
45+
v_model_skinned_0 I;
46+
#endif
47+
#ifdef SKIN_1
48+
v_model_skinned_1 I;
49+
#endif
50+
#ifdef SKIN_2
51+
v_model_skinned_2 I;
52+
#endif
53+
#ifdef SKIN_3
54+
v_model_skinned_3 I;
55+
#endif
56+
#ifdef SKIN_4
57+
v_model_skinned_4 I;
58+
I.ind = v_model_ind;
59+
#endif
60+
61+
I.P = v_model_P;
62+
I.N = v_model_N;
63+
I.T = v_model_T;
64+
I.B = v_model_B;
65+
I.tc = v_model_tc;
66+
67+
v2p O;
68+
#ifdef SKIN_NONE
69+
O = _main(I);
70+
#endif
71+
#ifdef SKIN_0
72+
O = _main(skinning_0(I));
73+
#endif
74+
#ifdef SKIN_1
75+
O = _main(skinning_1(I));
76+
#endif
77+
#ifdef SKIN_2
78+
O = _main(skinning_2(I));
79+
#endif
80+
#ifdef SKIN_3
81+
O = _main(skinning_3(I));
82+
#endif
83+
#ifdef SKIN_4
84+
O = _main(skinning_4(I));
85+
#endif
86+
87+
v2p_model_tc0 = O.tc0;
88+
v2p_model_c0 = O.c0;
89+
gl_Position = O.hpos;
90+
}

0 commit comments

Comments
 (0)