27 class =
typename std::enable_if<std::is_unsigned<T>::value>::type>
33 result.z = 1.0 - (glm::abs(result.x) + glm::abs(result.y));
36 const double oldVX = result.x;
43 return glm::normalize(result);
57 constexpr uint8_t rangeMax = 255;
69 constexpr uint16_t mask5 = (1 << 5) - 1;
70 constexpr uint16_t mask6 = (1 << 6) - 1;
71 constexpr
float normalize5 = 1.0f / 31.0f;
72 constexpr
float normalize6 = 1.0f / 63.0f;
74 const uint16_t red =
static_cast<uint16_t
>(value >> 11);
75 const uint16_t green =
static_cast<uint16_t
>((value >> 5) & mask6);
76 const uint16_t blue = value & mask5;
78 return glm::dvec3(red * normalize5, green * normalize6, blue * normalize5);
Functions to handle compressed attributes in different formats.
static glm::dvec3 octDecode(uint8_t x, uint8_t y)
Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector.
static glm::dvec3 decodeRGB565(const uint16_t value)
Decodes a RGB565-encoded color to a 3-component vector containing the normalized RGB values.
static glm::dvec3 octDecodeInRange(T x, T y, T rangeMax)
Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector.
static constexpr double signNotZero(double value) noexcept
Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative.
static constexpr double fromSNorm(double value, double rangeMaximum=255.0) noexcept
Converts a SNORM value in the range [0, rangeMaximum] to a scalar in the range [-1....
Utility classes for Cesium.