]> git.localhorst.tv Git - blank.git/blobdiff - src/shader.cpp
move controller from camera to world
[blank.git] / src / shader.cpp
index 99bdb74dec9995727f44470b8cddd34d85489739..43b3910096789bb4aaece8133abd8ac2b42e75a4 100644 (file)
@@ -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;
 }