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

Encoding of the depth buffer (not the GBuffer::Field::CS_Z buffer) More...

Public Types

enum  Value {
  HYPERBOLIC,
  LINEAR,
  COMPLEMENTARY
}
 

Public Member Functions

 DepthEncoding (const G3D::String &x)
 
 DepthEncoding (char v)
 
 DepthEncoding (int v)
 
 DepthEncoding (const G3D::Any &a)
 
 DepthEncoding ()
 
 DepthEncoding (const Value v)
 
void deserialize (G3D::BinaryInput &b)
 
unsigned int hashCode () const
 
 operator int () const
 
bool operator!= (const DepthEncoding ::Value other) const
 
bool operator!= (const DepthEncoding other) const
 
DepthEncoding operator+ (const int x) const
 
DepthEncodingoperator++ ()
 
DepthEncodingoperator+= (const int x)
 
DepthEncoding operator- (const int x) const
 
DepthEncodingoperator-- ()
 
DepthEncodingoperator-= (const int x)
 
bool operator< (const DepthEncoding other) const
 
bool operator< (const Value other) const
 
bool operator<= (const Value other) const
 
bool operator<= (const DepthEncoding other) const
 
DepthEncodingoperator= (const G3D::Any &a)
 
bool operator== (const DepthEncoding ::Value other) const
 
bool operator== (const DepthEncoding other) const
 
bool operator> (const DepthEncoding other) const
 
bool operator> (const Value other) const
 
bool operator>= (const DepthEncoding other) const
 
bool operator>= (const Value other) const
 
void serialize (G3D::BinaryOutput &b) const
 
G3D::Any toAny () const
 
const char * toString () const
 

Static Public Member Functions

static const char * classname ()
 
static int count ()
 
static Value nthValue (int n)
 
static const char * toString (int i, Value &v)
 

Public Attributes

enum G3D::DepthEncoding::Value value
 

Detailed Description

Encoding of the depth buffer (not the GBuffer::Field::CS_Z buffer)

Member Enumeration Documentation

◆ Value

Enumerator
HYPERBOLIC 

"Z-buffer" Traditional (n)/(f-n) * (1 - f/z) encoding.

Easy to produce from a projection matrix, few good numerical properties.

LINEAR 

"W-buffer" (z-n)/(f-n), provides uniform precision for fixed point formats like DEPTH24, and easy to reconstruct csZ directly from the depth buffer.

Poor precision under floating-point formats.

Accomplished using a custom vertex shader at the expense of complicated interpolation in the fragment shader and losing hierarchical and early-z culling; not possible with a projection matrix.

This is provided for future compatibility with potential OpenGL extensions and for software renderers. There is no way to make G3D render a LINEAR depth buffer currently.

COMPLEMENTARY 

(n)/(f-n) * (f/z-1) encoding, good for floating-point formats like DEPTH32F.

Accomplished using glDepthRange(1.0f, 0.0f) with a traditionl projection matrix.

Referenced Code: http://portal.acm.org/citation.cfm?id=311579&dl=ACM&coll=DL&CFID=28183902&CFTOKEN=63987370

Constructor & Destructor Documentation

◆ DepthEncoding() [1/6]

G3D::DepthEncoding::DepthEncoding ( const G3D::String x)
inlineexplicit

◆ DepthEncoding() [2/6]

G3D::DepthEncoding::DepthEncoding ( const G3D::Any a)
inlineexplicit

◆ DepthEncoding() [3/6]

G3D::DepthEncoding::DepthEncoding ( char  v)
inlineexplicit

◆ DepthEncoding() [4/6]

G3D::DepthEncoding::DepthEncoding ( )
inline

◆ DepthEncoding() [5/6]

G3D::DepthEncoding::DepthEncoding ( const Value  v)
inline

◆ DepthEncoding() [6/6]

G3D::DepthEncoding::DepthEncoding ( int  v)
inlineexplicit

Member Function Documentation

◆ classname()

static const char* G3D::DepthEncoding::classname ( )
inlinestatic

◆ count()

static int G3D::DepthEncoding::count ( )
inlinestatic

◆ deserialize()

void G3D::DepthEncoding::deserialize ( G3D::BinaryInput b)
inline

◆ hashCode()

unsigned int G3D::DepthEncoding::hashCode ( ) const
inline

◆ nthValue()

static Value G3D::DepthEncoding::nthValue ( int  n)
inlinestatic

◆ operator int()

G3D::DepthEncoding::operator int ( ) const
inline

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

bool G3D::DepthEncoding::operator!= ( const DepthEncoding ::Value  other) const
inline

◆ operator+()

DepthEncoding G3D::DepthEncoding::operator+ ( const int  x) const
inline

◆ operator++()

DepthEncoding& G3D::DepthEncoding::operator++ ( )
inline

◆ operator+=()

DepthEncoding& G3D::DepthEncoding::operator+= ( const int  x)
inline

◆ operator-()

DepthEncoding G3D::DepthEncoding::operator- ( const int  x) const
inline

◆ operator--()

DepthEncoding& G3D::DepthEncoding::operator-- ( )
inline

◆ operator-=()

DepthEncoding& G3D::DepthEncoding::operator-= ( const int  x)
inline

◆ operator<() [1/2]

bool G3D::DepthEncoding::operator< ( const Value  other) const
inline

◆ operator<() [2/2]

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

◆ operator<=() [1/2]

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

◆ operator<=() [2/2]

bool G3D::DepthEncoding::operator<= ( const Value  other) const
inline

◆ operator=()

DepthEncoding& G3D::DepthEncoding::operator= ( const G3D::Any a)
inline

◆ operator==() [1/2]

bool G3D::DepthEncoding::operator== ( const DepthEncoding ::Value  other) const
inline

◆ operator==() [2/2]

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

◆ operator>() [1/2]

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

◆ operator>() [2/2]

bool G3D::DepthEncoding::operator> ( const Value  other) const
inline

◆ operator>=() [1/2]

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

◆ operator>=() [2/2]

bool G3D::DepthEncoding::operator>= ( const Value  other) const
inline

◆ serialize()

void G3D::DepthEncoding::serialize ( G3D::BinaryOutput b) const
inline

◆ toAny()

G3D::Any G3D::DepthEncoding::toAny ( ) const
inline

◆ toString() [1/2]

static const char* G3D::DepthEncoding::toString ( int  i,
Value v 
)
static

◆ toString() [2/2]

const char* G3D::DepthEncoding::toString ( ) const
inline

Member Data Documentation

◆ value

enum G3D::DepthEncoding::Value G3D::DepthEncoding::value

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