Skip to content
Browse files

dos2unix on templates

  • Loading branch information...
1 parent bb74747 commit 4f6c61e0e0cff0e22a05625819dd2c5a5bfda249 @lubosz committed
Showing with 233 additions and 233 deletions.
  1. +109 −109 templates/Post/DeferredMultiLight.frag
  2. +18 −18 templates/Post/HDR.frag
  3. +81 −81 templates/Post/MultiTarget.frag
  4. +14 −14 templates/Post/Post.frag
  5. +11 −11 templates/Post/Post.vert
View
218 templates/Post/DeferredMultiLight.frag
@@ -1,112 +1,112 @@
-{% extends "base.frag" %}
-
-{% block linkage %}
+{% extends "base.frag" %}
+
+{% block linkage %}
#define LIGHTS {{ lightCount }}
-in vec2 uv;
-struct LightSource {
- vec4 position;
- vec4 diffuse;
- vec4 specular;
- vec4 direction;
-};
-
-out vec4 finalTarget;
-out vec4 finalSpecularTarget;
-out vec4 finalDiffuseTarget;
-out vec4 envTarget;
-{% endblock %}
-
-{% block uniforms %}
-uniform sampler2D positionTarget;
-uniform sampler2D normalTarget;
-uniform sampler2D diffuseTarget;
-uniform sampler2D tangentTarget;
-uniform sampler2D normalMapTarget;
-uniform sampler2D finalAOTarget;
-uniform samplerCube envMap;
-//uniform sampler2D shadowTarget;
-
-uniform LightSourceBuffer {
+in vec2 uv;
+struct LightSource {
+ vec4 position;
+ vec4 diffuse;
+ vec4 specular;
+ vec4 direction;
+};
+
+out vec4 finalTarget;
+out vec4 finalSpecularTarget;
+out vec4 finalDiffuseTarget;
+out vec4 envTarget;
+{% endblock %}
+
+{% block uniforms %}
+uniform sampler2D positionTarget;
+uniform sampler2D normalTarget;
+uniform sampler2D diffuseTarget;
+uniform sampler2D tangentTarget;
+uniform sampler2D normalMapTarget;
+uniform sampler2D finalAOTarget;
+uniform samplerCube envMap;
+//uniform sampler2D shadowTarget;
+
+uniform LightSourceBuffer {
LightSource lightSources[LIGHTS];
-};
-
-uniform vec4 camPosition;
-
-const int shininess = 32;
-//const int shininess = 1;
-
-float saturate(float input) {
- return clamp(input, 0.0, 1.0);
-}
-
-{% endblock %}
-
-{% block main %}
- vec4 position = texture(positionTarget, uv);
- vec4 normal = texture(normalTarget, uv);
- vec4 tangent = texture(tangentTarget, uv);
- vec3 binormal = cross(tangent.xyz, normal.xyz);
- vec4 diffuse = texture(diffuseTarget, uv);
-
- //normalmapping
- vec3 eyeVec = vec3(
- dot(-position.xyz, tangent.xyz),
- dot(-position.xyz, binormal.xyz),
- dot(-position.xyz, normal.xyz)
- );
- vec3 bump = normalize( texture(normalMapTarget, uv).xyz * 2.0 - 1.0);
- //endnormalmapping
-
- //env
- vec3 reflectDir = reflect(-position.xyz, normal.xyz);
- envTarget = texture(envMap, reflectDir);
-
- float ambient = texture(finalAOTarget, uv).r;
- finalSpecularTarget = vec4(0);
- finalDiffuseTarget = vec4(0);
-
+};
+
+uniform vec4 camPosition;
+
+const int shininess = 32;
+//const int shininess = 1;
+
+float saturate(float input) {
+ return clamp(input, 0.0, 1.0);
+}
+
+{% endblock %}
+
+{% block main %}
+ vec4 position = texture(positionTarget, uv);
+ vec4 normal = texture(normalTarget, uv);
+ vec4 tangent = texture(tangentTarget, uv);
+ vec3 binormal = cross(tangent.xyz, normal.xyz);
+ vec4 diffuse = texture(diffuseTarget, uv);
+
+ //normalmapping
+ vec3 eyeVec = vec3(
+ dot(-position.xyz, tangent.xyz),
+ dot(-position.xyz, binormal.xyz),
+ dot(-position.xyz, normal.xyz)
+ );
+ vec3 bump = normalize( texture(normalMapTarget, uv).xyz * 2.0 - 1.0);
+ //endnormalmapping
+
+ //env
+ vec3 reflectDir = reflect(-position.xyz, normal.xyz);
+ envTarget = texture(envMap, reflectDir);
+
+ float ambient = texture(finalAOTarget, uv).r;
+ finalSpecularTarget = vec4(0);
+ finalDiffuseTarget = vec4(0);
+
for(int i = 0; i < LIGHTS ; i++) {
- vec4 lightDirection = lightSources[i].position - position;
- //normalmapping
- vec3 lightVec = normalize(vec3(
- dot(lightDirection.xyz, tangent.xyz),
- dot(lightDirection.xyz, binormal.xyz),
- dot(lightDirection.xyz, normal.xyz)
- ));
- float diffuseBump = max( dot(lightVec, bump), 0.0 );
-
- //endnormalmapping
- vec4 L = normalize(lightDirection);
- vec4 N = normalize(normal);
- float lambertTerm = max( dot(N,L), 0.0);
- finalDiffuseTarget += diffuse * lambertTerm * lightSources[i].diffuse * diffuseBump;
-
- //vec4 viewDirection = camPosition - position;
- //vec4 E = normalize(-viewDirection);
- //vec4 R = reflect(-L, N);
-
- //float specular = pow( max(dot(R, E), 0.0), shininess );
- float specular = pow(clamp(dot(
- reflect(-lightVec, bump),
- normalize(eyeVec)
- ),
- 0.0,
- 1.0
- ), shininess );
-
-
- //fragColor = lambertTerm * vec4(1);
- finalSpecularTarget += ((lightSources[i].diffuse + envTarget) / 2) * specular;
- //fragColor = R;
-
-
-
-
- }
- finalTarget = (finalDiffuseTarget + finalSpecularTarget) * ambient;
- //fragColor *= texture(diffuseTarget, uv)* texture(envTarget, uv);
- //fragColor *= 1-ambient;// * texture(shadowTarget, uv).x;
- //fragColor = vec4(foo/5);
-
- //fragColor = texture(finalAOTarget, uv);
-{% endblock %}
+ vec4 lightDirection = lightSources[i].position - position;
+ //normalmapping
+ vec3 lightVec = normalize(vec3(
+ dot(lightDirection.xyz, tangent.xyz),
+ dot(lightDirection.xyz, binormal.xyz),
+ dot(lightDirection.xyz, normal.xyz)
+ ));
+ float diffuseBump = max( dot(lightVec, bump), 0.0 );
+
+ //endnormalmapping
+ vec4 L = normalize(lightDirection);
+ vec4 N = normalize(normal);
+ float lambertTerm = max( dot(N,L), 0.0);
+ finalDiffuseTarget += diffuse * lambertTerm * lightSources[i].diffuse * diffuseBump;
+
+ //vec4 viewDirection = camPosition - position;
+ //vec4 E = normalize(-viewDirection);
+ //vec4 R = reflect(-L, N);
+
+ //float specular = pow( max(dot(R, E), 0.0), shininess );
+ float specular = pow(clamp(dot(
+ reflect(-lightVec, bump),
+ normalize(eyeVec)
+ ),
+ 0.0,
+ 1.0
+ ), shininess );
+
+
+ //fragColor = lambertTerm * vec4(1);
+ finalSpecularTarget += ((lightSources[i].diffuse + envTarget) / 2) * specular;
+ //fragColor = R;
+
+
+
+
+ }
+ finalTarget = (finalDiffuseTarget + finalSpecularTarget) * ambient;
+ //fragColor *= texture(diffuseTarget, uv)* texture(envTarget, uv);
+ //fragColor *= 1-ambient;// * texture(shadowTarget, uv).x;
+ //fragColor = vec4(foo/5);
+
+ //fragColor = texture(finalAOTarget, uv);
+{% endblock %}
View
36 templates/Post/HDR.frag
@@ -1,18 +1,18 @@
-{% extends "base.frag" %}
-
-{% block linkage %}
-in vec2 uv;
-{% endblock %}
-
-{% block uniforms %}
-uniform sampler2D targetTexture;
-//uniform sampler2DRect targetTexture;
-uniform float exposure;
-{% endblock %}
-
-
-{% block main %}
- vec4 color = texture(targetTexture, uv);
- //vec4 color = textureRect(targetTexture, uv * 1024.0);
- fragColor = 1.0 - exp(color * -exposure);
-{% endblock %}
+{% extends "base.frag" %}
+
+{% block linkage %}
+in vec2 uv;
+{% endblock %}
+
+{% block uniforms %}
+uniform sampler2D targetTexture;
+//uniform sampler2DRect targetTexture;
+uniform float exposure;
+{% endblock %}
+
+
+{% block main %}
+ vec4 color = texture(targetTexture, uv);
+ //vec4 color = textureRect(targetTexture, uv * 1024.0);
+ fragColor = 1.0 - exp(color * -exposure);
+{% endblock %}
View
162 templates/Post/MultiTarget.frag
@@ -1,83 +1,83 @@
-{% extends "base.frag" %}
-
-{% block linkage %}
-in vec4 positionView;
-in vec3 normalView;
-in vec3 tangentView;
-in vec2 uv;
-out vec4 positionTarget;
-out vec4 normalTarget;
-out vec4 diffuseTarget;
-out vec4 tangentTarget;
-out vec4 normalMapTarget;
-out vec4 shadowTarget;
-
-//out float depthTarget;
-{% endblock %}
-
-{% block uniforms %}
-uniform sampler2D diffuseTexture;
-uniform sampler2D normalTexture;
-//uniform sampler2DShadow {{shadowDepthSource}};
-
-{% for shadowSampler in shadowSamplers %}
-uniform sampler2DShadow {{shadowSampler}};
+{% extends "base.frag" %}
+
+{% block linkage %}
+in vec4 positionView;
+in vec3 normalView;
+in vec3 tangentView;
+in vec2 uv;
+out vec4 positionTarget;
+out vec4 normalTarget;
+out vec4 diffuseTarget;
+out vec4 tangentTarget;
+out vec4 normalMapTarget;
+out vec4 shadowTarget;
+
+//out float depthTarget;
+{% endblock %}
+
+{% block uniforms %}
+uniform sampler2D diffuseTexture;
+uniform sampler2D normalTexture;
+//uniform sampler2DShadow {{shadowDepthSource}};
+
+{% for shadowSampler in shadowSamplers %}
+uniform sampler2DShadow {{shadowSampler}};
//bias*perspLight*viewLight*(viewCam^-1)
uniform mat4 camViewToShadowMapMatrix{{shadowSampler}};
-{% endfor %}
-
-{% endblock %}
-
-
-{% block functions %}
-/*
-float xPixelOffset = 1.0/1366.0;
-float yPixelOffset = 1.0/768.0;
-
-float lookup( vec2 offSet,vec4 shadowTexCoord){
- // Values are multiplied by ShadowCoord.w because shadow2DProj does a W division for us.
- return textureProj( {{shadowDepthSource}},
- shadowTexCoord
- + vec4(
- offSet.x * xPixelOffset * shadowTexCoord.w,
- offSet.y * yPixelOffset * shadowTexCoord.w,
- 0,
- 0
- )
- );
-}
-*/
-{% endblock %}
-
-{% block main %}
- positionTarget = positionView;
- normalTarget = vec4(normalView,1);
- tangentTarget = vec4(tangentView,1);
- diffuseTarget = texture(diffuseTexture, uv*5);
- normalMapTarget = texture(normalTexture, uv*5);
-
- //shadow
- shadowTarget = vec4(1);
- vec4 shadowTexCoord;
- float shadowSum = 0;
-{% for shadowSampler in shadowSamplers %}
- shadowTexCoord = camViewToShadowMapMatrix{{shadowSampler}} * positionView;
- shadowSum += textureProj({{shadowSampler}}, shadowTexCoord);
-{% endfor %}
-
- shadowTarget*= shadowSum/5.0;
-
- /*
- // 8x8 kernel PCF
- vec4 shadowTexCoord = camViewToShadowMapMatrix * positionView;
- float shadow = 0;
- float x,y;
- for (y = -3.5 ; y <=3.5 ; y+=1.0)
- for (x = -3.5 ; x <=3.5 ; x+=1.0)
- shadow += lookup(vec2(x,y),shadowTexCoord);
-
- shadow /= 32.0;
- */
- //gl_FragDepth = positionView.z/20;
- //depthTarget = positionView.z/20;
-{% endblock %}
+{% endfor %}
+
+{% endblock %}
+
+
+{% block functions %}
+/*
+float xPixelOffset = 1.0/1366.0;
+float yPixelOffset = 1.0/768.0;
+
+float lookup( vec2 offSet,vec4 shadowTexCoord){
+ // Values are multiplied by ShadowCoord.w because shadow2DProj does a W division for us.
+ return textureProj( {{shadowDepthSource}},
+ shadowTexCoord
+ + vec4(
+ offSet.x * xPixelOffset * shadowTexCoord.w,
+ offSet.y * yPixelOffset * shadowTexCoord.w,
+ 0,
+ 0
+ )
+ );
+}
+*/
+{% endblock %}
+
+{% block main %}
+ positionTarget = positionView;
+ normalTarget = vec4(normalView,1);
+ tangentTarget = vec4(tangentView,1);
+ diffuseTarget = texture(diffuseTexture, uv*5);
+ normalMapTarget = texture(normalTexture, uv*5);
+
+ //shadow
+ shadowTarget = vec4(1);
+ vec4 shadowTexCoord;
+ float shadowSum = 0;
+{% for shadowSampler in shadowSamplers %}
+ shadowTexCoord = camViewToShadowMapMatrix{{shadowSampler}} * positionView;
+ shadowSum += textureProj({{shadowSampler}}, shadowTexCoord);
+{% endfor %}
+
+ shadowTarget*= shadowSum/5.0;
+
+ /*
+ // 8x8 kernel PCF
+ vec4 shadowTexCoord = camViewToShadowMapMatrix * positionView;
+ float shadow = 0;
+ float x,y;
+ for (y = -3.5 ; y <=3.5 ; y+=1.0)
+ for (x = -3.5 ; x <=3.5 ; x+=1.0)
+ shadow += lookup(vec2(x,y),shadowTexCoord);
+
+ shadow /= 32.0;
+ */
+ //gl_FragDepth = positionView.z/20;
+ //depthTarget = positionView.z/20;
+{% endblock %}
View
28 templates/Post/Post.frag
@@ -1,14 +1,14 @@
-{% extends "base.frag" %}
-
-{% block linkage %}
-in vec2 uv;
-{% endblock %}
-
-{% block uniforms %}
-uniform sampler2D targetTexture;
-{% endblock %}
-
-
-{% block main %}
- fragColor = texture(targetTexture, uv);
-{% endblock %}
+{% extends "base.frag" %}
+
+{% block linkage %}
+in vec2 uv;
+{% endblock %}
+
+{% block uniforms %}
+uniform sampler2D targetTexture;
+{% endblock %}
+
+
+{% block main %}
+ fragColor = texture(targetTexture, uv);
+{% endblock %}
View
22 templates/Post/Post.vert
@@ -1,11 +1,11 @@
-{% extends "base.vert" %}
-
-{% block linkage %}
-in vec2 in_Uv;
-out vec2 uv;
-{% endblock %}
-
-{% block main %}
- uv = in_Uv;
- gl_Position = MVPMatrix * vec4(in_Vertex,1);
-{% endblock %}
+{% extends "base.vert" %}
+
+{% block linkage %}
+in vec2 in_Uv;
+out vec2 uv;
+{% endblock %}
+
+{% block main %}
+ uv = in_Uv;
+ gl_Position = MVPMatrix * vec4(in_Vertex,1);
+{% endblock %}

0 comments on commit 4f6c61e

Please sign in to comment.
Something went wrong with that request. Please try again.