]> git.localhorst.tv Git - blobs.git/blobdiff - src/graphics/viewport.cpp
randomize creature properties a bit
[blobs.git] / src / graphics / viewport.cpp
index 2d9b469236a07d8f2ce84da43d014530836c09e7..ac0b9e5c5b7c1516ea2795f615f581bc50861c4a 100644 (file)
@@ -1,7 +1,7 @@
 #include "Camera.hpp"
 #include "Viewport.hpp"
 
-#include "../const.hpp"
+#include "../math/const.hpp"
 #include "../world/Body.hpp"
 
 #include <cmath>
@@ -120,8 +120,9 @@ glm::mat4 Camera::Model(const world::Body &b) const noexcept {
                        ? ref->InverseTransform() * ref->ToParent() * b.LocalTransform()
                        : ref->ToParent() * b.LocalTransform();
        } else {
-               // TODO: model matrices for path distances > 1
-               return track_orient ? glm::mat4(1.0f) : glm::mat4(ref->LocalTransform());
+               return track_orient
+                       ? ref->InverseTransform() * ref->ToUniverse() * b.FromUniverse() * b.LocalTransform()
+                       : ref->ToUniverse() * b.FromUniverse() * b.LocalTransform();
        }
 }
 
@@ -151,5 +152,9 @@ void Viewport::Clear() {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
 
+void Viewport::ClearDepth() {
+       glClear(GL_DEPTH_BUFFER_BIT);
+}
+
 }
 }