3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 13:55:31 +02:00

Shader code indentation

This commit is contained in:
Niraj Venkat 2015-07-27 12:20:41 -07:00
parent 1193b89918
commit d2ee74f7c7
4 changed files with 45 additions and 45 deletions

View file

@ -80,10 +80,10 @@ void main(void) {
vec3 normal = normalize(texture2D(normalTexture, varTexcoord).xyz);
//normal = normalize(normal * normalMatrix);
vec3 rvec = vec3(getRandom(varTexcoord.xy), getRandom(varTexcoord.yx), getRandom(varTexcoord.xx)) * 2.0 - 1.0;
vec3 rvec = vec3(getRandom(varTexcoord.xy), getRandom(varTexcoord.yx), getRandom(varTexcoord.xx)) * 2.0 - 1.0;
vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
vec3 bitangent = cross(normal, tangent);
mat3 tbn = mat3(tangent, bitangent, normal);
vec3 bitangent = cross(normal, tangent);
mat3 tbn = mat3(tangent, bitangent, normal);
float occlusion = 0.0;
@ -91,13 +91,13 @@ void main(void) {
vec3 samplePos = origin + (tbn * sampleKernel[i]) * g_sample_rad;
vec4 offset = cam._projectionViewUntranslated * vec4(samplePos, 1.0);
offset.xy = (offset.xy / offset.w) * 0.5 + 0.5;
offset.xy = (offset.xy / offset.w) * 0.5 + 0.5;
float depth = length(samplePos - cameraPositionWorldSpace);
float sampleDepthVal = texture2D(depthTexture, offset.xy).r;
float rangeDelta = abs(depthVal - sampleDepthVal);
float rangeCheck = smoothstep(0.0, 1.0, g_sample_rad / rangeDelta);
float rangeDelta = abs(depthVal - sampleDepthVal);
float rangeCheck = smoothstep(0.0, 1.0, g_sample_rad / rangeDelta);
occlusion += rangeCheck * step(sampleDepthVal, depth);
}

View file

@ -24,17 +24,17 @@ uniform sampler2D occlusionTexture;
void main(void) {
gl_FragColor = vec4(0.0);
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 0])*0.0044299121055113265;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 1])*0.00895781211794;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 2])*0.0215963866053;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 3])*0.0443683338718;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 4])*0.0776744219933;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 5])*0.115876621105;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 6])*0.147308056121;
gl_FragColor += texture2D(occlusionTexture, varTexcoord )*0.159576912161;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 7])*0.147308056121;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 8])*0.115876621105;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[ 9])*0.0776744219933;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[0])*0.0044299121055113265;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[1])*0.00895781211794;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[2])*0.0215963866053;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[3])*0.0443683338718;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[4])*0.0776744219933;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[5])*0.115876621105;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[6])*0.147308056121;
gl_FragColor += texture2D(occlusionTexture, varTexcoord)*0.159576912161;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[7])*0.147308056121;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[8])*0.115876621105;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[9])*0.0776744219933;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[10])*0.0443683338718;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[11])*0.0215963866053;
gl_FragColor += texture2D(occlusionTexture, varBlurTexcoords[12])*0.00895781211794;

View file

@ -23,19 +23,19 @@ void main(void) {
varTexcoord = gl_MultiTexCoord0.xy;
gl_Position = gl_Vertex;
varBlurTexcoords[ 0] = varTexcoord + vec2(-0.028, 0.0);
varBlurTexcoords[ 1] = varTexcoord + vec2(-0.024, 0.0);
varBlurTexcoords[ 2] = varTexcoord + vec2(-0.020, 0.0);
varBlurTexcoords[ 3] = varTexcoord + vec2(-0.016, 0.0);
varBlurTexcoords[ 4] = varTexcoord + vec2(-0.012, 0.0);
varBlurTexcoords[ 5] = varTexcoord + vec2(-0.008, 0.0);
varBlurTexcoords[ 6] = varTexcoord + vec2(-0.004, 0.0);
varBlurTexcoords[ 7] = varTexcoord + vec2( 0.004, 0.0);
varBlurTexcoords[ 8] = varTexcoord + vec2( 0.008, 0.0);
varBlurTexcoords[ 9] = varTexcoord + vec2( 0.012, 0.0);
varBlurTexcoords[10] = varTexcoord + vec2( 0.016, 0.0);
varBlurTexcoords[11] = varTexcoord + vec2( 0.020, 0.0);
varBlurTexcoords[12] = varTexcoord + vec2( 0.024, 0.0);
varBlurTexcoords[13] = varTexcoord + vec2( 0.028, 0.0);
varBlurTexcoords[0] = varTexcoord + vec2(-0.028, 0.0);
varBlurTexcoords[1] = varTexcoord + vec2(-0.024, 0.0);
varBlurTexcoords[2] = varTexcoord + vec2(-0.020, 0.0);
varBlurTexcoords[3] = varTexcoord + vec2(-0.016, 0.0);
varBlurTexcoords[4] = varTexcoord + vec2(-0.012, 0.0);
varBlurTexcoords[5] = varTexcoord + vec2(-0.008, 0.0);
varBlurTexcoords[6] = varTexcoord + vec2(-0.004, 0.0);
varBlurTexcoords[7] = varTexcoord + vec2(0.004, 0.0);
varBlurTexcoords[8] = varTexcoord + vec2(0.008, 0.0);
varBlurTexcoords[9] = varTexcoord + vec2(0.012, 0.0);
varBlurTexcoords[10] = varTexcoord + vec2(0.016, 0.0);
varBlurTexcoords[11] = varTexcoord + vec2(0.020, 0.0);
varBlurTexcoords[12] = varTexcoord + vec2(0.024, 0.0);
varBlurTexcoords[13] = varTexcoord + vec2(0.028, 0.0);
}

View file

@ -23,19 +23,19 @@ void main(void) {
varTexcoord = gl_MultiTexCoord0.xy;
gl_Position = gl_Vertex;
varBlurTexcoords[ 0] = varTexcoord + vec2(0.0, -0.028);
varBlurTexcoords[ 1] = varTexcoord + vec2(0.0, -0.024);
varBlurTexcoords[ 2] = varTexcoord + vec2(0.0, -0.020);
varBlurTexcoords[ 3] = varTexcoord + vec2(0.0, -0.016);
varBlurTexcoords[ 4] = varTexcoord + vec2(0.0, -0.012);
varBlurTexcoords[ 5] = varTexcoord + vec2(0.0, -0.008);
varBlurTexcoords[ 6] = varTexcoord + vec2(0.0, -0.004);
varBlurTexcoords[ 7] = varTexcoord + vec2(0.0, 0.004);
varBlurTexcoords[ 8] = varTexcoord + vec2(0.0, 0.008);
varBlurTexcoords[ 9] = varTexcoord + vec2(0.0, 0.012);
varBlurTexcoords[10] = varTexcoord + vec2(0.0, 0.016);
varBlurTexcoords[11] = varTexcoord + vec2(0.0, 0.020);
varBlurTexcoords[12] = varTexcoord + vec2(0.0, 0.024);
varBlurTexcoords[13] = varTexcoord + vec2(0.0, 0.028);
varBlurTexcoords[0] = varTexcoord + vec2(0.0, -0.028);
varBlurTexcoords[1] = varTexcoord + vec2(0.0, -0.024);
varBlurTexcoords[2] = varTexcoord + vec2(0.0, -0.020);
varBlurTexcoords[3] = varTexcoord + vec2(0.0, -0.016);
varBlurTexcoords[4] = varTexcoord + vec2(0.0, -0.012);
varBlurTexcoords[5] = varTexcoord + vec2(0.0, -0.008);
varBlurTexcoords[6] = varTexcoord + vec2(0.0, -0.004);
varBlurTexcoords[7] = varTexcoord + vec2(0.0, 0.004);
varBlurTexcoords[8] = varTexcoord + vec2(0.0, 0.008);
varBlurTexcoords[9] = varTexcoord + vec2(0.0, 0.012);
varBlurTexcoords[10] = varTexcoord + vec2(0.0, 0.016);
varBlurTexcoords[11] = varTexcoord + vec2(0.0, 0.020);
varBlurTexcoords[12] = varTexcoord + vec2(0.0, 0.024);
varBlurTexcoords[13] = varTexcoord + vec2(0.0, 0.028);
}