This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
csce441pine64backup/L07/resources/vert.glsl
2017-02-28 14:06:03 -06:00

15 lines
386 B
GLSL

#version 120
uniform mat4 P;
uniform mat4 MV;
attribute vec4 aPos; // In object space
attribute vec3 aNor; // In object space
varying vec3 color;
void main()
{
gl_Position = P * MV * aPos;
vec3 l = vec3(0.0, 0.0, 1.0); // In camera space
vec4 n = MV * vec4(aNor, 0.0);
color = vec3((n.x*l.x + n.y*l.y + n.z*l.z), (n.x*l.x + n.y*l.y + n.z*l.z), (n.x*l.x + n.y*l.y + n.z*l.z));
}