aboutsummaryrefslogtreecommitdiff
path: root/shaders/cook_torrance.vert
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/cook_torrance.vert')
-rw-r--r--shaders/cook_torrance.vert24
1 files changed, 12 insertions, 12 deletions
diff --git a/shaders/cook_torrance.vert b/shaders/cook_torrance.vert
index 5f126c0..17fe1f7 100644
--- a/shaders/cook_torrance.vert
+++ b/shaders/cook_torrance.vert
@@ -5,7 +5,7 @@ uniform mat4 ModelMatrix;
5uniform mat4 View; 5uniform mat4 View;
6uniform mat4 Projection; 6uniform mat4 Projection;
7//uniform mat4 MVP; 7//uniform mat4 MVP;
8#ifdef HAS_JOINTS 8#if HAS_JOINTS
9// The client should pass in an appropriate value for MAX_JOINTS. 9// The client should pass in an appropriate value for MAX_JOINTS.
10// #define MAX_JOINTS 96 10// #define MAX_JOINTS 96
11// 11//
@@ -21,35 +21,35 @@ uniform mat4 JointMatrices[MAX_JOINTS]; // Use 4x4 for now to keep it simple.
21#endif 21#endif
22 22
23layout (location = 0) in vec3 vPosition; 23layout (location = 0) in vec3 vPosition;
24#ifdef HAS_NORMALS 24#if HAS_NORMALS
25layout (location = 1) in vec3 vNormal; 25layout (location = 1) in vec3 vNormal;
26#endif 26#endif
27#ifdef HAS_TANGENTS 27#if HAS_TANGENTS
28layout (location = 2) in vec4 vTangent; 28layout (location = 2) in vec4 vTangent;
29#endif 29#endif
30#ifdef HAS_TEXCOORDS 30#if HAS_TEXCOORDS
31layout (location = 3) in vec2 vTexcoord; 31layout (location = 3) in vec2 vTexcoord;
32#endif 32#endif
33#ifdef HAS_JOINTS 33#if HAS_JOINTS
34layout (location = 4) in uvec4 vJoint; 34layout (location = 4) in uvec4 vJoint;
35layout (location = 5) in vec4 vWeight; 35layout (location = 5) in vec4 vWeight;
36#endif 36#endif
37 37
38// World-space position, normal and tangent. 38// World-space position, normal and tangent.
39out vec3 Position; 39out vec3 Position;
40#ifdef HAS_NORMALS 40#if HAS_NORMALS
41out vec3 Normal; 41out vec3 Normal;
42#endif 42#endif
43#ifdef HAS_TANGENTS 43#if HAS_TANGENTS
44out vec4 Tangent; 44out vec4 Tangent;
45#endif 45#endif
46#ifdef HAS_TEXCOORDS 46#if HAS_TEXCOORDS
47out vec2 Texcoord; 47out vec2 Texcoord;
48#endif 48#endif
49 49
50void main() 50void main()
51{ 51{
52#ifdef HAS_JOINTS 52#if HAS_JOINTS
53 mat4 skinMatrix = 53 mat4 skinMatrix =
54 vWeight.x * JointMatrices[vJoint.x] + 54 vWeight.x * JointMatrices[vJoint.x] +
55 vWeight.y * JointMatrices[vJoint.y] + 55 vWeight.y * JointMatrices[vJoint.y] +
@@ -59,14 +59,14 @@ void main()
59#else 59#else
60 Position = vec3(ModelMatrix * vec4(vPosition, 1.0)); 60 Position = vec3(ModelMatrix * vec4(vPosition, 1.0));
61#endif 61#endif
62#ifdef HAS_NORMALS 62#if HAS_NORMALS
63 Normal = mat3(ModelMatrix) * vNormal; 63 Normal = mat3(ModelMatrix) * vNormal;
64 //Normal = normalize(ModelMatrix * vec4(vNormal, 0.0)).xyz; 64 //Normal = normalize(ModelMatrix * vec4(vNormal, 0.0)).xyz;
65#endif 65#endif
66#ifdef HAS_TANGENTS 66#if HAS_TANGENTS
67 Tangent = vec4(mat3(ModelMatrix) * vTangent.xyz, vTangent.w); 67 Tangent = vec4(mat3(ModelMatrix) * vTangent.xyz, vTangent.w);
68#endif 68#endif
69#ifdef HAS_TEXCOORDS 69#if HAS_TEXCOORDS
70 Texcoord = vTexcoord; 70 Texcoord = vTexcoord;
71#endif 71#endif
72 gl_Position = Projection * View * vec4(Position, 1.0); 72 gl_Position = Projection * View * vec4(Position, 1.0);