diff options
author | Joshua Rahm <joshua.rahm@colorado.edu> | 2014-04-18 01:28:35 -0600 |
---|---|---|
committer | Joshua Rahm <joshua.rahm@colorado.edu> | 2014-04-18 01:28:35 -0600 |
commit | e4754131548a55fea393d6fc9245b20fcd60c62c (patch) | |
tree | 8ad371c87c22844a4e1762ef5396c894cbd813f1 /shaders | |
parent | 915cda147b565880fecefe5f82ca242bad6114fc (diff) | |
download | terralloc-e4754131548a55fea393d6fc9245b20fcd60c62c.tar.gz terralloc-e4754131548a55fea393d6fc9245b20fcd60c62c.tar.bz2 terralloc-e4754131548a55fea393d6fc9245b20fcd60c62c.zip |
starting tesselation shader
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/water.frag | 17 | ||||
-rw-r--r-- | shaders/water.vert | 23 |
2 files changed, 22 insertions, 18 deletions
diff --git a/shaders/water.frag b/shaders/water.frag index 9298d15..82b8163 100644 --- a/shaders/water.frag +++ b/shaders/water.frag @@ -36,12 +36,13 @@ vec3 calNormChange( vec3 norm, vec3 down, vec3 right ) { } void main() { - vec3 down = vec3( 0, -1, 0 ) ; - vec3 right = normalize(cross( normal, down )) ; - down = normalize(cross( normal, right ) ); - vec3 newNorm = calNormChange( normal, down, right ) ; - - float coef = dot( normalize(vec3(lightPos) - vec3(position)), normalize(newNorm) ) ; - vec4 color = texture2D(texture,texpos) ; - frag_color = vec4(color.xyz * vec3(0.0,0.4,0.7) * coef,0.8); +// vec3 down = vec3( 0, -1, 0 ) ; +// vec3 right = normalize(cross( normal, down )) ; +// down = normalize(cross( normal, right ) ); +// vec3 newNorm = calNormChange( normal, down, right ) ; +// +// float coef = dot( normalize(vec3(lightPos) - vec3(position)), normalize(newNorm) ) ; +// vec4 color = texture2D(texture,texpos) ; +// frag_color = vec4(color.xyz * vec3(0.0,0.4,0.7) * coef,0.8); + frag_color = vec4(0,0,1,0.8) ; } diff --git a/shaders/water.vert b/shaders/water.vert index 765c1df..9913150 100644 --- a/shaders/water.vert +++ b/shaders/water.vert @@ -7,17 +7,20 @@ layout(location = 2) in vec4 in_color ; layout(location = 1) in vec3 in_normal ; layout(location = 3) in vec2 in_texcoord ; -layout(location = 4) uniform mat4 pjMatrix ; -layout(location = 5) uniform mat4 mvMatrix ; -layout(location = 7) uniform mat3 normalMatrix ; +// layout(location = 4) uniform mat4 pjMatrix ; +// layout(location = 5) uniform mat4 mvMatrix ; +// layout(location = 7) uniform mat3 normalMatrix ; +// +// out vec3 lightPos ; +// out vec3 normal ; +// out vec4 position ; +// out vec2 texpos ; -out vec3 lightPos ; -out vec3 normal ; -out vec4 position ; -out vec2 texpos ; +out vec3 controlpoint ; void main() { - gl_Position = pjMatrix * (position = mvMatrix * vec4( in_position, 1.0 )); - normal = normalMatrix * vec3(0,1,0) ; - texpos = in_position.xz / 20.0; + // gl_Position = pjMatrix * (position = mvMatrix * vec4( in_position, 1.0 )); + // normal = normalMatrix * vec3(0,1,0) ; + // texpos = in_position.xz / 20.0; + controlpoint = in_position; } |