]> git.localhorst.tv Git - blank.git/commitdiff
use symbolic names for block colors
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 17 Nov 2016 09:00:22 +0000 (10:00 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 17 Nov 2016 09:00:22 +0000 (10:00 +0100)
src/world/BlockType.hpp
src/world/block.cpp
src/world/world.cpp

index c55c674721df0b21943e293c7125107762ab7c21..575087f3dfad0ab32c49d05eb84b5230a32e4940 100644 (file)
@@ -25,9 +25,9 @@ struct BlockType {
 
        const Shape *shape;
        std::vector<float> textures;
-       TVEC3<unsigned char, glm::precision(0)> hsl_mod;
-       TVEC3<unsigned char, glm::precision(0)> rgb_mod;
-       TVEC3<unsigned char, glm::precision(0)> outline_color;
+       BlockMesh::ColorMod hsl_mod;
+       BlockMesh::ColorMod rgb_mod;
+       PrimitiveMesh::Color outline_color;
 
        /// gravity configuration or null if not emitting gravity
        std::unique_ptr<BlockGravity> gravity;
index 32cbe04bbdd37bd6fbff379c1e01483b46b132cc..a3db57d91242dfadece48003c0f656fc46ff1a64 100644 (file)
@@ -76,7 +76,7 @@ BlockType::BlockType() noexcept
 , textures()
 , hsl_mod(0, 255, 255)
 , rgb_mod(255, 255, 255)
-, outline_color(0, 0, 0)
+, outline_color(0, 0, 0, 255)
 , gravity()
 , name("anonymous")
 , label("some block")
@@ -155,7 +155,7 @@ void BlockType::Read(
                        hsl_mod = BlockMesh::ColorMod(color_conv * 255.0f);
                } else if (name == "outline") {
                        in.ReadVec(color_conv);
-                       outline_color = BlockMesh::ColorMod(color_conv * 255.0f);
+                       outline_color = PrimitiveMesh::Color(color_conv * 255.0f, 255);
                } else if (name == "gravity") {
                        gravity = BlockGravity::Read(in);
                } else if (name == "label") {
@@ -240,7 +240,7 @@ void BlockType::FillBlockMesh(
 void BlockType::OutlinePrimitiveMesh(PrimitiveMesh::Buffer &buf) const noexcept {
        if (!shape) return;
        shape->Outline(buf);
-       buf.colors.insert(buf.colors.end(), shape->OutlineCount(), PrimitiveMesh::Color(outline_color, 255));
+       buf.colors.insert(buf.colors.end(), shape->OutlineCount(), outline_color);
 }
 
 
index 033967ad970ffecd32c098f226c1942b8b97dabd..528bc40c1b242358cd6026d81969e8c53ab62463 100644 (file)
@@ -1123,7 +1123,7 @@ void World::RenderDebug(Viewport &viewport) {
        PrimitiveMesh debug_mesh;
        PlainColor &prog = viewport.WorldColorProgram();
        for (const Entity &entity : entities) {
-               debug_buf.OutlineBox(entity.Bounds(), TVEC4<unsigned char, glm::precision(0)>(255, 0, 0, 255));
+               debug_buf.OutlineBox(entity.Bounds(), PrimitiveMesh::Color(255, 0, 0, 255));
                debug_mesh.Update(debug_buf);
                prog.SetM(entity.Transform(players.front().GetEntity().ChunkCoords()));
                debug_mesh.DrawLines();