Support Forum G3D Web Page |
Represents numbers on [0, 1] in 8 bits as an unsigned normalized 0.8 fixed-point value using the same encoding scheme as OpenGL. More...
Public Member Functions | |
unorm8 () | |
unorm8 (const unorm8 &other) | |
unorm8 (float f) | |
Maps f to round(f * 255). More... | |
unorm8 (double f) | |
uint8 | bits () const |
Returns the underlying bits in this representation. More... | |
operator double () const | |
operator float () const | |
Returns a number on [0.0f, 1.0f]. More... | |
bool | operator!= (const unorm8 other) const |
unorm8 | operator* (const int i) const |
unorm8 & | operator*= (const int i) |
unorm8 | operator+ (const unorm8 other) const |
unorm8 & | operator+= (const unorm8 other) |
unorm8 | operator- (const unorm8 other) const |
unorm8 & | operator-= (const unorm8 other) |
unorm8 | operator/ (const int i) const |
unorm8 & | operator/= (const int i) |
bool | operator< (const unorm8 other) const |
unorm8 | operator<< (const int i) const |
unorm8 & | operator<<= (const int i) |
bool | operator<= (const unorm8 other) const |
bool | operator== (const unorm8 other) const |
bool | operator> (const unorm8 other) const |
bool | operator>= (const unorm8 other) const |
unorm8 | operator>> (const int i) const |
unorm8 & | operator>>= (const int i) |
uint8 | reinterpretAsUInt8 () const |
Returns the underlying bits in this representation. More... | |
Static Public Member Functions | |
static unorm8 | fromBits (uint8 b) |
Equivalent to: More... | |
static unorm8 | one () |
static unorm8 | reinterpretFrom (uint8 b) |
Equivalent to: More... | |
static unorm8 | zero () |
Represents numbers on [0, 1] in 8 bits as an unsigned normalized 0.8 fixed-point value using the same encoding scheme as OpenGL.
OpenGL specifications can be found here: <www.opengl.org/registry/specs/ARB/shading_language_packing.txt>
Note that arithmetic operations may over and under-flow, just like uint8 arithmetic.
|
inline |
|
inline |
|
inlineexplicit |
Maps f to round(f * 255).
|
inlineexplicit |
|
inline |
Returns the underlying bits in this representation.
Equivalent to:
Referenced by G3D::Color4unorm8::asUInt32(), G3D::Color3unorm8::asUInt32(), and G3D::BinaryOutput::writeUNorm8().
Equivalent to:
Referenced by G3D::Color4unorm8::fromARGB(), G3D::Color3unorm8::fromARGB(), and G3D::BinaryInput::readUNorm8().
|
inlinestatic |
Referenced by G3D::Color4unorm8::one(), and G3D::Color3unorm8::one().
|
inline |
|
inline |
Returns a number on [0.0f, 1.0f].
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Referenced by G3D::Color4unorm8::zero(), and G3D::Color3unorm8::zero().