opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
unorm8.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <cstddef>
7#include <cstdint>
8
9namespace osc
10{
11 // A normalized unsigned 8-bit integer that can be used to store a floating-point
12 // number in the (clamped) range [0.0f, 1.0f]
13 //
14 // see: https://www.khronos.org/opengl/wiki/Normalized_Integer
16
17 template<>
18 struct Converter<std::byte, Unorm8> final {
19 constexpr Unorm8 operator()(std::byte raw_value) const
20 {
21 return Unorm8{static_cast<uint8_t>(raw_value)};
22 }
23 };
24
25 template<>
26 struct Converter<Unorm8, std::byte> final {
27 constexpr std::byte operator()(Unorm8 unorm) const
28 {
29 return static_cast<std::byte>(unorm.raw_value());
30 }
31 };
32}
Definition unorm.h:20
Definition custom_decoration_generator.h:5
constexpr U to(T &&value)
Definition conversion.h:56
constexpr std::byte operator()(Unorm8 unorm) const
Definition unorm8.h:27
constexpr Unorm8 operator()(std::byte raw_value) const
Definition unorm8.h:19
Definition conversion.h:30