diff options
author | aap <aap@papnet.eu> | 2021-01-10 19:45:58 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2021-01-10 19:45:58 +0100 |
commit | 93ea98520bb652095c9f09ed5032842963e2a86c (patch) | |
tree | 28f7839aa1b94bcddc8f7c5eeb76f01b50cdadd0 /src/extras/shaders | |
parent | Fix linux build (diff) | |
download | re3-93ea98520bb652095c9f09ed5032842963e2a86c.tar re3-93ea98520bb652095c9f09ed5032842963e2a86c.tar.gz re3-93ea98520bb652095c9f09ed5032842963e2a86c.tar.bz2 re3-93ea98520bb652095c9f09ed5032842963e2a86c.tar.lz re3-93ea98520bb652095c9f09ed5032842963e2a86c.tar.xz re3-93ea98520bb652095c9f09ed5032842963e2a86c.tar.zst re3-93ea98520bb652095c9f09ed5032842963e2a86c.zip |
Diffstat (limited to 'src/extras/shaders')
-rw-r--r-- | src/extras/shaders/Makefile | 7 | ||||
-rw-r--r-- | src/extras/shaders/leedsBuilding_VS.hlsl | 1 | ||||
-rw-r--r-- | src/extras/shaders/leedsBuilding_mobile.vert | 52 | ||||
-rw-r--r-- | src/extras/shaders/leedsBuilding_mobile_VS.cso | bin | 0 -> 808 bytes | |||
-rw-r--r-- | src/extras/shaders/leedsBuilding_mobile_VS.hlsl | 64 | ||||
-rw-r--r-- | src/extras/shaders/leedsBuilding_mobile_VS.inc | 70 | ||||
-rw-r--r-- | src/extras/shaders/leedsBuilding_mobile_vs_gl.inc | 54 |
7 files changed, 246 insertions, 2 deletions
diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile index 7fa0f125..87777e74 100644 --- a/src/extras/shaders/Makefile +++ b/src/extras/shaders/Makefile @@ -4,7 +4,7 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \ neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \ neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \ im2d_UV2_gl.inc screenDroplet_fs_gl.inc \ - leedsBuilding_vs_gl.inc scale_fs_gl.inc \ + leedsBuilding_vs_gl.inc leedsBuilding_mobile_vs_gl.inc scale_fs_gl.inc \ leedsVehicle_vs_gl.inc leedsVehicle_add_gl.inc leedsVehicle_blend_gl.inc im2d_gl.inc: im2d.vert @@ -84,6 +84,11 @@ leedsBuilding_vs_gl.inc: leedsBuilding.vert sed 's/..*/"&\\n"/' leedsBuilding.vert;\ echo ';') >leedsBuilding_vs_gl.inc +leedsBuilding_mobile_vs_gl.inc: leedsBuilding_mobile.vert + (echo 'const char *leedsBuilding_mobile_vert_src =';\ + sed 's/..*/"&\\n"/' leedsBuilding_mobile.vert;\ + echo ';') >leedsBuilding_mobile_vs_gl.inc + scale_fs_gl.inc: scale.frag (echo 'const char *scale_frag_src =';\ sed 's/..*/"&\\n"/' scale.frag;\ diff --git a/src/extras/shaders/leedsBuilding_VS.hlsl b/src/extras/shaders/leedsBuilding_VS.hlsl index 3c40bef1..1ed939cc 100644 --- a/src/extras/shaders/leedsBuilding_VS.hlsl +++ b/src/extras/shaders/leedsBuilding_VS.hlsl @@ -2,7 +2,6 @@ #define surfEmissive (surfProps.w) - float4 emissive : register(c41); float4 ambient : register(c42); diff --git a/src/extras/shaders/leedsBuilding_mobile.vert b/src/extras/shaders/leedsBuilding_mobile.vert new file mode 100644 index 00000000..f06628ee --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile.vert @@ -0,0 +1,52 @@ +uniform vec4 u_amb; +uniform vec4 u_emiss; + +#define surfEmissive (u_surfProps.w) + +#define vertContrast (1.5) +#define vertBrightness (0.25) +#define ambientContrast (1.2) +#define ambientBrightness (0.1) +#define emissiveContrast (1.25) +#define emissiveBrightness (0.05) + + +VSIN(ATTRIB_POS) vec3 in_pos; + +VSOUT vec4 v_color; +VSOUT vec2 v_tex0; +VSOUT float v_fog; + +void +main(void) +{ + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; + + v_tex0 = in_tex0; + + vec4 vertCol = in_color; + vec4 amb = u_amb; + vec4 emiss = u_emiss; + + vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5; + vertCol.xyz += vertBrightness; + vertCol.xyz = max(vertCol.xyz, vec3(0.0,0.0,0.0)); + + amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5; + amb.xyz += ambientBrightness; + amb.xyz = max(amb.xyz, vec3(0.0,0.0,0.0)); + + emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5; + emiss.xyz += emissiveBrightness; + emiss.xyz = max(emiss.xyz, vec3(0.0,0.0,0.0)); + v_color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz); + v_color.w = vertCol.w; + + + v_color = clamp(v_color, 0.0, 1.0); + v_color.a *= u_matColor.a; + + v_fog = DoFog(gl_Position.w); +} diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.cso b/src/extras/shaders/leedsBuilding_mobile_VS.cso Binary files differnew file mode 100644 index 00000000..c3ac2b9b --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_VS.cso diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.hlsl b/src/extras/shaders/leedsBuilding_mobile_VS.hlsl new file mode 100644 index 00000000..23accf64 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_VS.hlsl @@ -0,0 +1,64 @@ +#include "standardConstants.h" + +#define surfEmissive (surfProps.w) + +#define vertContrast (1.5) +#define vertBrightness (0.25) +#define ambientContrast (1.2) +#define ambientBrightness (0.1) +#define emissiveContrast (1.25) +#define emissiveBrightness (0.05) + +float4 emissive : register(c41); +float4 ambient : register(c42); + +struct VS_in +{ + float4 Position : POSITION; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + float4 Prelight : COLOR0; +}; + +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; // also fog + float4 Color : COLOR0; +}; + + +VS_out main(in VS_in input) +{ + VS_out output; + + output.Position = mul(combinedMat, input.Position); + float3 Vertex = mul(worldMat, input.Position).xyz; + float3 Normal = mul(normalMat, input.Normal); + + output.TexCoord0.xy = input.TexCoord; + + float4 vertCol = input.Prelight; + float4 amb = ambient; + float4 emiss = emissive; + + vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5; + vertCol.xyz += vertBrightness; + vertCol.xyz = max(vertCol.xyz, float3(0.0,0.0,0.0)); + + amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5; + amb.xyz += ambientBrightness; + amb.xyz = max(amb.xyz, float3(0.0,0.0,0.0)); + + emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5; + emiss.xyz += emissiveBrightness; + emiss.xyz = max(emiss.xyz, float3(0.0,0.0,0.0)); + output.Color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz); + output.Color.w = vertCol.w; + + output.Color = clamp(output.Color, 0.0, 1.0); + output.Color.a *= matCol.a; + + output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0); + + return output; +} diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.inc b/src/extras/shaders/leedsBuilding_mobile_VS.inc new file mode 100644 index 00000000..1433ca3f --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_VS.inc @@ -0,0 +1,70 @@ +static unsigned char leedsBuilding_mobile_VS_cso[] = { + 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, + 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00, + 0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, + 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, + 0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00, + 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, + 0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, + 0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67, + 0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, + 0x76, 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, + 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0xc0, 0x3f, + 0x00, 0x00, 0x40, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, + 0x05, 0x00, 0x0f, 0xa0, 0x9a, 0x99, 0x99, 0x3f, 0x9a, 0x99, 0x19, 0x3f, + 0x00, 0x00, 0xa0, 0x3f, 0xcd, 0xcc, 0x0c, 0x3f, 0x51, 0x00, 0x00, 0x05, + 0x06, 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, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x0a, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x02, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x55, 0xa0, 0x04, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x04, 0x00, 0x00, 0xa0, + 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0x00, 0x80, + 0x2a, 0x00, 0x90, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0e, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x55, 0xa0, + 0x0b, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, + 0x01, 0x00, 0x00, 0x80, 0x29, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xaa, 0xa0, + 0x05, 0x00, 0xff, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xf9, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, + 0x02, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x06, 0x00, 0x00, 0xa0, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80, + 0x0c, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0xd0, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, + 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0e, 0x00, 0x55, 0xa1, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, + 0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc b/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc new file mode 100644 index 00000000..56bb8a80 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc @@ -0,0 +1,54 @@ +const char *leedsBuilding_mobile_vert_src = +"uniform vec4 u_amb;\n" +"uniform vec4 u_emiss;\n" + +"#define surfEmissive (u_surfProps.w)\n" + +"#define vertContrast (1.5)\n" +"#define vertBrightness (0.25)\n" +"#define ambientContrast (1.2)\n" +"#define ambientBrightness (0.1)\n" +"#define emissiveContrast (1.25)\n" +"#define emissiveBrightness (0.05)\n" + + +"VSIN(ATTRIB_POS) vec3 in_pos;\n" + +"VSOUT vec4 v_color;\n" +"VSOUT vec2 v_tex0;\n" +"VSOUT float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" + +" v_tex0 = in_tex0;\n" + +" vec4 vertCol = in_color;\n" +" vec4 amb = u_amb;\n" +" vec4 emiss = u_emiss;\n" + +" vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5;\n" +" vertCol.xyz += vertBrightness;\n" +" vertCol.xyz = max(vertCol.xyz, vec3(0.0,0.0,0.0));\n" +" \n" +" amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5;\n" +" amb.xyz += ambientBrightness;\n" +" amb.xyz = max(amb.xyz, vec3(0.0,0.0,0.0));\n" +" \n" +" emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5;\n" +" emiss.xyz += emissiveBrightness;\n" +" emiss.xyz = max(emiss.xyz, vec3(0.0,0.0,0.0));\n" +" v_color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz);\n" +" v_color.w = vertCol.w;\n" + + +" v_color = clamp(v_color, 0.0, 1.0);\n" +" v_color.a *= u_matColor.a;\n" + +" v_fog = DoFog(gl_Position.w);\n" +"}\n" +; |