X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fblock.hpp;h=1c1dddb10c3e4377f6e5d1b6617be38eedf00674;hb=82426ae2997d2b21703d2d5afb631a84736e975f;hp=1fa9c8416a4d694fcaa715f08463df7c3aeb3db6;hpb=804bde3fc09e4317eef629861638a68bfad3e343;p=blank.git diff --git a/src/block.hpp b/src/block.hpp index 1fa9c84..1c1dddb 100644 --- a/src/block.hpp +++ b/src/block.hpp @@ -29,33 +29,20 @@ struct BlockType { const glm::vec3 &outline_color = { -1, -1, -1 }) : id(-1), visible(v), shape(shape), color(color), outline_color(outline_color) { } - static const BlockType DEFAULT; static const NullShape DEFAULT_SHAPE; - void FillVBO( - const glm::vec3 &pos, - std::vector &vertices, - std::vector &colors, - std::vector &normals + void FillModel( + Model &m, + const glm::vec3 &pos_offset = { 0, 0, 0 }, + Model::Index idx_offset = 0 ) const; - - void FillModel(const glm::vec3 &pos, Model &m) const { - FillVBO(pos, m.vertices, m.colors, m.normals); - m.Invalidate(); - } - - - void FillOutlineVBO( - std::vector &vertices, - std::vector &colors + void FillOutlineModel( + OutlineModel &m, + const glm::vec3 &pos_offset = { 0, 0, 0 }, + OutlineModel::Index idx_offset = 0 ) const; - void FillOutlineModel(OutlineModel &m) const { - FillOutlineVBO(m.vertices, m.colors); - m.Invalidate(); - } - }; @@ -81,10 +68,12 @@ private: /// single 1x1x1 cube struct Block { - const BlockType *type; + using Pos = glm::vec3; + + int type; - constexpr explicit Block(const BlockType *t = &BlockType::DEFAULT) - : type(t) { } + constexpr explicit Block(int type = 0) + : type(type) { } };