X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fblock.cpp;h=c8618939e825bebf690a9f52903493d862b0ccad;hb=f071bb512a09cece895e65ca48eba2a7155d6593;hp=e99c5be254b2fbb16309ca31b946bbf0be215071;hpb=1e93bfb5089737f6b6d8fdd2f17260944fca44b2;p=blank.git diff --git a/src/world/block.cpp b/src/world/block.cpp index e99c5be..c861893 100644 --- a/src/world/block.cpp +++ b/src/world/block.cpp @@ -74,8 +74,8 @@ std::ostream &operator <<(std::ostream &out, const Block::Turn &turn) { BlockType::BlockType() noexcept : shape(nullptr) , textures() -, hsl_mod(0.0f, 1.0f, 1.0f) -, rgb_mod(1.0f, 1.0f, 1.0f) +, hsl_mod(0, 255, 255) +, rgb_mod(255, 255, 255) , outline_color(-1, -1, -1) , gravity() , name("anonymous") @@ -142,6 +142,7 @@ void BlockType::Read( ) { std::string name; in.Skip(Token::ANGLE_BRACKET_OPEN); + glm::vec3 color_conv; while (in.Peek().type != Token::ANGLE_BRACKET_CLOSE) { in.ReadIdentifier(name); in.Skip(Token::EQUALS); @@ -163,11 +164,14 @@ void BlockType::Read( } in.Skip(Token::BRACKET_CLOSE); } else if (name == "rgb_mod") { - in.ReadVec(rgb_mod); + in.ReadVec(color_conv); + rgb_mod = glm::tvec3(color_conv * 255.0f); } else if (name == "hsl_mod") { - in.ReadVec(hsl_mod); + in.ReadVec(color_conv); + hsl_mod = glm::tvec3(color_conv * 255.0f); } else if (name == "outline") { - in.ReadVec(outline_color); + in.ReadVec(color_conv); + outline_color = glm::tvec3(color_conv * 255.0f); } else if (name == "gravity") { gravity = BlockGravity::Read(in); } else if (name == "label") { @@ -252,7 +256,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(), glm::vec4(outline_color, 1.0f)); + buf.colors.insert(buf.colors.end(), shape->OutlineCount(), glm::tvec4(outline_color, 255)); }