MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / getColor

Method getColor

CesiumVectorData/src/VectorStyle.cpp:12–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11namespace CesiumVectorData {
12Color 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}
30VectorStyle::VectorStyle(const CesiumUtility::Color& color)
31 : line{{color}}, polygon{ColorStyle{color}, std::nullopt} {}
32VectorStyle::VectorStyle(

Callers 3

drawPolygonMethod · 0.80
drawPolylineMethod · 0.80
drawPointsImplFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected