]> git.localhorst.tv Git - blank.git/blobdiff - src/block.cpp
use light levels for shading of blocks
[blank.git] / src / block.cpp
index 50ade3901fd65aebdf96ef29ebd2499fc6ffbf41..6e6ac18533d7cf10173a121b4f79839b4e8c3d21 100644 (file)
@@ -51,7 +51,9 @@ BlockType::BlockType(bool v, const glm::vec3 &col, const Shape *s)
 , color(col)
 , outline_color(-1, -1, -1)
 , id(0)
+, luminosity(0)
 , visible(v)
+, block_light(false)
 , fill({ false, false, false, false, false, false }) {
 
 }
@@ -100,6 +102,15 @@ void BlockType::FillModel(
        buf.colors.insert(buf.colors.end(), shape->VertexCount(), color);
 }
 
+void BlockType::FillBlockModel(
+       BlockModel::Buffer &buf,
+       const glm::mat4 &transform,
+       BlockModel::Index idx_offset
+) const {
+       shape->Vertices(buf.vertices, buf.normals, buf.indices, transform, idx_offset);
+       buf.colors.insert(buf.colors.end(), shape->VertexCount(), color);
+}
+
 void BlockType::FillOutlineModel(
        OutlineModel &model,
        const glm::vec3 &pos_offset,