Skip to content

Commit

Permalink
Add tileCount uniform to fragment shader
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Apr 13, 2014
1 parent 3b7c61b commit 68ddaa7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ao.fsh
Expand Up @@ -2,6 +2,7 @@ precision highp float;

uniform float tileSize;
uniform sampler2D tileMap;
uniform float tileCount;

varying vec3 normal;
varying vec2 tileCoord;
Expand All @@ -15,7 +16,7 @@ void main() {
float weight = 0.0;

vec2 tileOffset = 2.0 * tileSize * tileCoord;
float denom = 2.0 * tileSize * 16.0;
float denom = 2.0 * tileSize * tileCount;

for(int dx=0; dx<2; ++dx) {
for(int dy=0; dy<2; ++dy) {
Expand All @@ -36,4 +37,4 @@ void main() {
float light = ambientOcclusion + max(0.15*dot(normal, vec3(1,1,1)), 0.0);

gl_FragColor = vec4(color.xyz * light, 1.0);
}
}

0 comments on commit 68ddaa7

Please sign in to comment.