X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fshader.cpp;h=43b3910096789bb4aaece8133abd8ac2b42e75a4;hb=753be639d7d04f9f7415db9fc2721485c531f0a1;hp=99bdb74dec9995727f44470b8cddd34d85489739;hpb=982b69ce8c393ae18beed5239191b8bc2ee1d5d1;p=blank.git diff --git a/src/shader.cpp b/src/shader.cpp index 99bdb74..43b3910 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -206,7 +206,24 @@ void DirectionalLighting::SetM(const glm::mat4 &m) { glUniformMatrix4fv(mvp_handle, 1, GL_FALSE, &mvp[0][0]); } +void DirectionalLighting::SetLightDirection(const glm::vec3 &dir) { + light_direction = -dir; + glUniform3f(light_direction_handle, light_direction.x, light_direction.y, light_direction.z); +} + +void DirectionalLighting::SetProjection(const glm::mat4 &p) { + projection = p; + vp = p * view; +} + +void DirectionalLighting::SetView(const glm::mat4 &v) { + view = v; + vp = projection * v; +} + void DirectionalLighting::SetVP(const glm::mat4 &v, const glm::mat4 &p) { + projection = p; + view = v; vp = p * v; }