]> git.localhorst.tv Git - blank.git/commitdiff
some outline improvements
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 19 Aug 2015 09:56:29 +0000 (11:56 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 19 Aug 2015 10:01:52 +0000 (12:01 +0200)
assets
src/app/app.cpp
src/model/Shape.hpp
src/model/shape.cpp
src/world/BlockType.hpp
src/world/block.cpp

diff --git a/assets b/assets
index 424ac96eaafa7e1eb49fabcc9f670a5aa3f54ca3..7f1ebb8448f866ac28ea14b0dd8792edebedcf5a 160000 (submodule)
--- a/assets
+++ b/assets
@@ -1 +1 @@
-Subproject commit 424ac96eaafa7e1eb49fabcc9f670a5aa3f54ca3
+Subproject commit 7f1ebb8448f866ac28ea14b0dd8792edebedcf5a
index a6acade2c30f3f8eaf898160b922e84b0b810cac..610f995c135a68cf221595652cfe044400a62706 100644 (file)
@@ -269,6 +269,8 @@ void Assets::LoadBlockTypes(const std::string &set_name, BlockTypeRegistry &reg,
                                type.texture = tex_index.GetID(tex_name);
                        } else if (name == "color") {
                                in.ReadVec(type.color);
+                       } else if (name == "outline") {
+                               in.ReadVec(type.outline_color);
                        } else if (name == "label") {
                                in.ReadString(type.label);
                        } else if (name == "luminosity") {
index 51b950f90ebe52b19865776097a7a5c881a201e6..28a36ab6445afd585328a2999ad3ea8967011bb0 100644 (file)
@@ -51,13 +51,8 @@ struct Shape {
        /// the number of vertex indices this shape's outline has
        size_t OutlineIndexCount() const { return out_idx.size(); }
 
-       /// fill given buffers with this shape's outline's elements with
-       /// an optional offset
-       void Outline(
-               OutlineModel::Buffer &out,
-               const OutlineModel::Position &offset = { 0.0f, 0.0f, 0.0f },
-               OutlineModel::Index idx_offset = 0
-       ) const;
+       /// fill given buffers with this shape's outline's elements
+       void Outline(OutlineModel::Buffer &out) const;
 
        /// Check if given ray would pass though this shape if it were
        /// transformed with given matrix.
index c2d82613eff27d416fe7697d0a07da81eca183ed..4ee5b8f24299c74163c48d5bc3c5c7b46d5ae773 100644 (file)
@@ -59,17 +59,9 @@ void Shape::Vertices(
        }
 }
 
-void Shape::Outline(
-       OutlineModel::Buffer &out,
-       const OutlineModel::Position &elem_offset,
-       OutlineModel::Index idx_offset
-) const {
-       for (const auto &pos : out_pos) {
-               out.vertices.emplace_back(elem_offset + pos);
-       }
-       for (auto idx : out_idx) {
-               out.indices.emplace_back(idx_offset + idx);
-       }
+void Shape::Outline(OutlineModel::Buffer &out) const {
+       out.vertices.insert(out.vertices.end(), out_pos.begin(), out_pos.end());
+       out.indices.insert(out.indices.end(), out_idx.begin(), out_idx.end());
 }
 
 void Shape::SetShape(
index 95a960566b02fc57975ced99b13633166b643875..bdc4721e96dea3b4762cc219190b4d0c49379ff6 100644 (file)
@@ -74,11 +74,7 @@ struct BlockType {
                const glm::mat4 &transform = glm::mat4(1.0f),
                BlockModel::Index idx_offset = 0
        ) const noexcept;
-       void FillOutlineModel(
-               OutlineModel::Buffer &m,
-               const glm::vec3 &pos_offset = { 0, 0, 0 },
-               OutlineModel::Index idx_offset = 0
-       ) const noexcept;
+       void FillOutlineModel(OutlineModel::Buffer &m) const noexcept;
 
 };
 
index 54ceba081b035036164e6537919c8feca29e085e..09acfef9efcc01a2504c63459736fec9df5bd056 100644 (file)
@@ -103,12 +103,8 @@ void BlockType::FillBlockModel(
        buf.colors.insert(buf.colors.end(), shape->VertexCount(), color);
 }
 
-void BlockType::FillOutlineModel(
-       OutlineModel::Buffer &buf,
-       const glm::vec3 &pos_offset,
-       OutlineModel::Index idx_offset
-) const noexcept {
-       shape->Outline(buf, pos_offset, idx_offset);
+void BlockType::FillOutlineModel(OutlineModel::Buffer &buf) const noexcept {
+       shape->Outline(buf);
        buf.colors.insert(buf.colors.end(), shape->OutlineCount(), outline_color);
 }