aboutsummaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
authorJoshua Rahm <joshua.rahm@colorado.edu>2014-04-26 19:13:45 -0600
committerJoshua Rahm <joshua.rahm@colorado.edu>2014-04-26 19:13:45 -0600
commit7dd8c59353167e84dab9e7a1afc16e2290b249e3 (patch)
tree5218b8f00d95da76257fe4e568f0dfd2160a6b58 /shaders
parent2306aace499e1fedeb8d332d59add3fa7923932b (diff)
downloadterralloc-7dd8c59353167e84dab9e7a1afc16e2290b249e3.tar.gz
terralloc-7dd8c59353167e84dab9e7a1afc16e2290b249e3.tar.bz2
terralloc-7dd8c59353167e84dab9e7a1afc16e2290b249e3.zip
added more documentation. No more floating trees. added tree color variation
Diffstat (limited to 'shaders')
-rw-r--r--shaders/forest.frag3
-rw-r--r--shaders/forest.vert3
2 files changed, 5 insertions, 1 deletions
diff --git a/shaders/forest.frag b/shaders/forest.frag
index 7392a00..f2d7643 100644
--- a/shaders/forest.frag
+++ b/shaders/forest.frag
@@ -16,6 +16,7 @@ uniform float dY ;
in vec2 texposition ;
in vec3 normal ;
in vec4 frag_position ;
+in float shade ;
vec4 sample(float xc,float yc) {
return texture2D(texture,texposition + vec2(xc,yc));
@@ -49,5 +50,5 @@ void main() {
vec4 col = texture2D(texture,texposition) ;
float coef = max(dot( normalize(newNorm),
normalize(vec3(frag_position - light)) ),0) + (globalAmbient.a/4.0) ;
- frag_color = vec4( col.xyz * coef * globalAmbient.xyz, col.a);
+ frag_color = vec4( shade * col.xyz * coef * globalAmbient.xyz, col.a);
}
diff --git a/shaders/forest.vert b/shaders/forest.vert
index ba2cfc4..c52174c 100644
--- a/shaders/forest.vert
+++ b/shaders/forest.vert
@@ -16,15 +16,18 @@ layout(location = 10) in vec3 in_translation ;
layout(location = 11) in vec3 in_scale ;
layout(location = 12) in vec2 in_sincos_rot ;
layout(location = 13) in float noise ;
+layout(location = 14) in float in_shade ;
out vec2 texposition ;
out vec3 normal ;
out vec4 frag_position ;
+out float shade ;
void main() {
float s = in_sincos_rot.x ;
float c = in_sincos_rot.y ;
+ shade = in_shade ;
mat3 rot = mat3( c,0,s,
0,1,0,
-s,0,c ) ;