#pragma once #include #include #include namespace mbgl { namespace gl { template class Normalized { public: T value; Normalized() : value(0) {} explicit Normalized(float f) : value(static_cast(std::numeric_limits::max() * util::clamp(f, 0.0f, 1.0f))) { assert(f >= 0.0f); assert(f <= 1.0f); } float denormalized() const { return float(value) / std::numeric_limits::max(); } }; template bool operator==(const Normalized& lhs, const Normalized& rhs) { return lhs.value == rhs.value; } } // namespace gl } // namespace mbgl