| 10 | |
| 11 | namespace CesiumVectorData { |
| 12 | Color ColorStyle::getColor(size_t randomColorSeed) const { |
| 13 | if (this->colorMode == ColorMode::Normal) { |
| 14 | return this->color; |
| 15 | } |
| 16 | |
| 17 | std::hash<size_t> hash{}; |
| 18 | size_t h = hash(randomColorSeed); |
| 19 | |
| 20 | float r = uint8_t(h & 0xFF) / 255.0f; |
| 21 | float g = uint8_t((h >> 8) & 0xFF) / 255.0f; |
| 22 | float b = uint8_t((h >> 16) & 0xFF) / 255.0f; |
| 23 | |
| 24 | return Color{ |
| 25 | (uint8_t)(r * this->color.r), |
| 26 | (uint8_t)(g * this->color.g), |
| 27 | (uint8_t)(b * this->color.b), |
| 28 | this->color.a}; |
| 29 | } |
| 30 | VectorStyle::VectorStyle(const CesiumUtility::Color& color) |
| 31 | : line{{color}}, polygon{ColorStyle{color}, std::nullopt} {} |
| 32 | VectorStyle::VectorStyle( |
no outgoing calls
no test coverage detected