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

Public Attributes

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

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 159 of file Ptexture.h.

Constructor & Destructor Documentation

◆ Res() [1/3]

Ptex::Res::Res ( )
inline

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

Definition at line 164 of file Ptexture.h.

Referenced by swappeduv().

◆ Res() [2/3]

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

Constructor.

Definition at line 167 of file Ptexture.h.

◆ Res() [3/3]

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

Constructor.

Definition at line 170 of file Ptexture.h.

Member Function Documentation

◆ clamp()

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

Clamp the resolution value against the given value.

Definition at line 200 of file Ptexture.h.

References ulog2, and vlog2.

◆ ntiles()

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

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

Definition at line 212 of file Ptexture.h.

References ntilesu(), and ntilesv().

◆ ntilesu()

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 206 of file Ptexture.h.

References ulog2.

Referenced by ntiles().

◆ ntilesv()

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 209 of file Ptexture.h.

References vlog2.

Referenced by ntiles().

◆ operator!=()

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

Comparison operator.

Definition at line 188 of file Ptexture.h.

◆ operator==()

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

Comparison operator.

Definition at line 185 of file Ptexture.h.

References ulog2, and vlog2.

◆ operator>=()

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

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

Definition at line 191 of file Ptexture.h.

References ulog2, and vlog2.

◆ size()

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

Total size of specified texture in texels (u * v).

Definition at line 182 of file Ptexture.h.

References u(), and v().

Referenced by PtexMainWriter::finish(), and PtexWriterBase::writeReduction().

◆ swappeduv()

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

Get value of resolution with u and v swapped.

Definition at line 194 of file Ptexture.h.

References Res(), ulog2, and vlog2.

Referenced by swapuv().

◆ swapuv()

void Ptex::Res::swapuv ( )
inline

Swap the u and v resolution values in place.

Definition at line 197 of file Ptexture.h.

References swappeduv().

◆ u()

int Ptex::Res::u ( ) const
inline

◆ v()

int Ptex::Res::v ( ) const
inline

V resolution in texels.

Definition at line 176 of file Ptexture.h.

References vlog2.

Referenced by PtexSeparableFilter::apply(), PtexTriangleFilter::applyIter(), and size().

◆ val()

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

Resolution as a single 16-bit integer value.

Definition at line 179 of file Ptexture.h.

References ulog2, and vlog2.

Member Data Documentation

◆ ulog2

int8_t Ptex::Res::ulog2

log base 2 of u resolution, in texels

Definition at line 160 of file Ptexture.h.

Referenced by clamp(), ntilesu(), operator==(), operator>=(), swappeduv(), u(), and val().

◆ vlog2

int8_t Ptex::Res::vlog2

log base 2 of v resolution, in texels

Definition at line 161 of file Ptexture.h.

Referenced by clamp(), ntilesv(), operator==(), operator>=(), swappeduv(), v(), and val().


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