-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlighting.vert
More file actions
38 lines (29 loc) · 991 Bytes
/
Copy pathlighting.vert
File metadata and controls
38 lines (29 loc) · 991 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
34
35
36
37
38
/////////////////////////////////////////////////////////////////////////
// Vertex shader for lighting
//
// Copyright 2013 DigiPen Institute of Technology
////////////////////////////////////////////////////////////////////////
#version 330
uniform mat4 WorldView, WorldInverse, WorldProj, ModelTr, NormalTr, ShadowMatrix;
in vec4 vertex;
in vec3 vertexNormal;
in vec2 vertexTexture;
in vec3 vertexTangent;
out vec3 normalVec, lightVec, eyeVec;
out vec3 tanVec;
out vec2 texCoord;
out vec4 shadowCoord;
uniform vec3 lightPos;
void LightingVertex(vec3 eye)
{
vec3 worldPos = (ModelTr*vertex).xyz;
shadowCoord = ShadowMatrix * ModelTr * vertex;
normalVec = vertexNormal * mat3(NormalTr);
// Compute vectors toward light and eye and output them to frag shader
//eye = (WorldInverse*vec4(0, 0, 0, 1)).xyz;
lightVec = lightPos - worldPos;
eyeVec = eye - worldPos;
lightVec = lightPos - worldPos;
texCoord = vertexTexture;
tanVec = mat3(ModelTr) * vertexTangent;
}