delete "res" subfolder

This commit is contained in:
hyzboy 2020-04-07 19:02:47 +08:00
parent 3194d9522c
commit 8707cbcc6f
56 changed files with 0 additions and 1451 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 1150 326" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<g id="Artboard1" transform="matrix(0.95515,0,0,0.888283,-40.1163,-30.2016)">
<rect x="42" y="34" width="1204" height="367" style="fill:none;"/>
<g transform="matrix(1.04696,0,0,1.12577,-46.9913,-50.4325)">
<path d="M724.1,385.06L683.53,385.06C683.53,385.06 683.53,286.09 683.53,255.4C696.49,262.62 713.62,275.94 724.1,288.72L724.1,385.06Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<g>
<path d="M381.75,385.06L331.17,385.06L265.16,181.03L311.17,181.03L356.61,324.48L357.18,324.48L403.18,181.03L449.47,181.03L381.75,385.06Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<path d="M585.51,385.06L546.93,385.06L546.93,364.49L546.08,364.49C540.93,373.07 534.27,379.26 526.07,383.07C517.88,386.88 509.5,388.78 500.92,388.78C490.06,388.78 481.16,387.35 474.2,384.5C467.25,381.65 461.77,377.59 457.77,372.36C453.76,367.12 450.95,360.74 449.33,353.21C447.72,345.69 446.91,337.35 446.91,328.21L446.91,237.33L487.49,237.33L487.49,320.77C487.49,332.96 489.4,342.06 493.21,348.06C497.02,354.07 503.78,357.06 513.5,357.06C524.55,357.06 532.55,353.78 537.5,347.2C542.46,340.62 544.93,329.81 544.93,314.76L544.93,237.32L585.52,237.32L585.52,385.06L585.51,385.06Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
</g>
<path d="M730.84,296.19L730.74,290.47L781.89,237.33L829.91,237.33L774.18,291.62L836.19,385.06L787.04,385.06L730.84,296.19Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<path d="M843.62,282.76C844.19,273.24 846.58,265.33 850.77,259.04C854.96,252.75 860.29,247.71 866.77,243.9C873.25,240.09 880.54,237.37 888.64,235.76C896.73,234.14 904.88,233.33 913.07,233.33C920.5,233.33 928.02,233.85 935.64,234.9C943.27,235.95 950.21,238 956.5,241.05C962.78,244.1 967.93,248.34 971.94,253.76C975.94,259.19 977.94,266.38 977.94,275.34L977.94,352.21C977.94,358.88 978.32,365.27 979.08,371.36C979.84,377.46 981.18,382.03 983.09,385.08L941.94,385.08C941.18,382.8 940.56,380.46 940.08,378.08C939.61,375.7 939.27,373.28 939.08,370.79C932.6,377.47 924.97,382.13 916.21,384.8C907.45,387.46 898.49,388.8 889.35,388.8C882.3,388.8 875.72,387.94 869.64,386.23C863.54,384.52 858.2,381.85 853.64,378.23C849.06,374.61 845.48,370.04 842.92,364.51C840.35,358.99 839.06,352.42 839.06,344.8C839.06,336.42 840.54,329.51 843.49,324.08C846.45,318.65 850.25,314.32 854.93,311.08C859.6,307.84 864.93,305.41 870.93,303.79C876.93,302.17 882.98,300.88 889.07,299.93C895.17,298.99 901.17,298.22 907.08,297.65C912.99,297.08 918.22,296.22 922.79,295.08C927.37,293.93 930.98,292.27 933.65,290.07C936.32,287.88 937.56,284.69 937.37,280.5C937.37,276.12 936.65,272.64 935.22,270.07C933.79,267.5 931.89,265.5 929.51,264.07C927.13,262.64 924.37,261.69 921.22,261.21C918.07,260.73 914.7,260.49 911.08,260.49C903.08,260.49 896.79,262.2 892.22,265.64C887.65,269.07 884.98,274.78 884.22,282.79L843.62,282.79L843.62,282.76ZM937.35,312.77C935.63,314.3 933.49,315.48 930.92,316.34C928.35,317.21 925.59,317.92 922.63,318.49C919.68,319.06 916.58,319.54 913.35,319.92C910.11,320.3 906.87,320.77 903.63,321.35C900.58,321.92 897.58,322.69 894.63,323.63C891.68,324.59 889.1,325.87 886.91,327.49C884.72,329.11 882.96,331.16 881.62,333.63C880.29,336.11 879.62,339.25 879.62,343.06C879.62,346.68 880.29,349.73 881.62,352.2C882.96,354.68 884.77,356.63 887.05,358.06C889.34,359.49 892,360.49 895.05,361.06C898.1,361.63 901.24,361.91 904.48,361.91C912.48,361.91 918.68,360.58 923.06,357.92C927.44,355.25 930.69,352.06 932.77,348.34C934.86,344.63 936.16,340.87 936.62,337.06C937.1,333.25 937.33,330.2 937.34,327.92L937.34,312.77L937.35,312.77Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<path d="M1004.21,237.33L1042.8,237.33L1042.8,257.9L1043.65,257.9C1048.79,249.33 1055.46,243.09 1063.65,239.19C1071.84,235.28 1080.23,233.33 1088.79,233.33C1099.66,233.33 1108.56,234.81 1115.52,237.76C1122.47,240.72 1127.94,244.81 1131.95,250.05C1135.95,255.29 1138.76,261.67 1140.38,269.19C1142,276.72 1142.81,285.05 1142.81,294.2L1142.81,385.07L1102.24,385.07L1102.24,301.63C1102.24,289.43 1100.33,280.34 1096.53,274.34C1092.71,268.34 1085.95,265.34 1076.23,265.34C1065.18,265.34 1057.19,268.63 1052.23,275.2C1047.27,281.76 1044.8,292.58 1044.8,307.63L1044.8,385.07L1004.22,385.07L1004.22,237.33L1004.21,237.33Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<path d="M612.37,211.84L612.37,385.07L652.95,385.07L652.95,234.21C639.93,226.23 626.36,218.74 612.37,211.84Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<path d="M198.43,219.21C221.95,150.32 362.58,125.05 512.58,162.78C602.55,185.4 676.07,229.28 724.09,272.67C702.3,215.12 596.65,133.08 451.18,104.96C286.7,73.16 124.47,101.11 104.39,174.1C89.89,226.83 153.57,288.6 252.05,330.84C207.81,295.02 186.29,254.78 198.43,219.21Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
<path d="M724.16,247.62L724.16,181.03L683.57,181.03L683.57,201.25C700.88,216.71 714.61,232.45 724.16,247.62Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
</g>
<g transform="matrix(1.04696,0,0,1.12577,-46.9913,-50.4325)">
<path d="M1214.98,363.43C1214.98,375.69 1205.35,385.32 1192.83,385.32C1180.43,385.32 1170.54,375.69 1170.54,363.43C1170.54,351.43 1180.43,341.8 1192.83,341.8C1205.35,341.8 1214.98,351.43 1214.98,363.43ZM1176.08,363.43C1176.08,373.06 1183.2,380.7 1192.96,380.7C1202.45,380.7 1209.44,373.05 1209.44,363.56C1209.44,353.93 1202.45,346.15 1192.82,346.15C1183.2,346.16 1176.08,353.94 1176.08,363.43ZM1189.39,374.77L1184.38,374.77L1184.38,353.14C1186.36,352.74 1189.13,352.48 1192.69,352.48C1196.78,352.48 1198.62,353.14 1200.21,354.06C1201.4,354.98 1202.32,356.7 1202.32,358.81C1202.32,361.18 1200.47,363.03 1197.84,363.82L1197.84,364.08C1199.95,364.87 1201.14,366.45 1201.8,369.35C1202.46,372.65 1202.85,373.97 1203.38,374.76L1197.97,374.76C1197.31,373.97 1196.92,371.99 1196.26,369.49C1195.86,367.12 1194.55,366.06 1191.78,366.06L1189.41,366.06L1189.41,374.77L1189.39,374.77ZM1189.53,362.51L1191.9,362.51C1194.67,362.51 1196.91,361.59 1196.91,359.34C1196.91,357.36 1195.46,356.04 1192.29,356.04C1190.97,356.04 1190.05,356.17 1189.52,356.3L1189.52,362.51L1189.53,362.51Z" style="fill:rgb(172,22,44);fill-rule:nonzero;"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,141 +0,0 @@
#version 450 core
#define PI 3.141592
#define iSteps 16
#define jSteps 8
layout(location = 0) in vec4 FragmentVertex;
layout(location = 0) out vec4 FragColor;
layout(binding = 1) uniform AtomSphere
{
vec3 position;
float intensity;
float scattering_direction;
}sun;
vec2 rsi(vec3 r0, vec3 rd, float sr) {
// ray-sphere intersection that assumes
// the sphere is centered at the origin.
// No intersection when result.x > result.y
float a = dot(rd, rd);
float b = 2.0 * dot(rd, r0);
float c = dot(r0, r0) - (sr * sr);
float d = (b*b) - 4.0*a*c;
if (d < 0.0) return vec2(1e5,-1e5);
return vec2(
(-b - sqrt(d))/(2.0*a),
(-b + sqrt(d))/(2.0*a)
);
}
vec3 atmosphere(vec3 r, vec3 r0, vec3 pSun, float iSun, float rPlanet, float rAtmos, vec3 kRlh, float kMie, float shRlh, float shMie, float g)
{
// Normalize the sun and view directions.
pSun = normalize(pSun);
r = normalize(r);
// Calculate the step size of the primary ray.
vec2 p = rsi(r0, r, rAtmos);
if (p.x > p.y) return vec3(0,0,0);
p.y = min(p.y, rsi(r0, r, rPlanet).x);
float iStepSize = (p.y - p.x) / float(iSteps);
// Initialize the primary ray time.
float iTime = 0.0;
// Initialize accumulators for Rayleigh and Mie scattering.
vec3 totalRlh = vec3(0,0,0);
vec3 totalMie = vec3(0,0,0);
// Initialize optical depth accumulators for the primary ray.
float iOdRlh = 0.0;
float iOdMie = 0.0;
// Calculate the Rayleigh and Mie phases.
float mu = dot(r, pSun);
float mumu = mu * mu;
float gg = g * g;
float pRlh = 3.0 / (16.0 * PI) * (1.0 + mumu);
float pMie = 3.0 / (8.0 * PI) * ((1.0 - gg) * (mumu + 1.0)) / (pow(1.0 + gg - 2.0 * mu * g, 1.5) * (2.0 + gg));
// Sample the primary ray.
for (int i = 0; i < iSteps; i++) {
// Calculate the primary ray sample position.
vec3 iPos = r0 + r * (iTime + iStepSize * 0.5);
// Calculate the height of the sample.
float iHeight = length(iPos) - rPlanet;
// Calculate the optical depth of the Rayleigh and Mie scattering for this step.
float odStepRlh = exp(-iHeight / shRlh) * iStepSize;
float odStepMie = exp(-iHeight / shMie) * iStepSize;
// Accumulate optical depth.
iOdRlh += odStepRlh;
iOdMie += odStepMie;
// Calculate the step size of the secondary ray.
float jStepSize = rsi(iPos, pSun, rAtmos).y / float(jSteps);
// Initialize the secondary ray time.
float jTime = 0.0;
// Initialize optical depth accumulators for the secondary ray.
float jOdRlh = 0.0;
float jOdMie = 0.0;
// Sample the secondary ray.
for (int j = 0; j < jSteps; j++) {
// Calculate the secondary ray sample position.
vec3 jPos = iPos + pSun * (jTime + jStepSize * 0.5);
// Calculate the height of the sample.
float jHeight = length(jPos) - rPlanet;
// Accumulate the optical depth.
jOdRlh += exp(-jHeight / shRlh) * jStepSize;
jOdMie += exp(-jHeight / shMie) * jStepSize;
// Increment the secondary ray time.
jTime += jStepSize;
}
// Calculate attenuation.
vec3 attn = exp(-(kMie * (iOdMie + jOdMie) + kRlh * (iOdRlh + jOdRlh)));
// Accumulate scattering.
totalRlh += odStepRlh * attn;
totalMie += odStepMie * attn;
// Increment the primary ray time.
iTime += iStepSize;
}
// Calculate and return the final color.
return iSun * (pRlh * kRlh * totalRlh + pMie * kMie * totalMie);
}
void main()
{
vec3 nrd=vec3(FragmentVertex.x,-FragmentVertex.y,FragmentVertex.z); //vulkan coord to opengl(shader from opengl sample)
vec3 color=atmosphere(
nrd, // normalized ray direction
vec3(0,6372e3,0), // ray origin
sun.position, // position of the sun
sun.intensity, // intensity of the sun
6371e3, // radius of the planet in meters
6471e3, // radius of the atmosphere in meters
vec3(5.5e-6, 13.0e-6, 22.4e-6), // Rayleigh scattering coefficient
21e-6, // Mie scattering coefficient
8e3, // Rayleigh scale height
1.2e3, // Mie scale height
sun.scattering_direction // Mie preferred scattering direction
);
FragColor=vec4(1.0-exp(-color),1);
}

View File

@ -1,32 +0,0 @@
#version 450 core
layout(location = 0) in vec3 Vertex;
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
layout(location = 0) out vec4 FragmentVertex;
void main()
{
FragmentVertex=vec4(Vertex,1.0)*pc.local_to_world*world.mvp;
gl_Position=FragmentVertex;
}

View File

@ -1,13 +0,0 @@
#version 450 core
layout(location=0) out vec4 FragColor;
layout(binding=1) uniform ColorMaterial
{
vec4 color;
} color_material;
void main()
{
FragColor=color_material.color;
}

View File

@ -1,30 +0,0 @@
#version 450 core
layout(location = 0) in vec2 Vertex;
layout(location = 1) in vec3 Color;
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
layout(location = 0) out vec4 FragmentColor;
void main()
{
FragmentColor=vec4(Color,1.0);
gl_Position=vec4(Vertex,0.0,1.0)*world.ortho;
}

View File

@ -1,27 +0,0 @@
#version 450 core
layout(location = 0) in vec3 Vertex;
layout(location = 1) in vec3 Color;
layout(location = 2) in vec3 Normal;
layout(binding = 0) uniform WorldMatrix
{
mat4 ortho;
mat4 projection;
mat4 modelview;
mat4 mvp;
vec4 view_pos;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
layout(location = 0) out vec4 FragmentColor;
void main()
{
FragmentColor=vec4(Color,1.0);
gl_Position=vec4(Vertex,1.0)*world.mvp;
}

View File

@ -1,11 +0,0 @@
#version 450 core
layout(binding = 2) uniform sampler2D tex;
layout(location = 0) in vec2 FragmentTexCoord;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor=texture(tex,FragmentTexCoord);
}

View File

@ -1,22 +0,0 @@
#version 450 core
layout(location = 0) in vec2 Vertex;
layout(location = 1) in vec2 TexCoord;
layout(binding = 0) uniform WorldMatrix
{
mat4 ortho;
mat4 projection;
mat4 modelview;
mat4 mvp;
vec4 view_pos;
} world;
layout(location = 0) out vec2 FragmentTexCoord;
void main()
{
FragmentTexCoord=TexCoord;
gl_Position=vec4(Vertex,0.0,1.0)*world.ortho;
}

View File

@ -1,25 +0,0 @@
#version 450 core
layout(binding=1) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
}fragment_world;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor=vec4(gl_FragCoord.xy/fragment_world.resolution,0,1);
}

View File

@ -1,25 +0,0 @@
#version 450 core
layout(location = 0) in vec2 Vertex;
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
void main()
{
gl_Position=vec4(Vertex,0.0,1.0)*world.ortho;
}

View File

@ -1,29 +0,0 @@
#version 450 core
layout(location = 0) in vec3 Vertex;
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
void main()
{
gl_Position=vec4(Vertex,1.0)*(pc.local_to_world*world.mvp);
}

View File

@ -1,38 +0,0 @@
#version 450 core
layout(location = 0) in vec3 Vertex;
layout(location = 1) in vec4 Color;
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
layout(push_constant) uniform Consts
{
mat4 local_to_world;
mat3 normal;
vec3 object_position;
vec3 object_size;
}pc;
layout(location = 0) out vec4 FragmentColor;
void main()
{
FragmentColor=Color;
gl_Position=vec4(Vertex,1.0)*(pc.local_to_world*world.mvp);
}

View File

@ -1,4 +0,0 @@
vec3 random(vec2 uv) // from Godot 3.2
{
return vec3(fract(sin(dot(uv,vec2(12.9898,78.233)))*43758.5453123));
}

View File

@ -1,16 +0,0 @@
#version 450 core
layout(location = 0) in vec2 Vertex;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 FragmentTexCoord;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
void main()
{
gl_Position=vec4(Vertex,0.0,1.0)*pc.local_to_world;
FragmentTexCoord=TexCoord;
}

View File

@ -1,85 +0,0 @@
/*
This shader experiments the effect of different tone mapping operators.
This is still a work in progress.
More info:
http://slideshare.net/ozlael/hable-john-uncharted2-hdr-lighting
http://filmicgames.com/archives/75
http://filmicgames.com/archives/183
http://filmicgames.com/archives/190
http://imdoingitwrong.wordpress.com/2010/08/19/why-reinhard-desaturates-my-blacks-3/
http://mynameismjp.wordpress.com/2010/04/30/a-closer-look-at-tone-mapping/
http://renderwonk.com/publications/s2010-color-course/
--
Zavie
*/
vec3 linearToneMapping(vec3 color)
{
float exposure = 1.;
color = clamp(exposure * color, 0., 1.);
color = pow(color, vec3(1. / gamma));
return color;
}
vec3 simpleReinhardToneMapping(vec3 color)
{
float exposure = 1.5;
color *= exposure/(1. + color / exposure);
color = pow(color, vec3(1. / gamma));
return color;
}
vec3 lumaBasedReinhardToneMapping(vec3 color)
{
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
float toneMappedLuma = luma / (1. + luma);
color *= toneMappedLuma / luma;
color = pow(color, vec3(1. / gamma));
return color;
}
vec3 whitePreservingLumaBasedReinhardToneMapping(vec3 color)
{
float white = 2.;
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
float toneMappedLuma = luma * (1. + luma / (white*white)) / (1. + luma);
color *= toneMappedLuma / luma;
color = pow(color, vec3(1. / gamma));
return color;
}
vec3 RomBinDaHouseToneMapping(vec3 color)
{
color = exp( -1.0 / ( 2.72*color + 0.15 ) );
color = pow(color, vec3(1. / gamma));
return color;
}
vec3 filmicToneMapping(vec3 color)
{
color = max(vec3(0.), color - vec3(0.004));
color = (color * (6.2 * color + .5)) / (color * (6.2 * color + 1.7) + 0.06);
return color;
}
vec3 Uncharted2ToneMapping(vec3 color)
{
float A = 0.15;
float B = 0.50;
float C = 0.10;
float D = 0.20;
float E = 0.02;
float F = 0.30;
float W = 11.2;
float exposure = 2.;
color *= exposure;
color = ((color * (A * color + C * B) + D * E) / (color * (A * color + B) + D * F)) - E / F;
float white = ((W * (A * W + C * B) + D * E) / (W * (A * W + B) + D * F)) - E / F;
color /= white;
color = pow(color, vec3(1. / gamma));
return color;
}

View File

@ -1,15 +0,0 @@
layout(std430,binding = 0,row_major) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
} world;

View File

@ -1,9 +0,0 @@
#version 450 core
layout(location = 0) in vec4 FragmentColor;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor=FragmentColor;
}

View File

@ -1,9 +0,0 @@
#version 450 core
layout(location = 0) in vec4 FragmentNormal;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor=FragmentNormal;
}

View File

@ -1,16 +0,0 @@
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;

View File

@ -1,28 +0,0 @@
#version 450 core
layout (binding = 1) uniform sampler2D samplerAlbedo;
layout (binding = 2) uniform sampler2D samplerNormalMap;
layout(location = 0) in vec3 FragmentColor;
layout(location = 1) in vec3 FragmentNormal;
layout(location = 2) in vec3 FragmentTangent;
layout(location = 3) in vec3 FragmentWorldPos;
layout(location = 4) in vec2 FragmentTexCoord;
layout (location = 0) out vec4 FragAlbedo;
layout (location = 1) out vec4 FragNormal;
layout (location = 2) out vec4 FragWorldPos;
void main()
{
FragWorldPos=vec4(FragmentWorldPos,1.0);
FragAlbedo =texture(samplerAlbedo,FragmentTexCoord)*vec4(FragmentColor,1.0);
vec3 N = normalize(FragmentNormal);
N.y = -N.y;
vec3 T = normalize(FragmentTangent);
vec3 B = cross(N, T);
mat3 TBN = mat3(T, B, N);
vec3 tnorm = TBN * normalize(texture(samplerNormalMap, FragmentTexCoord).xyz * 2.0 - vec3(1.0));
FragNormal = vec4(tnorm, 1.0);
}

View File

@ -1,40 +0,0 @@
#version 450 core
layout(location = 0) in vec3 Vertex;
layout(location = 1) in vec3 Color;
layout(location = 2) in vec3 Normal;
layout(location = 3) in vec3 Tangent;
layout(location = 4) in vec2 TexCoord;
layout(binding = 0) uniform WorldMatrix
{
mat4 two_dim;
mat4 projection;
mat4 modelview;
mat4 mvp;
mat3 normal;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
layout(location = 0) out vec3 FragmentColor;
layout(location = 1) out vec3 FragmentNormal;
layout(location = 2) out vec3 FragmentTangent;
layout(location = 3) out vec3 FragmentWorldPos;
layout(location = 4) out vec2 FragmentTexCoord;
void main()
{
FragmentColor=Color;
FragmentWorldPos=vec3(vec4(Vertex,1.0)*pc.local_to_world);
FragmentTexCoord=TexCoord;
FragmentTexCoord.t=1.0-TexCoord.t;
mat3 mNormal=transpose(inverse(mat3(pc.local_to_world)));
FragmentNormal=mNormal*normalize(Normal);
FragmentTangent=mNormal*normalize(Tangent);
gl_Position=vec4(Vertex,1.0)*world.mvp;
}

View File

@ -1,27 +0,0 @@
[attribute]
vec3 BaseColor;
vec3 Normal;
float Metallic;
float Roughness;
[gbuffer]
vec4 gb_color_metallic;
vec4 gb_normal_roughness;
[attribute_to_gbuffer]
gb_color_metallic =vec4(BaseColor,Metallic);
gb_normal_roughness =vec4(Normal, Roughness);
[gbuffer_to_attribute]
vec4 gb_cm=texture(gb_color_metallic,FragmentPosition);
vec4 gb_cr=texture(gb_normal_roughness,FragmentPosition);
BaseColor =gb_cm.rgb;
Metallic =gb_cm.a;
Normal =gb_cr.rgb;
Roughness =gb_cr.a;

View File

@ -1,23 +0,0 @@
[attribute]
vec3 BaseColor;
vec3 Normal;
vec3 Position;
[gbuffer]
vec3 gb_color;
vec3 gb_normal;
vec3 gb_position;
[attribute_to_gbuffer]
gb_color=BaseColor;
gb_normal=Normal;
gb_position=Position;
[gbuffer_to_attribute]
BaseColor =texture(gb_color, FragmentPosition);
Normal =texture(gb_normal, FragmentPosition);
Position =texture(gb_position, FragmentPosition);

View File

@ -1,15 +0,0 @@
[attribute]
vec4 BaseColor;
[gbuffer]
vec4 gb_color;
[attribute_to_gbuffer]
gb_color=BaseColor;
[gbuffer_to_attribute]
BaseColor=texture(gb_color,vs_out_position);

View File

@ -1,16 +0,0 @@
#version 450 core
layout(location = 0) out vec4 FragColor;
/* returns a varying number between 0 and 1 */
float drand48(vec2 co)
{
return 2 * fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453) - 1;
}
void main()
{
float gray=drand48(gl_FragCoord.xy);
FragColor=vec4(vec3(gray),1.0);
}

View File

@ -1,44 +0,0 @@
#version 450 core
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
layout(binding = 0) uniform sampler2D GB_Position;
layout(binding = 1) uniform sampler2D GB_Normal;
layout(binding = 2) uniform sampler2D GB_Color;
layout(location = 0) in vec2 FragmentPosition;
layout(location = 0) out vec4 FragColor;
void main()
{
vec3 pos =texture(GB_Position, FragmentPosition).xyz;
vec3 normal =texture(GB_Normal, FragmentPosition).xyz;
vec3 color =texture(GB_Color, FragmentPosition).xyz;
vec3 sun_light_direction=vec3(1,1,1);
float sun_light_intensity=max(dot(normal,sun_light_direction),0.0);
FragColor=vec4(color*sun_light_intensity,1.0);
}

View File

@ -1,12 +0,0 @@
#version 450 core
layout(location = 0) in vec2 Vertex;
layout(location = 0) out vec2 FragmentPosition;
void main()
{
gl_Position=vec4(Vertex,0.0,1.0);
FragmentPosition=(Vertex+1.0)/2.0;
}

View File

@ -1,29 +0,0 @@
#version 450 core
layout(binding = 0) uniform WorldMatrix
{
mat4 ortho;
mat4 projection;
mat4 modelview;
mat4 mvp;
vec4 view_pos;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
layout(binding = 0) uniform sampler2D GB_Position;
layout(binding = 1) uniform sampler2D GB_Normal;
layout(binding = 2) uniform sampler2D GB_Color;
layout(location = 0) flat in uint FragmentTexID;
layout(location = 1) in vec2 FragmentTexCoord;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor=texture(GB_Normal,FragmentTexCoord);
}

View File

@ -1,13 +0,0 @@
#version 450 core
layout(location = 0) in vec2 Vertex;
layout(location = 0) out uint FragmentTexID;
layout(location = 1) out vec2 FragmentTexCoord;
void main()
{
gl_Position=vec4(Vertex,0.0,1.0);
FragmentTexCoord=(Vertex+1.0)/2.0;
}

View File

@ -1,29 +0,0 @@
#version 450
layout (binding = 1) uniform sampler2D TextureColor;
layout (binding = 2) uniform sampler2D TextureNormal;
layout(location = 0) in vec3 FragmentNormal;
layout(location = 1) in vec3 FragmentTangent;
layout(location = 2) in vec3 FragmentPosition;
layout(location = 3) in vec2 FragmentTexCoord;
layout (location = 0) out vec4 outPosition;
layout (location = 1) out vec4 outNormal;
layout (location = 2) out vec4 outColor;
void main()
{
outPosition=vec4(normalize(FragmentPosition*2.0-vec3(1.0)),1.0);
vec3 N = normalize(FragmentNormal);
vec3 T = normalize(FragmentTangent);
vec3 B = cross(N,T);
mat3 TBN = mat3(T,B,N);
vec3 tnorm = (texture(TextureNormal,FragmentTexCoord).xyz*2.0-vec3(1.0))*TBN;
outNormal=vec4(normalize(tnorm),1.0);
//outNormal=vec4(normalize(FragmentNormal),1.0);
outColor=texture(TextureColor,FragmentTexCoord);
}

View File

@ -1,47 +0,0 @@
#version 450 core
layout(location = 0) in vec3 Vertex;
layout(location = 1) in vec2 TexCoord;
layout(location = 2) in vec3 Normal;
layout(location = 3) in vec3 Tangent;
layout(binding=0) uniform WorldMatrix // hgl/math/Math.h
{
mat4 ortho;
mat4 projection;
mat4 inverse_projection;
mat4 modelview;
mat4 inverse_modelview;
mat4 mvp;
mat4 inverse_mvp;
vec4 view_pos;
vec2 resolution;
} world;
layout(push_constant) uniform Consts {
mat4 local_to_world;
} pc;
layout(location = 0) out vec3 FragmentNormal;
layout(location = 1) out vec3 FragmentTangent;
layout(location = 2) out vec3 FragmentPosition;
layout(location = 3) out vec2 FragmentTexCoord;
void main()
{
vec4 pos=vec4(Vertex,1.0)*pc.local_to_world;
gl_Position=pos*world.mvp;
FragmentPosition=(pos*world.modelview).xyz;
FragmentTexCoord=TexCoord;
mat3 n=mat3(pc.local_to_world*world.modelview);
FragmentNormal=normalize(Normal)*n;
FragmentTangent=normalize(Tangent)*n;
}

View File

@ -1 +0,0 @@
#version 460 core

View File

@ -1 +0,0 @@
#version 320 es

View File

@ -1,34 +0,0 @@
#version 450 core
layout(binding = 2) uniform sampler2D tex;
layout(location = 0) in vec2 FragmentTexCoord;
layout(location = 0) out vec4 FragColor;
vec4 hqfilter(sampler2D samp, vec2 tc)
{
// Get the size of the texture we'll be sampling from
vec2 texSize = textureSize(samp, 0);
// Scale our input texture coordinates up, move to center of texel
vec2 uvScaled = tc * texSize + 0.5;
// Find integer and fractional parts of texture coordinate
vec2 uvInt = floor(uvScaled);
vec2 uvFrac = fract(uvScaled);
// Replace fractional part of texture coordinate
uvFrac = smoothstep(0.0, 1.0, uvFrac);
// Reassemble texture coordinate, remove bias, and
// scale back to 0.0 - 1.0 ranage
vec2 uv = (uvInt + uvFrac - 0.5) / texSize;
// Regular texture lookup
return texture(samp, uv);
}
void main()
{
FragColor=hqfilter(tex,FragmentTexCoord);
}

View File

@ -1,4 +0,0 @@
layout(std430,push_constant,row_major) uniform Consts {
mat4 local_to_world;
mat3 normal;
} pc;

View File

@ -1 +0,0 @@
glslangValidator -V -o %1.spv %1

View File

@ -1,33 +0,0 @@
glslangValidator -V -o FlatColor.vert.spv FlatColor.vert
glslangValidator -V -o FlatColor3D.vert.spv FlatColor3D.vert
glslangValidator -V -o OnlyPosition.vert.spv OnlyPosition.vert
glslangValidator -V -o FlatColor.frag.spv FlatColor.frag
glslangValidator -V -o VertexColor.frag.spv VertexColor.frag
glslangValidator -V -o FlatTexture.vert.spv FlatTexture.vert
glslangValidator -V -o FlatTexture.frag.spv FlatTexture.frag
glslangValidator -V -o PositionColor3D.vert.spv PositionColor3D.vert
glslangValidator -V -o OnlyPosition3D.vert.spv OnlyPosition3D.vert
glslangValidator -V -o c_gbuffer.vert.spv c_gbuffer.vert
glslangValidator -V -o c_gbuffer.frag.spv c_gbuffer.frag
glslangValidator -V -o Atomsphere.vert.spv Atomsphere.vert
glslangValidator -V -o Atomsphere.frag.spv Atomsphere.frag
glslangValidator -V -o gbuffer_opaque.vert.spv gbuffer_opaque.vert
glslangValidator -V -o gbuffer_opaque.frag.spv gbuffer_opaque.frag
glslangValidator -V -o gbuffer_composition.vert.spv gbuffer_composition.vert
glslangValidator -V -o gbuffer_composition.frag.spv gbuffer_composition.frag
glslangValidator -V -o gbuffer_debug.vert.spv gbuffer_debug.vert
glslangValidator -V -o gbuffer_debug.frag.spv gbuffer_debug.frag
glslangValidator -V -o drand48.frag.spv drand48.frag
glslangValidator -V -o Texture2D.vert.spv Texture2D.vert
glslangValidator -V -o hqfilter.frag.spv hqfilter.frag
glslangValidator -V -o FragCoord.frag.spv FragCoord.frag

View File

@ -1,33 +0,0 @@
glslangValidator -V -o FlatColor.vert.spv FlatColor.vert
glslangValidator -V -o FlatColor3D.vert.spv FlatColor3D.vert
glslangValidator -V -o OnlyPosition.vert.spv OnlyPosition.vert
glslangValidator -V -o FlatColor.frag.spv FlatColor.frag
glslangValidator -V -o VertexColor.frag.spv VertexColor.frag
glslangValidator -V -o FlatTexture.vert.spv FlatTexture.vert
glslangValidator -V -o FlatTexture.frag.spv FlatTexture.frag
glslangValidator -V -o PositionColor3D.vert.spv PositionColor3D.vert
glslangValidator -V -o OnlyPosition3D.vert.spv OnlyPosition3D.vert
glslangValidator -V -o c_gbuffer.vert.spv c_gbuffer.vert
glslangValidator -V -o c_gbuffer.frag.spv c_gbuffer.frag
glslangValidator -V -o Atomsphere.vert.spv Atomsphere.vert
glslangValidator -V -o Atomsphere.frag.spv Atomsphere.frag
glslangValidator -V -o gbuffer_opaque.vert.spv gbuffer_opaque.vert
glslangValidator -V -o gbuffer_opaque.frag.spv gbuffer_opaque.frag
glslangValidator -V -o gbuffer_composition.vert.spv gbuffer_composition.vert
glslangValidator -V -o gbuffer_composition.frag.spv gbuffer_composition.frag
glslangValidator -V -o gbuffer_debug.vert.spv gbuffer_debug.vert
glslangValidator -V -o gbuffer_debug.frag.spv gbuffer_debug.frag
glslangValidator -V -o drand48.frag.spv drand48.frag
glslangValidator -V -o Texture2D.vert.spv Texture2D.vert
glslangValidator -V -o hqfilter.frag.spv hqfilter.frag
glslangValidator -V -o FragCoord.frag.spv FragCoord.frag

View File

@ -1,411 +0,0 @@
/*
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
vec4 encodeRE8(float _r)
{
float exponent = ceil(log2(_r) );
return vec4(_r / exp2(exponent)
, 0.0
, 0.0
, (exponent + 128.0) / 255.0
);
}
float decodeRE8(vec4 _re8)
{
float exponent = _re8.w * 255.0 - 128.0;
return _re8.x * exp2(exponent);
}
vec4 encodeRGBE8(vec3 _rgb)
{
vec4 rgbe8;
float maxComponent = max(max(_rgb.x, _rgb.y), _rgb.z);
float exponent = ceil(log2(maxComponent) );
rgbe8.xyz = _rgb / exp2(exponent);
rgbe8.w = (exponent + 128.0) / 255.0;
return rgbe8;
}
vec3 decodeRGBE8(vec4 _rgbe8)
{
float exponent = _rgbe8.w * 255.0 - 128.0;
vec3 rgb = _rgbe8.xyz * exp2(exponent);
return rgb;
}
vec3 encodeNormalUint(vec3 _normal)
{
return _normal * 0.5 + 0.5;
}
vec3 decodeNormalUint(vec3 _encodedNormal)
{
return _encodedNormal * 2.0 - 1.0;
}
vec2 encodeNormalSphereMap(vec3 _normal)
{
return normalize(_normal.xy) * sqrt(_normal.z * 0.5 + 0.5);
}
vec3 decodeNormalSphereMap(vec2 _encodedNormal)
{
float zz = dot(_encodedNormal, _encodedNormal) * 2.0 - 1.0;
return vec3(normalize(_encodedNormal.xy) * sqrt(1.0 - zz*zz), zz);
}
vec2 octahedronWrap(vec2 _val)
{
// Reference(s):
// - Octahedron normal vector encoding
// https://web.archive.org/web/20191027010600/https://knarkowicz.wordpress.com/2014/04/16/octahedron-normal-vector-encoding/comment-page-1/
return (1.0 - abs(_val.yx) )
* mix(vec2_splat(-1.0), vec2_splat(1.0), vec2(greaterThanEqual(_val.xy, vec2_splat(0.0) ) ) );
}
vec2 encodeNormalOctahedron(vec3 _normal)
{
_normal /= abs(_normal.x) + abs(_normal.y) + abs(_normal.z);
_normal.xy = _normal.z >= 0.0 ? _normal.xy : octahedronWrap(_normal.xy);
_normal.xy = _normal.xy * 0.5 + 0.5;
return _normal.xy;
}
vec3 decodeNormalOctahedron(vec2 _encodedNormal)
{
_encodedNormal = _encodedNormal * 2.0 - 1.0;
vec3 normal;
normal.z = 1.0 - abs(_encodedNormal.x) - abs(_encodedNormal.y);
normal.xy = normal.z >= 0.0 ? _encodedNormal.xy : octahedronWrap(_encodedNormal.xy);
return normalize(normal);
}
vec3 convertRGB2XYZ(vec3 _rgb)
{
// Reference(s):
// - RGB/XYZ Matrices
// https://web.archive.org/web/20191027010220/http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
vec3 xyz;
xyz.x = dot(vec3(0.4124564, 0.3575761, 0.1804375), _rgb);
xyz.y = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb);
xyz.z = dot(vec3(0.0193339, 0.1191920, 0.9503041), _rgb);
return xyz;
}
vec3 convertXYZ2RGB(vec3 _xyz)
{
vec3 rgb;
rgb.x = dot(vec3( 3.2404542, -1.5371385, -0.4985314), _xyz);
rgb.y = dot(vec3(-0.9692660, 1.8760108, 0.0415560), _xyz);
rgb.z = dot(vec3( 0.0556434, -0.2040259, 1.0572252), _xyz);
return rgb;
}
vec3 convertXYZ2Yxy(vec3 _xyz)
{
// Reference(s):
// - XYZ to xyY
// https://web.archive.org/web/20191027010144/http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_xyY.html
float inv = 1.0/dot(_xyz, vec3(1.0, 1.0, 1.0) );
return vec3(_xyz.y, _xyz.x*inv, _xyz.y*inv);
}
vec3 convertYxy2XYZ(vec3 _Yxy)
{
// Reference(s):
// - xyY to XYZ
// https://web.archive.org/web/20191027010036/http://www.brucelindbloom.com/index.html?Eqn_xyY_to_XYZ.html
vec3 xyz;
xyz.x = _Yxy.x*_Yxy.y/_Yxy.z;
xyz.y = _Yxy.x;
xyz.z = _Yxy.x*(1.0 - _Yxy.y - _Yxy.z)/_Yxy.z;
return xyz;
}
vec3 convertRGB2Yxy(vec3 _rgb)
{
return convertXYZ2Yxy(convertRGB2XYZ(_rgb) );
}
vec3 convertYxy2RGB(vec3 _Yxy)
{
return convertXYZ2RGB(convertYxy2XYZ(_Yxy) );
}
vec3 convertRGB2Yuv(vec3 _rgb)
{
vec3 yuv;
yuv.x = dot(_rgb, vec3(0.299, 0.587, 0.114) );
yuv.y = (_rgb.x - yuv.x)*0.713 + 0.5;
yuv.z = (_rgb.z - yuv.x)*0.564 + 0.5;
return yuv;
}
vec3 convertYuv2RGB(vec3 _yuv)
{
vec3 rgb;
rgb.x = _yuv.x + 1.403*(_yuv.y-0.5);
rgb.y = _yuv.x - 0.344*(_yuv.y-0.5) - 0.714*(_yuv.z-0.5);
rgb.z = _yuv.x + 1.773*(_yuv.z-0.5);
return rgb;
}
vec3 convertRGB2YIQ(vec3 _rgb)
{
vec3 yiq;
yiq.x = dot(vec3(0.299, 0.587, 0.114 ), _rgb);
yiq.y = dot(vec3(0.595716, -0.274453, -0.321263), _rgb);
yiq.z = dot(vec3(0.211456, -0.522591, 0.311135), _rgb);
return yiq;
}
vec3 convertYIQ2RGB(vec3 _yiq)
{
vec3 rgb;
rgb.x = dot(vec3(1.0, 0.9563, 0.6210), _yiq);
rgb.y = dot(vec3(1.0, -0.2721, -0.6474), _yiq);
rgb.z = dot(vec3(1.0, -1.1070, 1.7046), _yiq);
return rgb;
}
vec3 toLinear(vec3 _rgb)
{
return pow(abs(_rgb), vec3_splat(2.2) );
}
vec4 toLinear(vec4 _rgba)
{
return vec4(toLinear(_rgba.xyz), _rgba.w);
}
vec3 toLinearAccurate(vec3 _rgb)
{
vec3 lo = _rgb / 12.92;
vec3 hi = pow( (_rgb + 0.055) / 1.055, vec3_splat(2.4) );
vec3 rgb = mix(hi, lo, vec3(lessThanEqual(_rgb, vec3_splat(0.04045) ) ) );
return rgb;
}
vec4 toLinearAccurate(vec4 _rgba)
{
return vec4(toLinearAccurate(_rgba.xyz), _rgba.w);
}
float toGamma(float _r)
{
return pow(abs(_r), 1.0/2.2);
}
vec3 toGamma(vec3 _rgb)
{
return pow(abs(_rgb), vec3_splat(1.0/2.2) );
}
vec4 toGamma(vec4 _rgba)
{
return vec4(toGamma(_rgba.xyz), _rgba.w);
}
vec3 toGammaAccurate(vec3 _rgb)
{
vec3 lo = _rgb * 12.92;
vec3 hi = pow(abs(_rgb), vec3_splat(1.0/2.4) ) * 1.055 - 0.055;
vec3 rgb = mix(hi, lo, vec3(lessThanEqual(_rgb, vec3_splat(0.0031308) ) ) );
return rgb;
}
vec4 toGammaAccurate(vec4 _rgba)
{
return vec4(toGammaAccurate(_rgba.xyz), _rgba.w);
}
vec3 toReinhard(vec3 _rgb)
{
return toGamma(_rgb/(_rgb+vec3_splat(1.0) ) );
}
vec4 toReinhard(vec4 _rgba)
{
return vec4(toReinhard(_rgba.xyz), _rgba.w);
}
vec3 toFilmic(vec3 _rgb)
{
_rgb = max(vec3_splat(0.0), _rgb - 0.004);
_rgb = (_rgb*(6.2*_rgb + 0.5) ) / (_rgb*(6.2*_rgb + 1.7) + 0.06);
return _rgb;
}
vec4 toFilmic(vec4 _rgba)
{
return vec4(toFilmic(_rgba.xyz), _rgba.w);
}
vec3 toAcesFilmic(vec3 _rgb)
{
// Reference(s):
// - ACES Filmic Tone Mapping Curve
// https://web.archive.org/web/20191027010704/https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
float aa = 2.51f;
float bb = 0.03f;
float cc = 2.43f;
float dd = 0.59f;
float ee = 0.14f;
return saturate( (_rgb*(aa*_rgb + bb) )/(_rgb*(cc*_rgb + dd) + ee) );
}
vec4 toAcesFilmic(vec4 _rgba)
{
return vec4(toAcesFilmic(_rgba.xyz), _rgba.w);
}
vec3 luma(vec3 _rgb)
{
float yy = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb);
return vec3_splat(yy);
}
vec4 luma(vec4 _rgba)
{
return vec4(luma(_rgba.xyz), _rgba.w);
}
vec3 conSatBri(vec3 _rgb, vec3 _csb)
{
vec3 rgb = _rgb * _csb.z;
rgb = mix(luma(rgb), rgb, _csb.y);
rgb = mix(vec3_splat(0.5), rgb, _csb.x);
return rgb;
}
vec4 conSatBri(vec4 _rgba, vec3 _csb)
{
return vec4(conSatBri(_rgba.xyz, _csb), _rgba.w);
}
vec3 posterize(vec3 _rgb, float _numColors)
{
return floor(_rgb*_numColors) / _numColors;
}
vec4 posterize(vec4 _rgba, float _numColors)
{
return vec4(posterize(_rgba.xyz, _numColors), _rgba.w);
}
vec3 sepia(vec3 _rgb)
{
vec3 color;
color.x = dot(_rgb, vec3(0.393, 0.769, 0.189) );
color.y = dot(_rgb, vec3(0.349, 0.686, 0.168) );
color.z = dot(_rgb, vec3(0.272, 0.534, 0.131) );
return color;
}
vec4 sepia(vec4 _rgba)
{
return vec4(sepia(_rgba.xyz), _rgba.w);
}
vec3 blendOverlay(vec3 _base, vec3 _blend)
{
vec3 lt = 2.0 * _base * _blend;
vec3 gte = 1.0 - 2.0 * (1.0 - _base) * (1.0 - _blend);
return mix(lt, gte, step(vec3_splat(0.5), _base) );
}
vec4 blendOverlay(vec4 _base, vec4 _blend)
{
return vec4(blendOverlay(_base.xyz, _blend.xyz), _base.w);
}
vec3 adjustHue(vec3 _rgb, float _hue)
{
vec3 yiq = convertRGB2YIQ(_rgb);
float angle = _hue + atan2(yiq.z, yiq.y);
float len = length(yiq.yz);
return convertYIQ2RGB(vec3(yiq.x, len*cos(angle), len*sin(angle) ) );
}
vec4 packFloatToRgba(float _value)
{
const vec4 shift = vec4(256 * 256 * 256, 256 * 256, 256, 1.0);
const vec4 mask = vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
vec4 comp = fract(_value * shift);
comp -= comp.xxyz * mask;
return comp;
}
float unpackRgbaToFloat(vec4 _rgba)
{
const vec4 shift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);
return dot(_rgba, shift);
}
vec2 packHalfFloat(float _value)
{
const vec2 shift = vec2(256, 1.0);
const vec2 mask = vec2(0, 1.0 / 256.0);
vec2 comp = fract(_value * shift);
comp -= comp.xx * mask;
return comp;
}
float unpackHalfFloat(vec2 _rg)
{
const vec2 shift = vec2(1.0 / 256.0, 1.0);
return dot(_rg, shift);
}
float random(vec2 _uv)
{
return fract(sin(dot(_uv.xy, vec2(12.9898, 78.233) ) ) * 43758.5453);
}
vec3 fixCubeLookup(vec3 _v, float _lod, float _topLevelCubeSize)
{
// Reference(s):
// - Seamless cube-map filtering
// https://web.archive.org/web/20190411181934/http://the-witness.net/news/2012/02/seamless-cube-map-filtering/
float ax = abs(_v.x);
float ay = abs(_v.y);
float az = abs(_v.z);
float vmax = max(max(ax, ay), az);
float scale = 1.0 - exp2(_lod) / _topLevelCubeSize;
if (ax != vmax) { _v.x *= scale; }
if (ay != vmax) { _v.y *= scale; }
if (az != vmax) { _v.z *= scale; }
return _v;
}
vec2 texture2DBc5(sampler2D _sampler, vec2 _uv)
{
#if BGFX_SHADER_LANGUAGE_HLSL && BGFX_SHADER_LANGUAGE_HLSL <= 3
return texture2D(_sampler, _uv).yx;
#else
return texture2D(_sampler, _uv).xy;
#endif
}
mat3 cofactor(mat4 _m)
{
// Reference:
// Cofactor of matrix. Use to transform normals. The code assumes the last column of _m is [0,0,0,1].
// https://www.shadertoy.com/view/3s33zj
// https://github.com/graphitemaster/normals_revisited
return mat3(
_m[1][1]*_m[2][2]-_m[1][2]*_m[2][1],
_m[1][2]*_m[2][0]-_m[1][0]*_m[2][2],
_m[1][0]*_m[2][1]-_m[1][1]*_m[2][0],
_m[0][2]*_m[2][1]-_m[0][1]*_m[2][2],
_m[0][0]*_m[2][2]-_m[0][2]*_m[2][0],
_m[0][1]*_m[2][0]-_m[0][0]*_m[2][1],
_m[0][1]*_m[1][2]-_m[0][2]*_m[1][1],
_m[0][2]*_m[1][0]-_m[0][0]*_m[1][2],
_m[0][0]*_m[1][1]-_m[0][1]*_m[1][0]
);
}

View File

@ -1,15 +0,0 @@
#version 450 core
layout(binding = 0) uniform WorldMatrix
{
mat4 two_dim;
mat4 projection;
mat4 modelview;
mat4 mvp;
mat3 normal;
} world;
void main()
{
gl_Position=vec4(1.0)*world.mvp;
}

View File

@ -1,25 +0,0 @@
#ifdef THIS_IS_VERTEX_SHADER
#define VS_OUTPUT_LAYOUT out
#else
#define VS_OUTPUT_LAYOUT in
#endif//THIS_IS_VERTEX_SHADER
#ifdef FS_USE_POSITION
layout(location = 0) VS_OUTPUT_LAYOUT vec3 v2fPosition;
#endif//FS_USE_POSITION
#ifdef FS_USE_COLOR
layout(location = 1) VS_OUTPUT_LAYOUT vec3 v2fColor;
#endif//FS_USE_COLOR
#ifdef FS_USE_NORMAL
layout(location = 2) VS_OUTPUT_LAYOUT vec3 v2fNormal;
#endif//FS_USE_NORMAL
#ifdef FS_USE_TANGENT
layout(location = 3) VS_OUTPUT_LAYOUT vec3 v2fTangent;
#endif//FS_USE_TANGENT
#ifdef FS_USE_TEX_COORD
layout(location = 4) VS_OUTPUT_LAYOUT vec2 v2fTexCoord;
#endif//FS_USE_TEX_COORD