X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld.cpp;h=96b48ee120d96ee4e79bec833936fb7ae310c2e8;hb=ac8765b510707d77cac9620778f40ddf3a4ad2a2;hp=2dd7b307a6ffa292fd24027414af746a5123504b;hpb=482114e156e91729f2529ea6bb1fe98dacdee97f;p=blank.git diff --git a/src/world.cpp b/src/world.cpp index 2dd7b30..96b48ee 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -48,12 +48,7 @@ void BlockType::FillVBO( vertices.emplace_back(pos.x + 1, pos.y + 1, pos.z ); vertices.emplace_back(pos.x + 1, pos.y + 1, pos.z + 1); - colors.insert(colors.end(), 6, glm::vec3(1.0f, 1.0f, 1.0f)); // front - colors.insert(colors.end(), 6, glm::vec3(1.0f, 1.0f, 1.0f)); // back - colors.insert(colors.end(), 6, glm::vec3(1.0f, 1.0f, 1.0f)); // top - colors.insert(colors.end(), 6, glm::vec3(1.0f, 1.0f, 1.0f)); // bottom - colors.insert(colors.end(), 6, glm::vec3(1.0f, 1.0f, 1.0f)); // left - colors.insert(colors.end(), 6, glm::vec3(1.0f, 1.0f, 1.0f)); // right + colors.insert(colors.end(), 6 * 6, color); normals.insert(normals.end(), 6, glm::vec3( 0.0f, 0.0f, 1.0f)); // front normals.insert(normals.end(), 6, glm::vec3( 0.0f, 0.0f, -1.0f)); // back @@ -64,6 +59,18 @@ void BlockType::FillVBO( } +BlockTypeRegistry::BlockTypeRegistry() { + Add(BlockType::DEFAULT); +} + +int BlockTypeRegistry::Add(const BlockType &t) { + int id = types.size(); + types.push_back(t); + types.back().id = id; + return id; +} + + Chunk::Chunk() : blocks(Size()) , model()