-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreflection.vert
More file actions
33 lines (25 loc) · 757 Bytes
/
reflection.vert
File metadata and controls
33 lines (25 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/////////////////////////////////////////////////////////////////////////
// Vertex shader for Reflection
//
// Copyright 2013 DigiPen Institute of Technology
////////////////////////////////////////////////////////////////////////
#version 330
uniform mat4 ModelTr;
uniform float ReflectDir;
uniform vec3 Eye;
in vec4 vertex;
void LightingVertex(vec3 eye);
void main()
{
vec3 worldPos = (ModelTr*vertex).xyz;
LightingVertex(Eye);
vec3 P = worldPos;
vec3 R = P - Eye;
float distR = length(R);
vec3 normalR = normalize(R);
float a = normalR.x;
float b = normalR.y;
float c = normalR.z;
float denominator = 1.0 + (ReflectDir * c);
gl_Position = vec4((a / denominator), b / denominator, distR * (ReflectDir * c) / 1000.0 - 1.0, 1.0);
}