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

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

Public Member Functions

 unorm16 ()
 
 unorm16 (const unorm16 &other)
 
 unorm16 (const class Any &a)
 
 unorm16 (float f)
 Maps f to round(f * 65535). More...
 
 unorm16 (double f)
 
uint16 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 unorm16 other) const
 
unorm16 operator* (const int i) const
 
unorm16operator*= (const int i)
 
unorm16 operator+ (const unorm16 other) const
 
unorm16operator+= (const unorm16 other)
 
unorm16 operator- (const unorm16 other) const
 
unorm16operator-= (const unorm16 other)
 
unorm16 operator/ (const int i) const
 
unorm16operator/= (const int i)
 
bool operator< (const unorm16 other) const
 
unorm16 operator<< (const int i) const
 
unorm16operator<<= (const int i)
 
bool operator<= (const unorm16 other) const
 
bool operator== (const unorm16 other) const
 
bool operator> (const unorm16 other) const
 
bool operator>= (const unorm16 other) const
 
unorm16 operator>> (const int i) const
 
unorm16operator>>= (const int i)
 
uint16 reinterpretAsUInt16 () const
 Returns the underlying bits in this representation.
More...
 
class Any toAny () const
 

Static Public Member Functions

static unorm16 fromBits (uint16 b)
 Equivalent to: More...
 
static unorm16 one ()
 
static unorm16 reinterpretFrom (uint16 b)
 Equivalent to:
More...
 
static unorm16 zero ()
 

Detailed Description

Represents numbers on [0, 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 uint16 arithmetic.

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

Constructor & Destructor Documentation

◆ unorm16() [1/5]

G3D::unorm16::unorm16 ( )
inline

◆ unorm16() [2/5]

G3D::unorm16::unorm16 ( const unorm16 other)
inline

◆ unorm16() [3/5]

G3D::unorm16::unorm16 ( const class Any a)
explicit

◆ unorm16() [4/5]

G3D::unorm16::unorm16 ( float  f)
inlineexplicit

Maps f to round(f * 65535).

◆ unorm16() [5/5]

G3D::unorm16::unorm16 ( double  f)
inlineexplicit

Member Function Documentation

◆ bits()

uint16 G3D::unorm16::bits ( ) const
inline

Returns the underlying bits in this representation.

Equivalent to:

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

Referenced by G3D::Vector2unorm16::hashCode().

◆ fromBits()

static unorm16 G3D::unorm16::fromBits ( uint16  b)
inlinestatic

Equivalent to:

unorm16 u = reinterpret_cast<const unorm16&>(255);

◆ one()

static unorm16 G3D::unorm16::one ( )
inlinestatic

◆ operator double()

G3D::unorm16::operator double ( ) const
inline

◆ operator float()

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

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

◆ operator!=()

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

◆ operator*()

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

◆ operator*=()

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-()

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

◆ operator-=()

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

◆ operator/()

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

◆ operator/=()

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

◆ operator<()

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

◆ operator<<()

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

◆ operator<<=()

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

◆ operator<=()

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

◆ operator==()

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

◆ operator>()

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

◆ operator>=()

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

◆ operator>>()

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

◆ operator>>=()

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

◆ reinterpretAsUInt16()

uint16 G3D::unorm16::reinterpretAsUInt16 ( ) const
inline

Returns the underlying bits in this representation.

Equivalent to:

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

◆ reinterpretFrom()

static unorm16 G3D::unorm16::reinterpretFrom ( uint16  b)
inlinestatic

Equivalent to:

unorm16 u = reinterpret_cast<const unorm16&>(255);

◆ toAny()

class Any G3D::unorm16::toAny ( ) const

◆ zero()

static unorm16 G3D::unorm16::zero ( )
inlinestatic

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