Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | List of all members
G3D::snorm8 Class Reference

Represents numbers on [-1, 1] in 8 bits as a signed normalized 0.8 fixed-point value using the same encoding scheme as OpenGL. More...

Public Member Functions

 snorm8 ()
 
 snorm8 (const snorm8 &other)
 
 snorm8 (float f)
 Maps f to round(f * 127). More...
 
uint8 bits () const
 Returns the underlying bits in this representation. More...
 
 operator float () const
 Returns a number on [-1.0f, 1.0f]. More...
 
bool operator!= (const snorm8 other) const
 
snorm8 operator* (const int i) const
 
snorm8operator*= (const int i)
 
snorm8 operator+ (const snorm8 other) const
 
snorm8operator+= (const snorm8 other)
 
snorm8 operator- (const snorm8 other) const
 
snorm8operator-= (const snorm8 other)
 
snorm8 operator/ (const int i) const
 
snorm8operator/= (const int i)
 
bool operator< (const snorm8 other) const
 
snorm8 operator<< (const int i) const
 
snorm8operator<<= (const int i)
 
bool operator<= (const snorm8 other) const
 
bool operator== (const snorm8 other) const
 
bool operator> (const snorm8 other) const
 
bool operator>= (const snorm8 other) const
 
snorm8 operator>> (const int i) const
 
snorm8operator>>= (const int i)
 
int8 reinterpretAsInt8 () const
 Returns the underlying bits in this representation.
More...
 

Static Public Member Functions

static snorm8 fromBits (int8 b)
 Equivalent to: More...
 
static snorm8 one ()
 
static snorm8 reinterpretFrom (int8 b)
 Equivalent to:
More...
 
static snorm8 zero ()
 

Detailed Description

Represents numbers on [-1, 1] in 8 bits as a signed normalized 0.8 fixed-point value using the same encoding scheme as OpenGL.

Note that arithmetic operations may over and under-flow, just like int8 arithmetic.

OpenGL specifications can be found here: <www.opengl.org/registry/specs/ARB/shading_language_packing.txt>

Constructor & Destructor Documentation

◆ snorm8() [1/3]

G3D::snorm8::snorm8 ( )
inline

◆ snorm8() [2/3]

G3D::snorm8::snorm8 ( const snorm8 other)
inline

◆ snorm8() [3/3]

G3D::snorm8::snorm8 ( float  f)
inlineexplicit

Maps f to round(f * 127).

Member Function Documentation

◆ bits()

uint8 G3D::snorm8::bits ( ) const
inline

Returns the underlying bits in this representation.

Equivalent to:

uint8 i = reinterpret_cast<const uint8&>(u);

◆ fromBits()

static snorm8 G3D::snorm8::fromBits ( int8  b)
inlinestatic

Equivalent to:

snorm8 u = reinterpret_cast<const snorm8&>(b);

◆ one()

static snorm8 G3D::snorm8::one ( )
inlinestatic

◆ operator float()

G3D::snorm8::operator float ( ) const
inline

Returns a number on [-1.0f, 1.0f].

◆ operator!=()

bool G3D::snorm8::operator!= ( const snorm8  other) const
inline

◆ operator*()

snorm8 G3D::snorm8::operator* ( const int  i) const
inline

◆ operator*=()

snorm8& G3D::snorm8::operator*= ( const int  i)
inline

◆ operator+()

snorm8 G3D::snorm8::operator+ ( const snorm8  other) const
inline

◆ operator+=()

snorm8& G3D::snorm8::operator+= ( const snorm8  other)
inline

◆ operator-()

snorm8 G3D::snorm8::operator- ( const snorm8  other) const
inline

◆ operator-=()

snorm8& G3D::snorm8::operator-= ( const snorm8  other)
inline

◆ operator/()

snorm8 G3D::snorm8::operator/ ( const int  i) const
inline

◆ operator/=()

snorm8& G3D::snorm8::operator/= ( const int  i)
inline

◆ operator<()

bool G3D::snorm8::operator< ( const snorm8  other) const
inline

◆ operator<<()

snorm8 G3D::snorm8::operator<< ( const int  i) const
inline

◆ operator<<=()

snorm8& G3D::snorm8::operator<<= ( const int  i)
inline

◆ operator<=()

bool G3D::snorm8::operator<= ( const snorm8  other) const
inline

◆ operator==()

bool G3D::snorm8::operator== ( const snorm8  other) const
inline

◆ operator>()

bool G3D::snorm8::operator> ( const snorm8  other) const
inline

◆ operator>=()

bool G3D::snorm8::operator>= ( const snorm8  other) const
inline

◆ operator>>()

snorm8 G3D::snorm8::operator>> ( const int  i) const
inline

◆ operator>>=()

snorm8& G3D::snorm8::operator>>= ( const int  i)
inline

◆ reinterpretAsInt8()

int8 G3D::snorm8::reinterpretAsInt8 ( ) const
inline

Returns the underlying bits in this representation.

Equivalent to:

uint8 i = reinterpret_cast<const uint8&>(u);

◆ reinterpretFrom()

static snorm8 G3D::snorm8::reinterpretFrom ( int8  b)
inlinestatic

Equivalent to:

snorm8 u = reinterpret_cast<const snorm8&>(b);

◆ zero()

static snorm8 G3D::snorm8::zero ( )
inlinestatic

documentation generated on Wed Nov 24 2021 08:02:00 using doxygen 1.8.15