0.8.0 API documentation
Public Member Functions | Protected Member Functions | List of all members
texture Class Reference

Genetic texture class. It can support any target. More...

Inheritance diagram for texture:
texture1d texture1d_array texture2d texture2d_array texture3d texture_cube texture_cube_array

Public Member Functions

size_type base_face () const
 Return the base face of the texture instance, effectively a memory offset in the actual texture storage to identify where to start reading the faces.
 
size_type base_layer () const
 Return the base layer of the texture instance, effectively a memory offset in the actual texture storage to identify where to start reading the layers.
 
size_type base_level () const
 Return the base level of the texture instance, effectively a memory offset in the actual texture storage to identify where to start reading the levels.
 
void clear ()
 Clear the entire texture storage with zeros.
 
template<typename genType >
void clear (genType const &Texel)
 Clear the entire texture storage with Texel which type must match the texture storage format block size If the type of genType doesn't match the type of the texture format, no conversion is performed and the data will be reinterpreted as if is was of the texture format. More...
 
template<typename genType >
void clear (size_type Layer, size_type Face, size_type Level, genType const &Texel)
 Clear a specific image of a texture.
 
void * data ()
 Return a pointer to the beginning of the texture instance data.
 
template<typename genType >
genType * data ()
 Return a pointer of type genType which size must match the texture format block size.
 
void const * data () const
 Return a pointer to the beginning of the texture instance data.
 
template<typename genType >
genType const * data () const
 Return a pointer of type genType which size must match the texture format block size.
 
void * data (size_type Layer, size_type Face, size_type Level)
 Return a pointer to the beginning of the texture instance data.
 
void const * data (size_type Layer, size_type Face, size_type Level) const
 Return a pointer to the beginning of the texture instance data.
 
template<typename genType >
genType * data (size_type Layer, size_type Face, size_type Level)
 Return a pointer of type genType which size must match the texture format block size.
 
template<typename genType >
genType const * data (size_type Layer, size_type Face, size_type Level) const
 Return a pointer of type genType which size must match the texture format block size.
 
bool empty () const
 Return whether the texture instance is empty, no storage or description have been assigned to the instance.
 
extent_type extent (size_type Level=0) const
 Return the size of a texture instance: width, height and depth.
 
size_type faces () const
 Return max_face() - base_face() + 1.
 
format_type format () const
 Return the texture instance format.
 
size_type layers () const
 Return max_layer() - base_layer() + 1.
 
size_type levels () const
 Return max_level() - base_level() + 1.
 
size_type max_face () const
 Return the max face of the texture instance, effectively a memory offset to the beginning of the last face in the actual texture storage that the texture instance can access.
 
size_type max_layer () const
 Return the max layer of the texture instance, effectively a memory offset to the beginning of the last layer in the actual texture storage that the texture instance can access.
 
size_type max_level () const
 Return the max level of the texture instance, effectively a memory offset to the beginning of the last level in the actual texture storage that the texture instance can access.
 
size_type size () const
 Return the memory size of a texture instance storage in bytes.
 
template<typename genType >
size_type size () const
 Return the number of blocks contained in a texture instance storage. More...
 
size_type size (size_type Level) const
 Return the memory size of a specific level identified by Level.
 
template<typename genType >
size_type size (size_type Level) const
 Return the memory size of a specific level identified by Level. More...
 
template<typename genType >
void swizzle (gli::swizzles const &Swizzles)
 Reorder the component in texture memory.
 
target_type target () const
 Return the target of a texture instance.
 
 texture ()
 Create an empty texture instance.
 
 texture (target_type Target, format_type Format, extent_type const &Extent, size_type Layers, size_type Faces, size_type Levels, swizzles_type const &Swizzles=swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA))
 Create a texture object and allocate a texture storoge for it. More...
 
 texture (texture const &Texture, target_type Target, format_type Format, size_type BaseLayer, size_type MaxLayer, size_type BaseFace, size_type MaxFace, size_type BaseLevel, size_type MaxLevel, swizzles_type const &Swizzles=swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA))
 Create a texture object by sharing an existing texture storage from another texture instance. More...
 
 texture (texture const &Texture, target_type Target, format_type Format, swizzles_type const &Swizzles=swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA))
 Create a texture object by sharing an existing texture storage from another texture instance. More...
 

Protected Member Functions

size_type base_offset (size_type Layer, size_type Face, size_type Level) const
 Compute the relative memory offset to access the data for a specific layer, face and level.
 

Detailed Description

Genetic texture class. It can support any target.

Definition at line 12 of file texture.hpp.

Constructor & Destructor Documentation

texture ( target_type  Target,
format_type  Format,
extent_type const &  Extent,
size_type  Layers,
size_type  Faces,
size_type  Levels,
swizzles_type const &  Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA) 
)

Create a texture object and allocate a texture storoge for it.

Parameters
TargetType/Shape of the texture storage
FormatTexel format
ExtentSize of the texture: width, height and depth.
LayersNumber of one-dimensional or two-dimensional images of identical size and format
Faces6 for cube map textures otherwise 1.
LevelsNumber of images in the texture mipmap chain.
SwizzlesA mechanism to swizzle the components of a texture before they are applied according to the texture environment.
texture ( texture const &  Texture,
target_type  Target,
format_type  Format,
size_type  BaseLayer,
size_type  MaxLayer,
size_type  BaseFace,
size_type  MaxFace,
size_type  BaseLevel,
size_type  MaxLevel,
swizzles_type const &  Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA) 
)

Create a texture object by sharing an existing texture storage from another texture instance.

This texture object is effectively a texture view where the layer, the face and the level allows identifying a specific subset of the texture storage source. This texture object is effectively a texture view where the target and format can be reinterpreted with a different compatible texture target and texture format.

texture ( texture const &  Texture,
target_type  Target,
format_type  Format,
swizzles_type const &  Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA) 
)

Create a texture object by sharing an existing texture storage from another texture instance.

This texture object is effectively a texture view where the target and format can be reinterpreted with a different compatible texture target and texture format.

Member Function Documentation

void clear ( genType const &  Texel)

Clear the entire texture storage with Texel which type must match the texture storage format block size If the type of genType doesn't match the type of the texture format, no conversion is performed and the data will be reinterpreted as if is was of the texture format.

size_type size ( ) const

Return the number of blocks contained in a texture instance storage.

genType size must match the block size conresponding to the texture format.

size_type size ( size_type  Level) const

Return the memory size of a specific level identified by Level.

genType size must match the block size conresponding to the texture format.