diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-08-15 17:56:52 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-08-15 17:56:52 +0200 |
commit | 1d5e3c74256038c763bbe8d1369715bc47f99dd8 (patch) | |
tree | ee2a1dac538b95ddb92d7744a6821917e7dd3056 /src/extras/shaders | |
parent | submodules (diff) | |
parent | Don't react if player's targeting with melee (diff) | |
download | re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.tar re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.tar.gz re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.tar.bz2 re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.tar.lz re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.tar.xz re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.tar.zst re3-1d5e3c74256038c763bbe8d1369715bc47f99dd8.zip |
Diffstat (limited to 'src/extras/shaders')
-rw-r--r-- | src/extras/shaders/Makefile | 16 | ||||
-rw-r--r-- | src/extras/shaders/colourfilterIII.frag | 28 | ||||
-rw-r--r-- | src/extras/shaders/colourfilterIII_PS.cso | bin | 0 -> 452 bytes | |||
-rw-r--r-- | src/extras/shaders/colourfilterIII_PS.hlsl | 15 | ||||
-rw-r--r-- | src/extras/shaders/colourfilterIII_PS.inc | 40 | ||||
-rw-r--r-- | src/extras/shaders/colourfilterIII_fs_gl3.inc | 30 | ||||
-rw-r--r-- | src/extras/shaders/contrast.frag | 18 | ||||
-rw-r--r-- | src/extras/shaders/contrastPS.cso | bin | 0 -> 344 bytes | |||
-rw-r--r-- | src/extras/shaders/contrastPS.hlsl | 21 | ||||
-rw-r--r-- | src/extras/shaders/contrastPS.inc | 31 | ||||
-rw-r--r-- | src/extras/shaders/contrast_fs_gl3.inc | 20 | ||||
-rw-r--r-- | src/extras/shaders/im2d.vert | 21 | ||||
-rw-r--r-- | src/extras/shaders/im2d_gl3.inc | 23 | ||||
-rw-r--r-- | src/extras/shaders/make.cmd | 3 | ||||
-rw-r--r-- | src/extras/shaders/makeinc.sh | 5 |
15 files changed, 271 insertions, 0 deletions
diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile new file mode 100644 index 00000000..87be011e --- /dev/null +++ b/src/extras/shaders/Makefile @@ -0,0 +1,16 @@ +all: im2d_gl3.inc colourfilterIII_fs_gl3.inc contrast_fs_gl3.inc + +im2d_gl3.inc: im2d.vert + (echo 'const char *im2d_vert_src =';\ + sed 's/..*/"&\\n"/' im2d.vert;\ + echo ';') >im2d_gl3.inc + +colourfilterIII_fs_gl3.inc: colourfilterIII.frag + (echo 'const char *colourfilterIII_frag_src =';\ + sed 's/..*/"&\\n"/' colourfilterIII.frag;\ + echo ';') >colourfilterIII_fs_gl3.inc + +contrast_fs_gl3.inc: contrast.frag + (echo 'const char *contrast_frag_src =';\ + sed 's/..*/"&\\n"/' contrast.frag;\ + echo ';') >contrast_fs_gl3.inc diff --git a/src/extras/shaders/colourfilterIII.frag b/src/extras/shaders/colourfilterIII.frag new file mode 100644 index 00000000..e19a8600 --- /dev/null +++ b/src/extras/shaders/colourfilterIII.frag @@ -0,0 +1,28 @@ +uniform sampler2D tex0; +uniform vec4 u_blurcolor; + +in vec4 v_color; +in vec2 v_tex0; +in float v_fog; + +out vec4 color; + +void +main(void) +{ + float a = u_blurcolor.a; + + vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0); + vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + vec4 prev = dst; + for(int i = 0; i < 5; i++){ +// vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0); + vec4 tmp = dst*(1.0-a) + prev*doublec*a; + tmp += prev*u_blurcolor; + tmp += prev*u_blurcolor; + prev = clamp(tmp, 0.0, 1.0); + } + color.rgb = prev.rgb; + color.a = 1.0f; +} + diff --git a/src/extras/shaders/colourfilterIII_PS.cso b/src/extras/shaders/colourfilterIII_PS.cso Binary files differnew file mode 100644 index 00000000..cc41bcec --- /dev/null +++ b/src/extras/shaders/colourfilterIII_PS.cso diff --git a/src/extras/shaders/colourfilterIII_PS.hlsl b/src/extras/shaders/colourfilterIII_PS.hlsl new file mode 100644 index 00000000..27f099ef --- /dev/null +++ b/src/extras/shaders/colourfilterIII_PS.hlsl @@ -0,0 +1,15 @@ +sampler2D tex : register(s0); +float4 blurcol : register(c10); + +float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 +{ + float a = blurcol.a; + float4 dst = tex2D(tex, texcoord.xy); + float4 prev = dst; + for(int i = 0; i < 5; i++){ + float4 tmp = dst*(1-a) + prev*blurcol*a; + prev = saturate(tmp); + } + prev.a = 1.0f; + return prev; +} diff --git a/src/extras/shaders/colourfilterIII_PS.inc b/src/extras/shaders/colourfilterIII_PS.inc new file mode 100644 index 00000000..db49de6c --- /dev/null +++ b/src/extras/shaders/colourfilterIII_PS.inc @@ -0,0 +1,40 @@ +static unsigned char colourfilterIII_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, + 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, + 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, + 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, + 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, + 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, + 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, + 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x08, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/colourfilterIII_fs_gl3.inc b/src/extras/shaders/colourfilterIII_fs_gl3.inc new file mode 100644 index 00000000..f57b9cdd --- /dev/null +++ b/src/extras/shaders/colourfilterIII_fs_gl3.inc @@ -0,0 +1,30 @@ +const char *colourfilterIII_frag_src = +"uniform sampler2D tex0;\n" +"uniform vec4 u_blurcolor;\n" + +"in vec4 v_color;\n" +"in vec2 v_tex0;\n" +"in float v_fog;\n" + +"out vec4 color;\n" + +"void\n" +"main(void)\n" +"{\n" +" float a = u_blurcolor.a;\n" + +" vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);\n" +" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" +" vec4 prev = dst;\n" +" for(int i = 0; i < 5; i++){\n" +"// vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);\n" +" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n" +" tmp += prev*u_blurcolor;\n" +" tmp += prev*u_blurcolor;\n" +" prev = clamp(tmp, 0.0, 1.0);\n" +" }\n" +" color.rgb = prev.rgb;\n" +" color.a = 1.0f;\n" +"}\n" + +; diff --git a/src/extras/shaders/contrast.frag b/src/extras/shaders/contrast.frag new file mode 100644 index 00000000..d6dec478 --- /dev/null +++ b/src/extras/shaders/contrast.frag @@ -0,0 +1,18 @@ +uniform sampler2D tex0; +uniform vec3 u_contrastAdd; +uniform vec3 u_contrastMult; + +in vec4 v_color; +in vec2 v_tex0; +in float v_fog; + +out vec4 color; + +void +main(void) +{ + vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + color.rgb = dst.rgb*u_contrastMult + u_contrastAdd; + color.a = 1.0f; +} + diff --git a/src/extras/shaders/contrastPS.cso b/src/extras/shaders/contrastPS.cso Binary files differnew file mode 100644 index 00000000..a87c48d7 --- /dev/null +++ b/src/extras/shaders/contrastPS.cso diff --git a/src/extras/shaders/contrastPS.hlsl b/src/extras/shaders/contrastPS.hlsl new file mode 100644 index 00000000..a1de1d81 --- /dev/null +++ b/src/extras/shaders/contrastPS.hlsl @@ -0,0 +1,21 @@ +struct PS_INPUT +{ + float4 position : POSITION; + float3 texcoord0 : TEXCOORD0; + float4 color : COLOR0; +}; + +uniform float3 contrastMult : register(c10); +uniform float3 contrastAdd : register(c11); + +sampler2D tex : register(s0); + +float4 +main(PS_INPUT In) : COLOR +{ + float4 dst = tex2D(tex, In.texcoord0.xy); + + dst.rgb = dst.rgb*contrastMult + contrastAdd; + dst.a = 1.0; + return dst; +} diff --git a/src/extras/shaders/contrastPS.inc b/src/extras/shaders/contrastPS.inc new file mode 100644 index 00000000..5386792f --- /dev/null +++ b/src/extras/shaders/contrastPS.inc @@ -0,0 +1,31 @@ +static unsigned char contrastPS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x35, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x98, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x00, + 0x01, 0x00, 0x2e, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x2a, 0x00, + 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x88, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x73, 0x74, + 0x41, 0x64, 0x64, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x73, 0x74, 0x4d, 0x75, 0x6c, 0x74, 0x00, 0x74, 0x65, 0x78, + 0x00, 0xab, 0xab, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, + 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, + 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, + 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, + 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x0b, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/contrast_fs_gl3.inc b/src/extras/shaders/contrast_fs_gl3.inc new file mode 100644 index 00000000..58aaf079 --- /dev/null +++ b/src/extras/shaders/contrast_fs_gl3.inc @@ -0,0 +1,20 @@ +const char *contrast_frag_src = +"uniform sampler2D tex0;\n" +"uniform vec3 u_contrastAdd;\n" +"uniform vec3 u_contrastMult;\n" + +"in vec4 v_color;\n" +"in vec2 v_tex0;\n" +"in float v_fog;\n" + +"out vec4 color;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" +" color.rgb = dst.rgb*u_contrastMult + u_contrastAdd;\n" +" color.a = 1.0f;\n" +"}\n" + +; diff --git a/src/extras/shaders/im2d.vert b/src/extras/shaders/im2d.vert new file mode 100644 index 00000000..241593b1 --- /dev/null +++ b/src/extras/shaders/im2d.vert @@ -0,0 +1,21 @@ +uniform vec4 u_xform; + +layout(location = 0) in vec4 in_pos; +layout(location = 2) in vec4 in_color; +layout(location = 3) in vec2 in_tex0; + +out vec4 v_color; +out vec2 v_tex0; +out float v_fog; + +void +main(void) +{ + gl_Position = in_pos; + gl_Position.w = 1.0; + gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw; + v_fog = DoFog(gl_Position.z); + gl_Position.xyz *= gl_Position.w; + v_color = in_color; + v_tex0 = in_tex0; +} diff --git a/src/extras/shaders/im2d_gl3.inc b/src/extras/shaders/im2d_gl3.inc new file mode 100644 index 00000000..68341b39 --- /dev/null +++ b/src/extras/shaders/im2d_gl3.inc @@ -0,0 +1,23 @@ +const char *im2d_vert_src = +"uniform vec4 u_xform;\n" + +"layout(location = 0) in vec4 in_pos;\n" +"layout(location = 2) in vec4 in_color;\n" +"layout(location = 3) in vec2 in_tex0;\n" + +"out vec4 v_color;\n" +"out vec2 v_tex0;\n" +"out float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" gl_Position = in_pos;\n" +" gl_Position.w = 1.0;\n" +" gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;\n" +" v_fog = DoFog(gl_Position.z);\n" +" gl_Position.xyz *= gl_Position.w;\n" +" v_color = in_color;\n" +" v_tex0 = in_tex0;\n" +"}\n" +; diff --git a/src/extras/shaders/make.cmd b/src/extras/shaders/make.cmd new file mode 100644 index 00000000..8404ac6c --- /dev/null +++ b/src/extras/shaders/make.cmd @@ -0,0 +1,3 @@ +@echo off +for %%f in (*PS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T ps_2_0 /nologo /E main /Fo %%~nf.cso %%f +for %%f in (*VS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T vs_2_0 /nologo /E main /Fo %%~nf.cso %%f diff --git a/src/extras/shaders/makeinc.sh b/src/extras/shaders/makeinc.sh new file mode 100644 index 00000000..a649af33 --- /dev/null +++ b/src/extras/shaders/makeinc.sh @@ -0,0 +1,5 @@ +#!sh +for i in *cso; do + (echo -n 'static ' + xxd -i $i | grep -v '_len = ') > ${i%cso}inc +done |