]> git.localhorst.tv Git - blank.git/blobdiff - src/world.cpp
block type colors
[blank.git] / src / world.cpp
index 2dd7b307a6ffa292fd24027414af746a5123504b..96b48ee120d96ee4e79bec833936fb7ae310c2e8 100644 (file)
@@ -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()