Skip to content

Commit

Permalink
OpenGL: added shaders: water, waterd, lmape, vert, lod, accum_emissiv…
Browse files Browse the repository at this point in the history
…el, model_distort
  • Loading branch information
SkyLoaderr committed Oct 30, 2018
1 parent dd8763b commit cb49699
Show file tree
Hide file tree
Showing 29 changed files with 767 additions and 11 deletions.
Binary file added res/gamedata/shaders/gl/accum_emissivel.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/font2.ps
Binary file not shown.
37 changes: 37 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_lmape.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

out vec4 SV_Target;

struct v2p
{
float2 tc0 ; // TEXCOORD0; // base
float2 tc1 ; // TEXCOORD1; // lmap
float2 tc2 ; // TEXCOORD2; // hemi
float3 tc3 ; // TEXCOORD3; // env
float3 c0 ; // COLOR0;
float3 c1 ; // COLOR1;
float fog ; // FOG;
};

layout(location = TEXCOORD0) in float2 v2p_lmape_tc0 ; // TEXCOORD0; // base
layout(location = TEXCOORD1) in float2 v2p_lmape_tc1 ; // TEXCOORD1; // lmap
layout(location = TEXCOORD2) in float2 v2p_lmape_tc2 ; // TEXCOORD2; // hemi
layout(location = TEXCOORD3) in float3 v2p_lmape_tc3 ; // TEXCOORD3; // env
layout(location = COLOR0) in float3 v2p_lmape_c0 ; // COLOR0;
layout(location = COLOR1) in float3 v2p_lmape_c1 ; // COLOR1;
layout(location = FOG) in float v2p_lmape_fog ; // FOG;

float4 _main ( v2p I );

void main()
{
v2p I;
I.tc0 = v2p_lmape_tc0;
I.tc1 = v2p_lmape_tc1;
I.tc2 = v2p_lmape_tc2;
I.tc3 = v2p_lmape_tc3;
I.c0 = v2p_lmape_c0;
I.c1 = v2p_lmape_c1;
I.fog = v2p_lmape_fog;

SV_Target = _main (I);
}
68 changes: 68 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_lod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

out vec4 SV_Target0;
#ifndef ATOC
out vec4 SV_Target1;
#ifndef GBUFFER_OPTIMIZATION
out vec4 SV_Target2;
#endif // GBUFFER_OPTIMIZATION
#ifdef EXTEND_F_DEFFER
out int gl_SampleMask[];
#endif // EXTEND_F_DEFFER
#ifdef MSAA_ALPHATEST_DX10_1_ATOC
in vec4 gl_FragCoord;
#endif // MSAA_ALPHATEST_DX10_1_ATOC
#endif // #endif

struct v2p
{
float3 Pe ; // TEXCOORD0;
float2 tc0 ; // TEXCOORD1; // base0
float2 tc1 ; // TEXCOORD2; // base1
float4 af ; // COLOR1; // alpha&factor //skyloader: COLOR1? maybe COLOR0?
};

layout(location = TEXCOORD0) in float3 v2p_lod_Pe ; // TEXCOORD0; // base
layout(location = TEXCOORD1) in float2 v2p_lod_tc0 ; // TEXCOORD1; // lmap
layout(location = TEXCOORD2) in float2 v2p_lod_tc1 ; // TEXCOORD2; // hemi
layout(location = COLOR1) in float4 v2p_lod_af ; // COLOR1;

#ifdef ATOC
float4 _main ( v2p I );
#else // ATOC
#ifdef MSAA_ALPHATEST_DX10_1_ATOC
f_deffer _main ( v2p I, float4 pos2d );
#else // MSAA_ALPHATEST_DX10_1_ATOC
f_deffer _main ( v2p I );
#endif // MSAA_ALPHATEST_DX10_1_ATOC
#endif // ATOC

void main()
{
v2p I;
I.Pe = v2p_lod_Pe;
I.tc0 = v2p_lod_tc0;
I.tc1 = v2p_lod_tc1;
I.af = v2p_lod_af;

#ifdef ATOC
SV_Target = _main (I);
#else // ATOC
#ifdef MSAA_ALPHATEST_DX10_1_ATOC
f_deffer O = _main (I, gl_FragCoord);
#else
f_deffer O = _main (I);
#endif // MSAA_ALPHATEST_DX10_1_ATOC

#endif // ATOC

SV_Target0 = O.position;
#ifdef GBUFFER_OPTIMIZATION
SV_Target1 = O.C;
#else
SV_Target1 = O.Ne;
SV_Target2 = O.C;
#endif // GBUFFER_OPTIMIZATION
#ifdef EXTEND_F_DEFFER
gl_SampleMask[0] = O.mask;
#endif
}
25 changes: 25 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_vert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

out vec4 SV_Target;

struct v2p
{
float2 Tex0 ; // TEXCOORD0;
float3 c0 ; // COLOR0; // c0=all lighting
float fog ; // FOG;
};

layout(location = TEXCOORD0) in float2 v2p_vert_tc ; // TEXCOORD0;
layout(location = COLOR0) in float3 v2p_vert_c ; // COLOR0; // c0=all lighting
layout(location = FOG) in float v2p_vert_fog ; // FOG;

float4 _main ( v2p I );

void main()
{
v2p I;
I.Tex0 = v2p_vert_tc;
I.c0 = v2p_vert_c;
I.fog = v2p_vert_fog;

SV_Target = _main (I);
}
63 changes: 63 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_water.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

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

struct v2p
{
float2 tbase ; // TEXCOORD0; // base
float2 tnorm0 ; // TEXCOORD1; // nm0
float2 tnorm1 ; // TEXCOORD2; // nm1
float3 M1 ; // TEXCOORD3;
float3 M2 ; // TEXCOORD4;
float3 M3 ; // TEXCOORD5;
float3 v2point ; // TEXCOORD6;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
float4 tctexgen; // TEXCOORD7;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
float4 c0 ; // COLOR0;
float fog ; // FOG;
};

layout(location = TEXCOORD0) in float2 v2p_vert_tbase ; // TEXCOORD0;
layout(location = TEXCOORD1) in float2 v2p_vert_tnorm0 ; // TEXCOORD1;
layout(location = TEXCOORD2) in float2 v2p_vert_tnorm1 ; // TEXCOORD2;
layout(location = TEXCOORD3) in float3 v2p_vert_M1 ; // TEXCOORD3;
layout(location = TEXCOORD4) in float3 v2p_vert_M2 ; // TEXCOORD4;
layout(location = TEXCOORD5) in float3 v2p_vert_M3 ; // TEXCOORD5;
layout(location = TEXCOORD6) in float3 v2p_vert_v2point ; // TEXCOORD6;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
layout(location = TEXCOORD7) in float4 v2p_vert_tctexgen ; // TEXCOORD7;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
layout(location = COLOR0) in float4 v2p_vert_c0 ; // COLOR0;
layout(location = FOG) in float v2p_vert_fog ; // FOG;

#ifdef GBUFFER_OPTIMIZATION
float4 _main( v2p I, float4 pos2d );
#else
float4 _main( v2p I );
#endif

void main()
{
v2p I;

I.tbase = v2p_vert_tbase;
I.tnorm0 = v2p_vert_tnorm0;
I.tnorm1 = v2p_vert_tnorm1;
I.M1 = v2p_vert_M1;
I.M2 = v2p_vert_M2;
I.M3 = v2p_vert_M3;
I.v2point = v2p_vert_v2point;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
I.tctexgen = v2p_vert_tctexgen;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
I.c0 = v2p_vert_c0;
I.fog = v2p_vert_fog;
#ifdef GBUFFER_OPTIMIZATION
SV_Target = _main ( I, gl_FragCoord );
#else
SV_Target = _main ( I );
#endif
}
33 changes: 33 additions & 0 deletions res/gamedata/shaders/gl/iostructs/p_waterd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

out vec4 SV_Target;

struct v2p
{
float2 tbase ; // TEXCOORD0;
float2 tdist0 ; // TEXCOORD1;
float2 tdist1 ; // TEXCOORD2;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
float4 tctexgen; // TEXCOORD3;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
};

layout(location = TEXCOORD0) in float2 v2p_vert_tbase ; // TEXCOORD0;
layout(location = TEXCOORD1) in float2 v2p_vert_tdist0 ; // TEXCOORD1;
layout(location = TEXCOORD2) in float2 v2p_vert_tdist1 ; // TEXCOORD2;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
layout(location = TEXCOORD3) in float4 v2p_vert_tctexgen ; // TEXCOORD3;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)

float4 _main ( v2p I );

void main()
{
v2p I;
I.tbase = v2p_vert_tbase;
I.tdist0 = v2p_vert_tdist0;
I.tdist1 = v2p_vert_tdist1;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
I.tctexgen = v2p_vert_tctexgen;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
SV_Target = _main (I);
}
70 changes: 70 additions & 0 deletions res/gamedata/shaders/gl/iostructs/v_lmape.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

out gl_PerVertex { vec4 gl_Position; };

struct v_static
{
float4 Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion)
float4 T ; // TANGENT; // tangent
float4 B ; // BINORMAL; // binormal
float2 tc ; // TEXCOORD0; // (u,v)
#ifdef USE_LM_HEMI
float2 lmh ; // TEXCOORD1; // (lmu,lmv)
#endif
float4 P ; // POSITION; // (float,float,float,1)
};

struct v2p
{
float4 hpos ; // SV_Position;
float2 tc0 ; // TEXCOORD0; // base
float2 tc1 ; // TEXCOORD1; // lmap
float2 tc2 ; // TEXCOORD2; // hemi
float3 tc3 ; // TEXCOORD3; // env
float3 c0 ; // COLOR0;
float3 c1 ; // COLOR1;
float fog ; // FOG;
};

layout(location = POSITION) in float4 v_static_P ; // POSITION; // (float,float,float,1)
layout(location = NORMAL) in float4 v_static_N ; // NORMAL; // (nx,ny,nz,hemi occlusion)
layout(location = TANGENT) in float4 v_static_T ; // TANGENT; // tangent
layout(location = BINORMAL) in float4 v_static_B ; // BINORMAL; // binormal
layout(location = TEXCOORD0) in float2 v_static_tc ; // TEXCOORD0; // (u,v)
#ifdef USE_LM_HEMI
layout(location = TEXCOORD1) in float2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
#endif


layout(location = TEXCOORD0) out float2 v2p_lmape_tc0 ; // TEXCOORD0; // base
layout(location = TEXCOORD1) out float2 v2p_lmape_tc1 ; // TEXCOORD1; // lmap
layout(location = TEXCOORD2) out float2 v2p_lmape_tc2 ; // TEXCOORD2; // hemi
layout(location = TEXCOORD3) out float3 v2p_lmape_tc3 ; // TEXCOORD3; // env
layout(location = COLOR0) out float3 v2p_lmape_c0 ; // COLOR0;
layout(location = COLOR1) out float3 v2p_lmape_c1 ; // COLOR1;
layout(location = FOG) out float v2p_lmape_fog ; // FOG;

v2p _main ( v_static I );

void main()
{
v_static I;
I.P = v_static_P;
I.Nh = v_static_N;
I.T = v_static_T;
I.B = v_static_B;
I.tc = v_static_tc;
#ifdef USE_LM_HEMI
I.lmh = v_static_lmh;
#endif

v2p O = _main (I);

v2p_lmape_tc0 = O.tc0;
v2p_lmape_tc1 = O.tc1;
v2p_lmape_tc2 = O.tc2;
v2p_lmape_tc3 = O.tc3;
v2p_lmape_c0 = O.c0;
v2p_lmape_c1 = O.c1;
v2p_lmape_fog = O.fog;
gl_Position = O.hpos;
}
63 changes: 63 additions & 0 deletions res/gamedata/shaders/gl/iostructs/v_lod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

out gl_PerVertex { vec4 gl_Position; };

struct v_lod
{
float3 pos0 ; // POSITION0;
float3 pos1 ; // POSITION1;
float3 n0 ; // NORMAL0;
float3 n1 ; // NORMAL1;
float2 tc0 ; // TEXCOORD0;
float2 tc1 ; // TEXCOORD1;
float4 rgbh0 ; // TEXCOORD2; // rgb.h
float4 rgbh1 ; // TEXCOORD3; // rgb.h
float4 sun_af ; // COLOR0; // x=sun_0, y=sun_1, z=alpha, w=factor
};
struct v2p
{
float4 hpos ; // SV_Position;
float3 Pe ; // TEXCOORD0;
float2 tc0 ; // TEXCOORD1; // base0
float2 tc1 ; // TEXCOORD2; // base1
float4 af ; // COLOR1; // alpha&factor //skyloader: COLOR1? maybe COLOR0?
};

layout(location = POSITION0) in float3 v_lod_pos0 ; // POSITION0;
layout(location = POSITION1) in float3 v_lod_pos1 ; // POSITION1;
layout(location = NORMAL0) in float3 v_lod_n0 ; // NORMAL0;
layout(location = NORMAL1) in float3 v_lod_n1 ; // NORMAL1;
layout(location = TEXCOORD0) in float2 v_lod_tc0 ; // TEXCOORD0;
layout(location = TEXCOORD1) in float2 v_lod_tc1 ; // TEXCOORD1;
layout(location = TEXCOORD2) in float4 v_lod_rgbh0 ; // TEXCOORD2; // rgb.h
layout(location = TEXCOORD3) in float4 v_lod_rgbh1 ; // TEXCOORD3; // rgb.h
layout(location = COLOR0) in float4 v_lod_sun_af ; // COLOR0; // x=sun_0, y=sun_1, z=alpha, w=factor


layout(location = TEXCOORD0) out float3 v2p_lod_Pe ; // TEXCOORD0; // base
layout(location = TEXCOORD1) out float2 v2p_lod_tc0 ; // TEXCOORD1; // lmap
layout(location = TEXCOORD2) out float2 v2p_lod_tc1 ; // TEXCOORD2; // hemi
layout(location = COLOR1) out float4 v2p_lod_af ; // COLOR1;

v2p _main ( v_lod I );

void main()
{
v_lod I;
I.pos0 = v_lod_pos0;
I.pos1 = v_lod_pos1;
I.n0 = v_lod_n0;
I.n1 = v_lod_n1;
I.tc0 = v_lod_tc0;
I.tc1 = v_lod_tc1;
I.rgbh0 = v_lod_rgbh0;
I.rgbh1 = v_lod_rgbh1;
I.sun_af = v_lod_sun_af;

v2p O = _main (I);

v2p_lod_Pe = O.Pe;
v2p_lod_tc0 = O.tc0;
v2p_lod_tc1 = O.tc1;
v2p_lod_af = O.af;
gl_Position = O.hpos;
}
Loading

0 comments on commit cb49699

Please sign in to comment.