X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fblock.cpp;h=b0de21aff95bf52d1538ec703b4cf55d6fc82f19;hb=9c1f7b20394808f7ec7a6cadd9e0dd665c6f6bd5;hp=e22d3e63d8ce309f71903a00a69cb985461483dc;hpb=7caa2326d25d4fc5ba98318dfccb508bb3e16820;p=blank.git diff --git a/src/block.cpp b/src/block.cpp index e22d3e6..b0de21a 100644 --- a/src/block.cpp +++ b/src/block.cpp @@ -5,23 +5,22 @@ namespace blank { const NullShape BlockType::DEFAULT_SHAPE; -void BlockType::FillVBO( - const glm::vec3 &pos, - std::vector &vertices, - std::vector &colors, - std::vector &normals +void BlockType::FillModel( + Model &model, + const glm::vec3 &pos_offset, + Model::Index idx_offset ) const { - shape->Vertices(vertices, pos); - colors.insert(colors.end(), shape->VertexCount(), color); - shape->Normals(normals); + shape->Vertices(model.vertices, model.normals, model.indices, pos_offset, idx_offset); + model.colors.insert(model.colors.end(), shape->VertexCount(), color); } -void BlockType::FillOutlineVBO( - std::vector &vertices, - std::vector &colors +void BlockType::FillOutlineModel( + OutlineModel &model, + const glm::vec3 &pos_offset, + OutlineModel::Index idx_offset ) const { - shape->Outline(vertices); - colors.insert(colors.end(), shape->OutlineCount(), outline_color); + shape->Outline(model.vertices, model.indices, pos_offset, idx_offset); + model.colors.insert(model.colors.end(), shape->OutlineCount(), outline_color); } @@ -29,7 +28,7 @@ BlockTypeRegistry::BlockTypeRegistry() { Add(BlockType()); } -int BlockTypeRegistry::Add(const BlockType &t) { +Block::Type BlockTypeRegistry::Add(const BlockType &t) { int id = types.size(); types.push_back(t); types.back().id = id;