diff options
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/forest.frag | 3 | ||||
-rw-r--r-- | shaders/forest.vert | 3 |
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 ) ; |