Skip to content

Commit cb49699

Browse files
committed
OpenGL: added shaders: water, waterd, lmape, vert, lod, accum_emissivel, model_distort
1 parent dd8763b commit cb49699

29 files changed

+767
-11
lines changed
136 Bytes
Binary file not shown.

res/gamedata/shaders/gl/font2.ps

241 Bytes
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
out vec4 SV_Target;
3+
4+
struct v2p
5+
{
6+
float2 tc0 ; // TEXCOORD0; // base
7+
float2 tc1 ; // TEXCOORD1; // lmap
8+
float2 tc2 ; // TEXCOORD2; // hemi
9+
float3 tc3 ; // TEXCOORD3; // env
10+
float3 c0 ; // COLOR0;
11+
float3 c1 ; // COLOR1;
12+
float fog ; // FOG;
13+
};
14+
15+
layout(location = TEXCOORD0) in float2 v2p_lmape_tc0 ; // TEXCOORD0; // base
16+
layout(location = TEXCOORD1) in float2 v2p_lmape_tc1 ; // TEXCOORD1; // lmap
17+
layout(location = TEXCOORD2) in float2 v2p_lmape_tc2 ; // TEXCOORD2; // hemi
18+
layout(location = TEXCOORD3) in float3 v2p_lmape_tc3 ; // TEXCOORD3; // env
19+
layout(location = COLOR0) in float3 v2p_lmape_c0 ; // COLOR0;
20+
layout(location = COLOR1) in float3 v2p_lmape_c1 ; // COLOR1;
21+
layout(location = FOG) in float v2p_lmape_fog ; // FOG;
22+
23+
float4 _main ( v2p I );
24+
25+
void main()
26+
{
27+
v2p I;
28+
I.tc0 = v2p_lmape_tc0;
29+
I.tc1 = v2p_lmape_tc1;
30+
I.tc2 = v2p_lmape_tc2;
31+
I.tc3 = v2p_lmape_tc3;
32+
I.c0 = v2p_lmape_c0;
33+
I.c1 = v2p_lmape_c1;
34+
I.fog = v2p_lmape_fog;
35+
36+
SV_Target = _main (I);
37+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
out vec4 SV_Target0;
3+
#ifndef ATOC
4+
out vec4 SV_Target1;
5+
#ifndef GBUFFER_OPTIMIZATION
6+
out vec4 SV_Target2;
7+
#endif // GBUFFER_OPTIMIZATION
8+
#ifdef EXTEND_F_DEFFER
9+
out int gl_SampleMask[];
10+
#endif // EXTEND_F_DEFFER
11+
#ifdef MSAA_ALPHATEST_DX10_1_ATOC
12+
in vec4 gl_FragCoord;
13+
#endif // MSAA_ALPHATEST_DX10_1_ATOC
14+
#endif // #endif
15+
16+
struct v2p
17+
{
18+
float3 Pe ; // TEXCOORD0;
19+
float2 tc0 ; // TEXCOORD1; // base0
20+
float2 tc1 ; // TEXCOORD2; // base1
21+
float4 af ; // COLOR1; // alpha&factor //skyloader: COLOR1? maybe COLOR0?
22+
};
23+
24+
layout(location = TEXCOORD0) in float3 v2p_lod_Pe ; // TEXCOORD0; // base
25+
layout(location = TEXCOORD1) in float2 v2p_lod_tc0 ; // TEXCOORD1; // lmap
26+
layout(location = TEXCOORD2) in float2 v2p_lod_tc1 ; // TEXCOORD2; // hemi
27+
layout(location = COLOR1) in float4 v2p_lod_af ; // COLOR1;
28+
29+
#ifdef ATOC
30+
float4 _main ( v2p I );
31+
#else // ATOC
32+
#ifdef MSAA_ALPHATEST_DX10_1_ATOC
33+
f_deffer _main ( v2p I, float4 pos2d );
34+
#else // MSAA_ALPHATEST_DX10_1_ATOC
35+
f_deffer _main ( v2p I );
36+
#endif // MSAA_ALPHATEST_DX10_1_ATOC
37+
#endif // ATOC
38+
39+
void main()
40+
{
41+
v2p I;
42+
I.Pe = v2p_lod_Pe;
43+
I.tc0 = v2p_lod_tc0;
44+
I.tc1 = v2p_lod_tc1;
45+
I.af = v2p_lod_af;
46+
47+
#ifdef ATOC
48+
SV_Target = _main (I);
49+
#else // ATOC
50+
#ifdef MSAA_ALPHATEST_DX10_1_ATOC
51+
f_deffer O = _main (I, gl_FragCoord);
52+
#else
53+
f_deffer O = _main (I);
54+
#endif // MSAA_ALPHATEST_DX10_1_ATOC
55+
56+
#endif // ATOC
57+
58+
SV_Target0 = O.position;
59+
#ifdef GBUFFER_OPTIMIZATION
60+
SV_Target1 = O.C;
61+
#else
62+
SV_Target1 = O.Ne;
63+
SV_Target2 = O.C;
64+
#endif // GBUFFER_OPTIMIZATION
65+
#ifdef EXTEND_F_DEFFER
66+
gl_SampleMask[0] = O.mask;
67+
#endif
68+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
out vec4 SV_Target;
3+
4+
struct v2p
5+
{
6+
float2 Tex0 ; // TEXCOORD0;
7+
float3 c0 ; // COLOR0; // c0=all lighting
8+
float fog ; // FOG;
9+
};
10+
11+
layout(location = TEXCOORD0) in float2 v2p_vert_tc ; // TEXCOORD0;
12+
layout(location = COLOR0) in float3 v2p_vert_c ; // COLOR0; // c0=all lighting
13+
layout(location = FOG) in float v2p_vert_fog ; // FOG;
14+
15+
float4 _main ( v2p I );
16+
17+
void main()
18+
{
19+
v2p I;
20+
I.Tex0 = v2p_vert_tc;
21+
I.c0 = v2p_vert_c;
22+
I.fog = v2p_vert_fog;
23+
24+
SV_Target = _main (I);
25+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
out vec4 SV_Target;
3+
#ifdef GBUFFER_OPTIMIZATION
4+
in vec4 gl_FragCoord;
5+
#endif
6+
7+
struct v2p
8+
{
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;
16+
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
17+
float4 tctexgen; // TEXCOORD7;
18+
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
19+
float4 c0 ; // COLOR0;
20+
float fog ; // FOG;
21+
};
22+
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;
30+
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
31+
layout(location = TEXCOORD7) in float4 v2p_vert_tctexgen ; // TEXCOORD7;
32+
#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;
35+
36+
#ifdef GBUFFER_OPTIMIZATION
37+
float4 _main( v2p I, float4 pos2d );
38+
#else
39+
float4 _main( v2p I );
40+
#endif
41+
42+
void main()
43+
{
44+
v2p I;
45+
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;
53+
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
54+
I.tctexgen = v2p_vert_tctexgen;
55+
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
56+
I.c0 = v2p_vert_c0;
57+
I.fog = v2p_vert_fog;
58+
#ifdef GBUFFER_OPTIMIZATION
59+
SV_Target = _main ( I, gl_FragCoord );
60+
#else
61+
SV_Target = _main ( I );
62+
#endif
63+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
out vec4 SV_Target;
3+
4+
struct v2p
5+
{
6+
float2 tbase ; // TEXCOORD0;
7+
float2 tdist0 ; // TEXCOORD1;
8+
float2 tdist1 ; // TEXCOORD2;
9+
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
10+
float4 tctexgen; // TEXCOORD3;
11+
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
12+
};
13+
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;
17+
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
18+
layout(location = TEXCOORD3) in float4 v2p_vert_tctexgen ; // TEXCOORD3;
19+
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
20+
21+
float4 _main ( v2p I );
22+
23+
void main()
24+
{
25+
v2p I;
26+
I.tbase = v2p_vert_tbase;
27+
I.tdist0 = v2p_vert_tdist0;
28+
I.tdist1 = v2p_vert_tdist1;
29+
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
30+
I.tctexgen = v2p_vert_tctexgen;
31+
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
32+
SV_Target = _main (I);
33+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
float2 tc1 ; // TEXCOORD1; // lmap
21+
float2 tc2 ; // TEXCOORD2; // hemi
22+
float3 tc3 ; // TEXCOORD3; // env
23+
float3 c0 ; // COLOR0;
24+
float3 c1 ; // COLOR1;
25+
float fog ; // FOG;
26+
};
27+
28+
layout(location = POSITION) in float4 v_static_P ; // POSITION; // (float,float,float,1)
29+
layout(location = NORMAL) in float4 v_static_N ; // NORMAL; // (nx,ny,nz,hemi occlusion)
30+
layout(location = TANGENT) in float4 v_static_T ; // TANGENT; // tangent
31+
layout(location = BINORMAL) in float4 v_static_B ; // BINORMAL; // binormal
32+
layout(location = TEXCOORD0) in float2 v_static_tc ; // TEXCOORD0; // (u,v)
33+
#ifdef USE_LM_HEMI
34+
layout(location = TEXCOORD1) in float2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
35+
#endif
36+
37+
38+
layout(location = TEXCOORD0) out float2 v2p_lmape_tc0 ; // TEXCOORD0; // base
39+
layout(location = TEXCOORD1) out float2 v2p_lmape_tc1 ; // TEXCOORD1; // lmap
40+
layout(location = TEXCOORD2) out float2 v2p_lmape_tc2 ; // TEXCOORD2; // hemi
41+
layout(location = TEXCOORD3) out float3 v2p_lmape_tc3 ; // TEXCOORD3; // env
42+
layout(location = COLOR0) out float3 v2p_lmape_c0 ; // COLOR0;
43+
layout(location = COLOR1) out float3 v2p_lmape_c1 ; // COLOR1;
44+
layout(location = FOG) out float v2p_lmape_fog ; // FOG;
45+
46+
v2p _main ( v_static I );
47+
48+
void main()
49+
{
50+
v_static I;
51+
I.P = v_static_P;
52+
I.Nh = v_static_N;
53+
I.T = v_static_T;
54+
I.B = v_static_B;
55+
I.tc = v_static_tc;
56+
#ifdef USE_LM_HEMI
57+
I.lmh = v_static_lmh;
58+
#endif
59+
60+
v2p O = _main (I);
61+
62+
v2p_lmape_tc0 = O.tc0;
63+
v2p_lmape_tc1 = O.tc1;
64+
v2p_lmape_tc2 = O.tc2;
65+
v2p_lmape_tc3 = O.tc3;
66+
v2p_lmape_c0 = O.c0;
67+
v2p_lmape_c1 = O.c1;
68+
v2p_lmape_fog = O.fog;
69+
gl_Position = O.hpos;
70+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
out gl_PerVertex { vec4 gl_Position; };
3+
4+
struct v_lod
5+
{
6+
float3 pos0 ; // POSITION0;
7+
float3 pos1 ; // POSITION1;
8+
float3 n0 ; // NORMAL0;
9+
float3 n1 ; // NORMAL1;
10+
float2 tc0 ; // TEXCOORD0;
11+
float2 tc1 ; // TEXCOORD1;
12+
float4 rgbh0 ; // TEXCOORD2; // rgb.h
13+
float4 rgbh1 ; // TEXCOORD3; // rgb.h
14+
float4 sun_af ; // COLOR0; // x=sun_0, y=sun_1, z=alpha, w=factor
15+
};
16+
struct v2p
17+
{
18+
float4 hpos ; // SV_Position;
19+
float3 Pe ; // TEXCOORD0;
20+
float2 tc0 ; // TEXCOORD1; // base0
21+
float2 tc1 ; // TEXCOORD2; // base1
22+
float4 af ; // COLOR1; // alpha&factor //skyloader: COLOR1? maybe COLOR0?
23+
};
24+
25+
layout(location = POSITION0) in float3 v_lod_pos0 ; // POSITION0;
26+
layout(location = POSITION1) in float3 v_lod_pos1 ; // POSITION1;
27+
layout(location = NORMAL0) in float3 v_lod_n0 ; // NORMAL0;
28+
layout(location = NORMAL1) in float3 v_lod_n1 ; // NORMAL1;
29+
layout(location = TEXCOORD0) in float2 v_lod_tc0 ; // TEXCOORD0;
30+
layout(location = TEXCOORD1) in float2 v_lod_tc1 ; // TEXCOORD1;
31+
layout(location = TEXCOORD2) in float4 v_lod_rgbh0 ; // TEXCOORD2; // rgb.h
32+
layout(location = TEXCOORD3) in float4 v_lod_rgbh1 ; // TEXCOORD3; // rgb.h
33+
layout(location = COLOR0) in float4 v_lod_sun_af ; // COLOR0; // x=sun_0, y=sun_1, z=alpha, w=factor
34+
35+
36+
layout(location = TEXCOORD0) out float3 v2p_lod_Pe ; // TEXCOORD0; // base
37+
layout(location = TEXCOORD1) out float2 v2p_lod_tc0 ; // TEXCOORD1; // lmap
38+
layout(location = TEXCOORD2) out float2 v2p_lod_tc1 ; // TEXCOORD2; // hemi
39+
layout(location = COLOR1) out float4 v2p_lod_af ; // COLOR1;
40+
41+
v2p _main ( v_lod I );
42+
43+
void main()
44+
{
45+
v_lod I;
46+
I.pos0 = v_lod_pos0;
47+
I.pos1 = v_lod_pos1;
48+
I.n0 = v_lod_n0;
49+
I.n1 = v_lod_n1;
50+
I.tc0 = v_lod_tc0;
51+
I.tc1 = v_lod_tc1;
52+
I.rgbh0 = v_lod_rgbh0;
53+
I.rgbh1 = v_lod_rgbh1;
54+
I.sun_af = v_lod_sun_af;
55+
56+
v2p O = _main (I);
57+
58+
v2p_lod_Pe = O.Pe;
59+
v2p_lod_tc0 = O.tc0;
60+
v2p_lod_tc1 = O.tc1;
61+
v2p_lod_af = O.af;
62+
gl_Position = O.hpos;
63+
}

0 commit comments

Comments
 (0)