Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 330
- layout(location = 0) in vec4 position;
- layout(location = 2) in vec3 normal;
- uniform vec3 dirToLightSource;
- uniform vec4 lightIntensity;
- uniform mat4 cameraToClipMatrix;
- uniform mat4 modelToCameraMatrix;
- uniform mat3 normalModelToCameraMatrix;
- uniform vec4 color;
- out vec4 theColor;
- void main()
- {
- gl_Position = (modelToCameraMatrix * position);
- vec3 normCamSpace = normalize(modelToCameraMatrix * vec4(normal, 0)).xyz;
- float cosAngIncidence = dot(normCamSpace, dirToLightSource);
- cosAngIncidence = clamp(cosAngIncidence, 0.0, 1.0);
- theColor = lightIntensity * color * cosAngIncidence;
- theColor = vec4(normCamSpace, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment