1234567891011121314151617181920212223242526272829303132 |
- #version 430
- layout (location = 0) in vec3 position;
- layout (location = 1) in vec2 tex;
- layout (location = 2) in vec3 normal;
- uniform mat4 proj;
- uniform mat4 view;
- uniform mat4 model;
- uniform mat4 projViewShadow;
- out vec3 varPosition;
- out vec2 varTex;
- out vec3 varNormal;
- out vec4 varShadow;
- void main(void) {
- // transforming normals must not use the fourth dimension
- // should be the inverse transposed matrix
- varNormal = (model * vec4(normal, 0.0)).xyz;
-
- varTex = tex;
-
- vec4 modelPos = model * vec4(position, 1.0);
- vec4 worldPos = view * modelPos;
- varPosition = worldPos.xyz;
- gl_Position = proj * worldPos;
- varShadow = projViewShadow * modelPos;
- }
|