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

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

Public Member Functions

 snorm16 ()
 
 snorm16 (const snorm16 &other)
 
 snorm16 (float f)
 Maps f to round(f * 32767). More...
 
int16 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 snorm16 other) const
 
snorm16 operator* (const int i) const
 
snorm16operator*= (const int i)
 
snorm16 operator+ (const snorm16 other) const
 
snorm16operator+= (const snorm16 other)
 
snorm16 operator- (const snorm16 other) const
 
snorm16operator-= (const snorm16 other)
 
snorm16 operator/ (const int i) const
 
snorm16operator/= (const int i)
 
bool operator< (const snorm16 other) const
 
snorm16 operator<< (const int i) const
 
snorm16operator<<= (const int i)
 
bool operator<= (const snorm16 other) const
 
bool operator== (const snorm16 other) const
 
bool operator> (const snorm16 other) const
 
bool operator>= (const snorm16 other) const
 
snorm16 operator>> (const int i) const
 
snorm16operator>>= (const int i)
 
int16 reinterpretAsInt16 () const
 Returns the underlying bits in this representation.
More...
 

Static Public Member Functions

static snorm16 fromBits (int16 b)
 Equivalent to: More...
 
static snorm16 one ()
 
static snorm16 reinterpretFrom (int16 b)
 Equivalent to:
More...
 
static snorm16 zero ()
 

Detailed Description

Represents numbers on [-1, 1] in 16 bits as an unsigned normalized 0.8 fixed-point value using the same encoding scheme as OpenGL.

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

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

Constructor & Destructor Documentation

◆ snorm16() [1/3]

G3D::snorm16::snorm16 ( )
inline

◆ snorm16() [2/3]

G3D::snorm16::snorm16 ( const snorm16 other)
inline

◆ snorm16() [3/3]

G3D::snorm16::snorm16 ( float  f)
inlineexplicit

Maps f to round(f * 32767).

Member Function Documentation

◆ bits()

int16 G3D::snorm16::bits ( ) const
inline

Returns the underlying bits in this representation.

Equivalent to:

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

◆ fromBits()

static snorm16 G3D::snorm16::fromBits ( int16  b)
inlinestatic

Equivalent to:

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

◆ one()

static snorm16 G3D::snorm16::one ( )
inlinestatic

◆ operator float()

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

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

◆ operator!=()

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

◆ operator*()

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

◆ operator*=()

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-()

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

◆ operator-=()

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

◆ operator/()

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

◆ operator/=()

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

◆ operator<()

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

◆ operator<<()

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

◆ operator<<=()

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

◆ operator<=()

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

◆ operator==()

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

◆ operator>()

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

◆ operator>=()

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

◆ operator>>()

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

◆ operator>>=()

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

◆ reinterpretAsInt16()

int16 G3D::snorm16::reinterpretAsInt16 ( ) const
inline

Returns the underlying bits in this representation.

Equivalent to:

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

◆ reinterpretFrom()

static snorm16 G3D::snorm16::reinterpretFrom ( int16  b)
inlinestatic

Equivalent to:

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

◆ zero()

static snorm16 G3D::snorm16::zero ( )
inlinestatic

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