Ptex
Public Member Functions | Public Attributes | List of all members
Ptex::Res Struct Reference

Pixel resolution of a given texture. More...

#include <Ptexture.h>

Public Member Functions

 Res ()
 Default constructor, sets res to 0 (1x1 texel). More...
 
 Res (int8_t ulog2_, int8_t vlog2_)
 Constructor. More...
 
 Res (uint16_t value)
 Constructor from 16-bit integer. More...
 
int u () const
 U resolution in texels. More...
 
int v () const
 V resolution in texels. More...
 
uint16_t & val ()
 Resolution as a single 16-bit integer value. More...
 
const uint16_t & val () const
 Resolution as a single 16-bit integer value. More...
 
int size () const
 Total size of specified texture in texels (u * v). More...
 
bool operator== (const Res &r) const
 Comparison operator. More...
 
bool operator!= (const Res &r) const
 Comparison operator. More...
 
bool operator>= (const Res &r) const
 True if res is >= given res in both u and v directions. More...
 
Res swappeduv () const
 Get value of resolution with u and v swapped. More...
 
void swapuv ()
 Swap the u and v resolution values in place. More...
 
void clamp (const Res &r)
 Clamp the resolution value against the given value. More...
 
int ntilesu (Res tileres) const
 Determine the number of tiles in the u direction for the given tile res. More...
 
int ntilesv (Res tileres) const
 Determine the number of tiles in the v direction for the given tile res. More...
 
int ntiles (Res tileres) const
 Determine the total number of tiles for the given tile res. More...
 

Public Attributes

int8_t ulog2
 log base 2 of u resolution, in texels More...
 
int8_t vlog2
 log base 2 of v resolution, in texels More...
 

Detailed Description

Pixel resolution of a given texture.

The resolution is stored in log form: ulog2 = log2(ures), vlog2 = log2(vres)). Note: negative ulog2 or vlog2 values are reserved for internal use.

Definition at line 161 of file Ptexture.h.

Constructor & Destructor Documentation

Ptex::Res::Res ( )
inline

Default constructor, sets res to 0 (1x1 texel).

Definition at line 166 of file Ptexture.h.

Referenced by swappeduv().

Ptex::Res::Res ( int8_t  ulog2_,
int8_t  vlog2_ 
)
inline

Constructor.

Definition at line 169 of file Ptexture.h.

Ptex::Res::Res ( uint16_t  value)
inline

Constructor from 16-bit integer.

Definition at line 172 of file Ptexture.h.

Member Function Documentation

void Ptex::Res::clamp ( const Res r)
inline

Clamp the resolution value against the given value.

Definition at line 208 of file Ptexture.h.

References ulog2, and vlog2.

int Ptex::Res::ntiles ( Res  tileres) const
inline

Determine the total number of tiles for the given tile res.

Definition at line 220 of file Ptexture.h.

Referenced by PtexReader::TiledFaceBase::reduce().

int Ptex::Res::ntilesu ( Res  tileres) const
inline

Determine the number of tiles in the u direction for the given tile res.

Definition at line 214 of file Ptexture.h.

Referenced by PtexReader::getData(), and PtexWriterBase::writeFaceData().

int Ptex::Res::ntilesv ( Res  tileres) const
inline

Determine the number of tiles in the v direction for the given tile res.

Definition at line 217 of file Ptexture.h.

References vlog2.

Referenced by PtexReader::getData(), and PtexWriterBase::writeFaceData().

bool Ptex::Res::operator!= ( const Res r) const
inline

Comparison operator.

Definition at line 196 of file Ptexture.h.

bool Ptex::Res::operator== ( const Res r) const
inline

Comparison operator.

Definition at line 193 of file Ptexture.h.

References val().

bool Ptex::Res::operator>= ( const Res r) const
inline

True if res is >= given res in both u and v directions.

Definition at line 199 of file Ptexture.h.

int Ptex::Res::size ( ) const
inline
Res Ptex::Res::swappeduv ( ) const
inline

Get value of resolution with u and v swapped.

Definition at line 202 of file Ptexture.h.

References Res().

void Ptex::Res::swapuv ( )
inline

Swap the u and v resolution values in place.

Definition at line 205 of file Ptexture.h.

Referenced by PtexReader::blendFaces(), and PtexSeparableKernel::swapUV().

int Ptex::Res::u ( ) const
inline
int Ptex::Res::v ( ) const
inline
uint16_t& Ptex::Res::val ( )
inline

Resolution as a single 16-bit integer value.

Definition at line 184 of file Ptexture.h.

Referenced by operator==().

const uint16_t& Ptex::Res::val ( ) const
inline

Resolution as a single 16-bit integer value.

Definition at line 187 of file Ptexture.h.

Member Data Documentation

int8_t Ptex::Res::ulog2
int8_t Ptex::Res::vlog2

The documentation for this struct was generated from the following file: