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 from 16-bit integer.
 
int u () const
 U resolution in texels.
 
int v () const
 V resolution in texels.
 
uint16_t & val ()
 Resolution as a single 16-bit integer value.
 
const 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.