]> git.localhorst.tv Git - blank.git/blobdiff - src/model/model.cpp
sky box model & shader
[blank.git] / src / model / model.cpp
index 72de1dadfa304f9d0026e30411def46cc022a839..7aaf8f613b931a595e16a89800197260dd6fd044 100644 (file)
@@ -1,8 +1,11 @@
 #include "BlockModel.hpp"
 #include "EntityModel.hpp"
 #include "OutlineModel.hpp"
+#include "SkyBoxModel.hpp"
 #include "SpriteModel.hpp"
 
+#include "shapes.hpp"
+
 #include <algorithm>
 #include <iostream>
 
@@ -84,6 +87,24 @@ void OutlineModel::Draw() noexcept {
 }
 
 
+void SkyBoxModel::LoadUnitBox() {
+       Buffer buffer;
+       CuboidShape shape({{ -1, -1, -1 }, { 1, 1, 1 }});
+       shape.Vertices(buffer);
+       Update(buffer);
+}
+
+void SkyBoxModel::Update(const Buffer &buf) noexcept {
+       vao.Bind();
+       vao.PushAttribute(ATTRIB_VERTEX, buf.vertices);
+       vao.PushIndices(ATTRIB_INDEX, buf.indices);
+}
+
+void SkyBoxModel::Draw() const noexcept {
+       vao.DrawTriangleElements();
+}
+
+
 void SpriteModel::Buffer::LoadRect(
        float w, float h,
        const glm::vec2 &pivot,