diff --git a/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp b/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp index a22470c..e216d6b 100644 --- a/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp +++ b/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp @@ -64,7 +64,9 @@ std::unique_ptr Renderer::MaterialStyle::decoded(const std::vecto else /// MaterialStyleStroke { std::unique_ptr materialStroke; - uint headUint = floatBitsToUint(encoded[1]); + uint widthMapSize = floatBitsToUint(encoded[1]); + uint headIndex = widthMapSize + 2; + uint headUint = floatBitsToUint(encoded[headIndex]); vec4 head = unpackUnorm4x8(headUint); StrokeType strokeType = (StrokeType)floor(head.b * 10); StrokeEndType endType = (StrokeEndType)(int(round(head.b * 100)) % 10); @@ -72,7 +74,7 @@ std::unique_ptr Renderer::MaterialStyle::decoded(const std::vecto { /// Plain case 0: { - materialStroke = std::make_unique(Material(glm::unpackUnorm4x8(glm::floatBitsToUint(encoded[2])), glm::vec2(head.r, head.g))); + materialStroke = std::make_unique(Material(glm::unpackUnorm4x8(glm::floatBitsToUint(encoded[headIndex+1])), glm::vec2(head.r, head.g))); break; } /// RadialGradient @@ -82,9 +84,9 @@ std::unique_ptr Renderer::MaterialStyle::decoded(const std::vecto std::map materialMap; for (uint i = 0; i < size; i++) { - auto data = floatBitsToUint(encoded[2 + i * 2]); + auto data = floatBitsToUint(encoded[headIndex + 1 + i * 2]); auto level = unpackUnorm2x16(data).y; - auto color = unpackUnorm4x8(floatBitsToUint(encoded[3 + i * 2])); + auto color = unpackUnorm4x8(floatBitsToUint(encoded[headIndex + 2 + i * 2])); auto metallicRoughness = unpackUnorm4x8(data); materialMap.emplace(level, Material(color, glm::vec2(metallicRoughness.r, metallicRoughness.g))); }