From 783b308990e7c4ef0837a102a138778f73e4d2b7 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 15 Feb 2015 15:23:19 -0500 Subject: Added bloom! --- shaders/final.vertex | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'shaders/final.vertex') diff --git a/shaders/final.vertex b/shaders/final.vertex index 825eb49..dda8626 100644 --- a/shaders/final.vertex +++ b/shaders/final.vertex @@ -4,11 +4,28 @@ layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 1) in vec3 vertexNormal; out vec2 UV; -out vec3 norm; +out vec3 normIn; +out vec3 camDirIn; +out vec3 lightDirIn; +//out vec3 vertPos; + +uniform mat4 MVP; +uniform mat4 worldMat; + +const vec3 Tuning_LightPos = vec3(1, 1, 1.0); void main() { - gl_Position = vec4(vertexPosition_modelspace,1); + gl_Position = MVP * vec4(vertexPosition_modelspace,1); UV = (vertexPosition_modelspace.xy+vec2(1,1))/2.0; - norm = vertexNormal; + normIn = vertexNormal; + + mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz)); + //mat3 invWorldRot = mat3(1.0f); + vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz; + camDirIn = invWorldRot * (vec3(0,0,1) - worldPos); + //camDir = worldPos; + lightDirIn = invWorldRot * (Tuning_LightPos - worldPos); + //vec4 vertPos4 = vec4(vertexPosition_modelspace,1); + //vertPos = vec3(vertPos4) / vertPos4.w; } -- cgit 1.4.1