From: Daniel Karbach Date: Thu, 17 Nov 2016 09:00:22 +0000 (+0100) Subject: use symbolic names for block colors X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=cdcfdb33e9b625976909a9fb604b756a1a057788;p=blank.git use symbolic names for block colors --- diff --git a/src/world/BlockType.hpp b/src/world/BlockType.hpp index c55c674..575087f 100644 --- a/src/world/BlockType.hpp +++ b/src/world/BlockType.hpp @@ -25,9 +25,9 @@ struct BlockType { const Shape *shape; std::vector textures; - TVEC3 hsl_mod; - TVEC3 rgb_mod; - TVEC3 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 gravity; diff --git a/src/world/block.cpp b/src/world/block.cpp index 32cbe04..a3db57d 100644 --- a/src/world/block.cpp +++ b/src/world/block.cpp @@ -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); } diff --git a/src/world/world.cpp b/src/world/world.cpp index 033967a..528bc40 100644 --- a/src/world/world.cpp +++ b/src/world/world.cpp @@ -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(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();