Created
April 16, 2013 20:22
-
-
Save adventureloop/5399288 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 330 | |
in vec4 position; | |
in vec4 color; | |
in vec3 normal; | |
in vec2 textureCoord; | |
out vec4 outColor; | |
uniform mat4 perspectiveMatrix; | |
void main() | |
{ | |
vec2 text = textureCoord * 1.0; | |
vec4 tempPosition = position + vec4(0.5,-1.0,-1.5,0.0); | |
gl_Position = tempPosition * perspectiveMatrix; | |
//Do some lighting | |
vec4 ambientIntensity = vec4(0.5,0.5,0.5,1.0); | |
vec4 lightIntensity = vec4(1.0,1.0,1.0,1.0); | |
vec3 dirToLight = vec3(0.866,0.5,0.5); | |
mat3 normalMatrix = mat3(1.0); | |
vec3 normcap = normalize(normalMatrix * normal); | |
float cosAngIncidence = dot(normal, dirToLight); | |
cosAngIncidence = clamp(cosAngIncidence, 0, 1); | |
outColor= (color * lightIntensity * cosAngIncidence) + | |
(color * ambientIntensity); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment