diff --git a/res/image/Brickwall/Albedo.tga b/res/image/Brickwall/Albedo.tga deleted file mode 100644 index 5a7b5e7c..00000000 Binary files a/res/image/Brickwall/Albedo.tga and /dev/null differ diff --git a/res/image/Brickwall/Displacement.tga b/res/image/Brickwall/Displacement.tga deleted file mode 100644 index 4eb8116b..00000000 Binary files a/res/image/Brickwall/Displacement.tga and /dev/null differ diff --git a/res/image/Brickwall/Normal.tga b/res/image/Brickwall/Normal.tga deleted file mode 100644 index 6908eff7..00000000 Binary files a/res/image/Brickwall/Normal.tga and /dev/null differ diff --git a/res/image/Brickwall/Roughness.tga b/res/image/Brickwall/Roughness.tga deleted file mode 100644 index bbe0f72a..00000000 Binary files a/res/image/Brickwall/Roughness.tga and /dev/null differ diff --git a/res/image/Conical.tga b/res/image/Conical.tga deleted file mode 100644 index df5fe9e3..00000000 Binary files a/res/image/Conical.tga and /dev/null differ diff --git a/res/image/Gear.tga b/res/image/Gear.tga deleted file mode 100644 index e56330f4..00000000 Binary files a/res/image/Gear.tga and /dev/null differ diff --git a/res/image/TexCoord.tga b/res/image/TexCoord.tga deleted file mode 100644 index 7ab9c116..00000000 Binary files a/res/image/TexCoord.tga and /dev/null differ diff --git a/res/image/Yong.tga b/res/image/Yong.tga deleted file mode 100644 index 766e6566..00000000 Binary files a/res/image/Yong.tga and /dev/null differ diff --git a/res/image/brdflut.tga b/res/image/brdflut.tga deleted file mode 100644 index afcbbe66..00000000 Binary files a/res/image/brdflut.tga and /dev/null differ diff --git a/res/image/flat_normal.tga b/res/image/flat_normal.tga deleted file mode 100644 index 6cb78490..00000000 Binary files a/res/image/flat_normal.tga and /dev/null differ diff --git a/res/image/lena.tga b/res/image/lena.tga deleted file mode 100644 index e13151b2..00000000 Binary files a/res/image/lena.tga and /dev/null differ diff --git a/res/image/noise32.tga b/res/image/noise32.tga deleted file mode 100644 index b1195fe6..00000000 Binary files a/res/image/noise32.tga and /dev/null differ diff --git a/res/image/vulkan-red.svg b/res/image/vulkan-red.svg deleted file mode 100644 index a38f3c0a..00000000 --- a/res/image/vulkan-red.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/model/color_teapot_spheres.glb b/res/model/color_teapot_spheres.glb deleted file mode 100644 index 30a84ab2..00000000 Binary files a/res/model/color_teapot_spheres.glb and /dev/null differ diff --git a/res/model/vulkanlogo.assbin b/res/model/vulkanlogo.assbin deleted file mode 100644 index d7996424..00000000 Binary files a/res/model/vulkanlogo.assbin and /dev/null differ diff --git a/res/shader/Atomsphere.frag b/res/shader/Atomsphere.frag deleted file mode 100644 index 2e1eca69..00000000 --- a/res/shader/Atomsphere.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/Atomsphere.vert b/res/shader/Atomsphere.vert deleted file mode 100644 index 7d80f6bc..00000000 --- a/res/shader/Atomsphere.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/FlatColor.frag b/res/shader/FlatColor.frag deleted file mode 100644 index 3fce7d30..00000000 --- a/res/shader/FlatColor.frag +++ /dev/null @@ -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; -} diff --git a/res/shader/FlatColor.material b/res/shader/FlatColor.material deleted file mode 100644 index e69de29b..00000000 diff --git a/res/shader/FlatColor.vert b/res/shader/FlatColor.vert deleted file mode 100644 index c3f777a5..00000000 --- a/res/shader/FlatColor.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/FlatColor3D.vert b/res/shader/FlatColor3D.vert deleted file mode 100644 index 2cfe1cb2..00000000 --- a/res/shader/FlatColor3D.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/FlatTexture.frag b/res/shader/FlatTexture.frag deleted file mode 100644 index f979a503..00000000 --- a/res/shader/FlatTexture.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/FlatTexture.vert b/res/shader/FlatTexture.vert deleted file mode 100644 index 83b58341..00000000 --- a/res/shader/FlatTexture.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/FragCoord.frag b/res/shader/FragCoord.frag deleted file mode 100644 index c007be20..00000000 --- a/res/shader/FragCoord.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/OnlyPosition.vert b/res/shader/OnlyPosition.vert deleted file mode 100644 index f1a7f770..00000000 --- a/res/shader/OnlyPosition.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/OnlyPosition3D.vert b/res/shader/OnlyPosition3D.vert deleted file mode 100644 index c6d3b259..00000000 --- a/res/shader/OnlyPosition3D.vert +++ /dev/null @@ -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); -} diff --git a/res/shader/PositionColor3D.vert b/res/shader/PositionColor3D.vert deleted file mode 100644 index 1f42239e..00000000 --- a/res/shader/PositionColor3D.vert +++ /dev/null @@ -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); -} diff --git a/res/shader/Random.glsl b/res/shader/Random.glsl deleted file mode 100644 index 65a1b5bb..00000000 --- a/res/shader/Random.glsl +++ /dev/null @@ -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)); -} diff --git a/res/shader/Texture2D.vert b/res/shader/Texture2D.vert deleted file mode 100644 index 11a4733d..00000000 --- a/res/shader/Texture2D.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/ToneMapping.glsl b/res/shader/ToneMapping.glsl deleted file mode 100644 index a714b549..00000000 --- a/res/shader/ToneMapping.glsl +++ /dev/null @@ -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; -} diff --git a/res/shader/UBO_WorldMatrix.glsl b/res/shader/UBO_WorldMatrix.glsl deleted file mode 100644 index 8a079472..00000000 --- a/res/shader/UBO_WorldMatrix.glsl +++ /dev/null @@ -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; diff --git a/res/shader/VertexColor.frag b/res/shader/VertexColor.frag deleted file mode 100644 index 1e87450b..00000000 --- a/res/shader/VertexColor.frag +++ /dev/null @@ -1,9 +0,0 @@ -#version 450 core - -layout(location = 0) in vec4 FragmentColor; -layout(location = 0) out vec4 FragColor; - -void main() -{ - FragColor=FragmentColor; -} diff --git a/res/shader/VertexNormal.frag b/res/shader/VertexNormal.frag deleted file mode 100644 index a516dcd6..00000000 --- a/res/shader/VertexNormal.frag +++ /dev/null @@ -1,9 +0,0 @@ -#version 450 core - -layout(location = 0) in vec4 FragmentNormal; -layout(location = 0) out vec4 FragColor; - -void main() -{ - FragColor=FragmentNormal; -} diff --git a/res/shader/WorldMatrix.ubo b/res/shader/WorldMatrix.ubo deleted file mode 100644 index b986c85f..00000000 --- a/res/shader/WorldMatrix.ubo +++ /dev/null @@ -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; diff --git a/res/shader/c_gbuffer.frag b/res/shader/c_gbuffer.frag deleted file mode 100644 index 71c1b6fb..00000000 --- a/res/shader/c_gbuffer.frag +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/res/shader/c_gbuffer.vert b/res/shader/c_gbuffer.vert deleted file mode 100644 index 49d471ae..00000000 --- a/res/shader/c_gbuffer.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/cnmr.gbuffer b/res/shader/cnmr.gbuffer deleted file mode 100644 index 3fa9672a..00000000 --- a/res/shader/cnmr.gbuffer +++ /dev/null @@ -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; diff --git a/res/shader/cnp.gbuffer b/res/shader/cnp.gbuffer deleted file mode 100644 index 87b6e612..00000000 --- a/res/shader/cnp.gbuffer +++ /dev/null @@ -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); diff --git a/res/shader/color.gbuffer b/res/shader/color.gbuffer deleted file mode 100644 index 88cf0708..00000000 --- a/res/shader/color.gbuffer +++ /dev/null @@ -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); diff --git a/res/shader/drand48.frag b/res/shader/drand48.frag deleted file mode 100644 index cb980eb9..00000000 --- a/res/shader/drand48.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/gbuffer_composition.frag b/res/shader/gbuffer_composition.frag deleted file mode 100644 index 9563b5ec..00000000 --- a/res/shader/gbuffer_composition.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/gbuffer_composition.vert b/res/shader/gbuffer_composition.vert deleted file mode 100644 index 2edde84d..00000000 --- a/res/shader/gbuffer_composition.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/gbuffer_debug.frag b/res/shader/gbuffer_debug.frag deleted file mode 100644 index 0392bc87..00000000 --- a/res/shader/gbuffer_debug.frag +++ /dev/null @@ -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); -} - diff --git a/res/shader/gbuffer_debug.vert b/res/shader/gbuffer_debug.vert deleted file mode 100644 index 83bd7966..00000000 --- a/res/shader/gbuffer_debug.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/gbuffer_opaque.frag b/res/shader/gbuffer_opaque.frag deleted file mode 100644 index 6eecfe1f..00000000 --- a/res/shader/gbuffer_opaque.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/gbuffer_opaque.vert b/res/shader/gbuffer_opaque.vert deleted file mode 100644 index 6f25106c..00000000 --- a/res/shader/gbuffer_opaque.vert +++ /dev/null @@ -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; -} diff --git a/res/shader/header_desktop.glsl b/res/shader/header_desktop.glsl deleted file mode 100644 index 4ebd0de3..00000000 --- a/res/shader/header_desktop.glsl +++ /dev/null @@ -1 +0,0 @@ -#version 460 core diff --git a/res/shader/header_mobile.glsl b/res/shader/header_mobile.glsl deleted file mode 100644 index 3589ccdf..00000000 --- a/res/shader/header_mobile.glsl +++ /dev/null @@ -1 +0,0 @@ -#version 320 es diff --git a/res/shader/hqfilter.frag b/res/shader/hqfilter.frag deleted file mode 100644 index bc033721..00000000 --- a/res/shader/hqfilter.frag +++ /dev/null @@ -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); -} diff --git a/res/shader/push_constant_3d.glsl b/res/shader/push_constant_3d.glsl deleted file mode 100644 index 933ce0c0..00000000 --- a/res/shader/push_constant_3d.glsl +++ /dev/null @@ -1,4 +0,0 @@ -layout(std430,push_constant,row_major) uniform Consts { - mat4 local_to_world; - mat3 normal; -} pc; diff --git a/res/shader/sc.bat b/res/shader/sc.bat deleted file mode 100644 index 29050f54..00000000 --- a/res/shader/sc.bat +++ /dev/null @@ -1 +0,0 @@ -glslangValidator -V -o %1.spv %1 diff --git a/res/shader/shader_compile.bat b/res/shader/shader_compile.bat deleted file mode 100644 index e40bc611..00000000 --- a/res/shader/shader_compile.bat +++ /dev/null @@ -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 diff --git a/res/shader/shader_compile.sh b/res/shader/shader_compile.sh deleted file mode 100755 index e40bc611..00000000 --- a/res/shader/shader_compile.sh +++ /dev/null @@ -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 diff --git a/res/shader/shaderlib.glsl b/res/shader/shaderlib.glsl deleted file mode 100644 index dde5ca5b..00000000 --- a/res/shader/shaderlib.glsl +++ /dev/null @@ -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] - ); -} diff --git a/res/shader/test.geom b/res/shader/test.geom deleted file mode 100644 index c8f3cf27..00000000 --- a/res/shader/test.geom +++ /dev/null @@ -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; -} diff --git a/res/shader/vertex_shader_output_layout.glsl b/res/shader/vertex_shader_output_layout.glsl deleted file mode 100644 index 90f1b6e5..00000000 --- a/res/shader/vertex_shader_output_layout.glsl +++ /dev/null @@ -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