Permalink
Browse files

Merge branch 'master' of github.com:nddrylliog/envmap

  • Loading branch information...
Amos Wenger
Amos Wenger committed Nov 22, 2011
2 parents 9b3f169 + 35d1aed commit 80d3eb451be07b6d46a471ecfbbc8bc269feea9c
Showing with 10 additions and 10 deletions.
  1. +10 −10 data/testShaderReflection.vs
@@ -6,25 +6,25 @@ uniform mat3 WorldCameraNormalTransform;
uniform mat3 ModelWorldNormalTransform;
uniform vec3 DiffuseColor;
-uniform float3 EyePosition
+uniform float3 EyePosition;
varying vec3 VertexToLightVector;
varying vec3 Normal;
varying vec4 Color;
+varying vec3 ReflectedRay;
+vec3 reflect(vec3 I, vec3 N){return I - 2.0 * N * dot(N, I);}
void main()
{
- // Exercise 3.2.5 and 3.3.1
gl_Position = ProjectionMatrix * WorldCameraTransform * ModelWorldTransform * gl_Vertex;
+ gl_TexCoord[0] = gl_MultiTexCoord0;
- color = vec4(diffuseColor, 1.0);
- //gl_TexCoord[0] = gl_MultiTexCoord0;
- normal = WorldCameraNormalTransform * ModelWorldNormalTransform * gl_Normal;
- //vertex_to_light_vector = - vec3(WorldCameraTransform * ModelWorldTransform * gl_Vertex);
- // need this line so OpenGL doesn't optimize out the variables -- remove in your solution
- // {
- ModelWorldTransform; WorldCameraTransform; ProjectionMatrix; WorldCameraNormalTransform; ModelWorldNormalTransform; normal; color;
- // }
+ vec3 WorldPosition = (ModelWorldTransform * gl_Vertex).xyz;
+ Normal = normalize((ModelWorldNormalTransform * gl_Normal));
+
+ vec3 IncidentRay = WorldPosition - EyePosition;
+ ReflectedRay = reflect(IncidentRay, Normal);
+
}

0 comments on commit 80d3eb4

Please sign in to comment.