Cogs.Rendering
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Cogs::ITextures Struct Referenceabstract

Provides texture management functionality. More...

#include <ITextures.h>

Public Member Functions

virtual void annotate (TextureHandle handle, const StringView &name)
 Associate a name with an object for use in graphics debugging.
 
virtual TextureHandle loadTexture (const unsigned char *bytes, unsigned int width, unsigned int height, TextureFormat format, unsigned int flags=0)=0
 Load a texture using the given data to populate the texture contents.
 
virtual TextureHandle loadTexture (const unsigned char *bytes, unsigned int width, unsigned int height, TextureFormat format, unsigned int numSamples, unsigned int flags)=0
 Load a texture using the given data to populate the texture contents.
 
virtual TextureHandle loadTextureMipMaps (const unsigned char **bytes, size_t numLevels, const unsigned int *widths, const unsigned int *heights, TextureFormat format, unsigned int flags=0)=0
 Load a texture with multiple mipmap levels using the given data to populate the texture contents.
 
virtual TextureHandle loadTextureArray (const unsigned char **bytes, const size_t arraySize, const size_t numLevels, const unsigned int *widths, const unsigned int *heights, TextureFormat format, unsigned int flags=0)=0
 Load an array texture with mipmaps using the given data to populate the texture contents.
 
virtual TextureHandle loadCubeMap (const unsigned char **bytes, const size_t arraySize, const size_t numLevels, const unsigned int *widths, const unsigned int *heights, TextureFormat format, unsigned int flags=0)=0
 Load a cube map texture with mipmaps using the given data to populate the texture contents.
 
virtual TextureHandle loadTexture (const TextureDescription &desc, const TextureData *data)=0
 Load a texture from the given description.
 
virtual void uploadTextureData (TextureHandle textureHandle, const TextureData &data, uint32_t layer_offset=0, uint32_t face_offset=0, uint32_t level_offset=0)
 Upload a texture from the given description.
 
virtual void releaseTexture (TextureHandle textureHandle)=0
 Release the texture with the given textureHandle.
 
virtual void releaseNativeTexture (TextureNativeHandle nativeHandle)
 Release a native texture handle.
 
virtual TextureViewHandle createTextureView (TextureViewDescription &viewDescription)=0
 Create a texture view used to bind a limited view of the texture data to the rendering pipeline.
 
virtual void releaseTextureView (const TextureViewHandle &handle)=0
 Release the given texture view.
 
virtual SamplerStateHandle loadSamplerState (const SamplerState &state)=0
 Load a sampler state object.
 
virtual void releaseSamplerState (SamplerStateHandle handle)=0
 Release the sampler state with the given handle.
 
virtual void generateMipmaps (TextureHandle textureHandle)=0
 Use the graphics device to generate mipmaps for the texture with the given texture handle.
 
virtual void * getNativeHandle (TextureHandle textureHandle)=0
 Get the device-specific handle (D3D texture pointer, OpenGL texture ID etc) associated with the given texture handle.
 
virtual void releaseResources ()=0
 Release all allocated texture resources.
 

Detailed Description

Provides texture management functionality.

Member Function Documentation

◆ annotate()

virtual void Cogs::ITextures::annotate ( TextureHandle  handle,
const StringView &  name 
)
inlinevirtual

Associate a name with an object for use in graphics debugging.

◆ createTextureView()

virtual TextureViewHandle Cogs::ITextures::createTextureView ( TextureViewDescription viewDescription)
pure virtual

Create a texture view used to bind a limited view of the texture data to the rendering pipeline.

Parameters
viewDescriptionDescription of the texture view.
Returns
Handle to the create texture view, InvalidHandle if error.

◆ generateMipmaps()

virtual void Cogs::ITextures::generateMipmaps ( TextureHandle  textureHandle)
pure virtual

Use the graphics device to generate mipmaps for the texture with the given texture handle.

Parameters
textureHandleValid handle to a previously created texture object. The texture must have been created with the TextureFlags::GenerateMipMaps flag.

◆ getNativeHandle()

virtual void * Cogs::ITextures::getNativeHandle ( TextureHandle  textureHandle)
pure virtual

Get the device-specific handle (D3D texture pointer, OpenGL texture ID etc) associated with the given texture handle.

Parameters
textureHandleValid handle to a previously created texture object.
Returns
Native handle

◆ loadCubeMap()

virtual TextureHandle Cogs::ITextures::loadCubeMap ( const unsigned char **  bytes,
const size_t  arraySize,
const size_t  numLevels,
const unsigned int *  widths,
const unsigned int *  heights,
TextureFormat  format,
unsigned int  flags = 0 
)
pure virtual

Load a cube map texture with mipmaps using the given data to populate the texture contents.

Parameters
bytesPointer to an array of pointers to texture data. If nullptr is given an empty cube texture with the given number of mipmaps, dimensions and format is created. The number of pointers to texture data must be at least 6 * numLevels.
arraySizeMust be 1.
numLevelsNumber of mipmap levels.
widthsPointer to an array of widths given in pixels. Size of the array must be at least 6 * numLevels.
heightsPointer to an array of heights given in pixels. Size of the array must be at least 6 * numLevels.
formatFormat of the texture data. Must be same for all mipmap levels and array levels.
flagsTexture flags used to determine which operations are supported by the created texture array.
Returns
Handle to the newly created cube texture object, InvalidHandle if the operation failed.

◆ loadSamplerState()

virtual SamplerStateHandle Cogs::ITextures::loadSamplerState ( const SamplerState state)
pure virtual

Load a sampler state object.

Parameters
stateSampler state structure used to initialize the sampler state object on the graphics device.
Returns
Handle to the newly created sampler state object, InvalidHandle if the operation failed.

◆ loadTexture() [1/3]

virtual TextureHandle Cogs::ITextures::loadTexture ( const TextureDescription desc,
const TextureData data 
)
pure virtual

Load a texture from the given description.

Parameters
descTexture description.
dataOptional texture content.

◆ loadTexture() [2/3]

virtual TextureHandle Cogs::ITextures::loadTexture ( const unsigned char *  bytes,
unsigned int  width,
unsigned int  height,
TextureFormat  format,
unsigned int  flags = 0 
)
pure virtual

Load a texture using the given data to populate the texture contents.

Parameters
bytesPointer to texture data. If nullptr is given an empty texture with the given dimensions and format is created.
widthWidth of the texture in pixels.
heightHeight of the texture in pixels.
formatFormat of the texture data.
flagsTexture flags used to determine which operations are supported by the created texture.
Returns
Handle to the newly created texture object, InvalidHandle if the operation failed.

◆ loadTexture() [3/3]

virtual TextureHandle Cogs::ITextures::loadTexture ( const unsigned char *  bytes,
unsigned int  width,
unsigned int  height,
TextureFormat  format,
unsigned int  numSamples,
unsigned int  flags 
)
pure virtual

Load a texture using the given data to populate the texture contents.

Parameters
bytesPointer to texture data. If nullptr is given an empty texture with the given dimensions and format is created.
widthWidth of the texture in pixels.
heightHeight of the texture in pixels.
formatFormat of the texture data.
numSamplesNumber of samples to use per pixel in the texture.
flagsTexture flags used to determine which operations are supported by the created texture.
Returns
Handle to the newly created texture object, InvalidHandle if the operation failed.

◆ loadTextureArray()

virtual TextureHandle Cogs::ITextures::loadTextureArray ( const unsigned char **  bytes,
const size_t  arraySize,
const size_t  numLevels,
const unsigned int *  widths,
const unsigned int *  heights,
TextureFormat  format,
unsigned int  flags = 0 
)
pure virtual

Load an array texture with mipmaps using the given data to populate the texture contents.

Parameters
bytesPointer to an array of pointers to texture data. If nullptr is given an empty texture with the given number of array levels, mipmaps, dimensions and format is created. The number of pointers to texture data must be at least arraySize * numLevels.
arraySizeSize of the texture array to create.
numLevelsNumber of mipmap levels.
widthsPointer to an array of widths given in pixels. Size of the array must be at least arraySize * numLevels.
heightsPointer to an array of heights given in pixels. Size of the array must be at least arraySize * numLevels.
formatFormat of the texture data. Must be same for all mipmap levels and array levels.
flagsTexture flags used to determine which operations are supported by the created texture array.
Returns
Handle to the newly created texture object, InvalidHandle if the operation failed.

◆ loadTextureMipMaps()

virtual TextureHandle Cogs::ITextures::loadTextureMipMaps ( const unsigned char **  bytes,
size_t  numLevels,
const unsigned int *  widths,
const unsigned int *  heights,
TextureFormat  format,
unsigned int  flags = 0 
)
pure virtual

Load a texture with multiple mipmap levels using the given data to populate the texture contents.

Parameters
bytesPointer to an array of pointers to texture data. If nullptr is given an empty texture with the given number of mipmaps, dimensions and format is created.
numLevelsNumber of mipmap levels.
widthsPointer to an array of widths, one for each mipmap, given in pixels.
heightsPointer to an array of heights, one for each mipmap, given in pixels.
formatFormat of the texture data. Must be same for all mipmap levels.
flagsTexture flags used to determine which operations are supported by the created texture.
Returns
Handle to the newly created texture object, InvalidHandle if the operation failed.

◆ releaseNativeTexture()

virtual void Cogs::ITextures::releaseNativeTexture ( TextureNativeHandle  nativeHandle)
inlinevirtual

Release a native texture handle.

Parameters
nativeHandleis a handle to a natively created texture (Created directly from the graphics API).

◆ releaseResources()

virtual void Cogs::ITextures::releaseResources ( )
pure virtual

Release all allocated texture resources.

◆ releaseSamplerState()

virtual void Cogs::ITextures::releaseSamplerState ( SamplerStateHandle  handle)
pure virtual

Release the sampler state with the given handle.

Parameters
handleValid handle to a previously created sampler state.

◆ releaseTexture()

virtual void Cogs::ITextures::releaseTexture ( TextureHandle  textureHandle)
pure virtual

Release the texture with the given textureHandle.

Parameters
textureHandleValid handle to a previously created texture object.

◆ releaseTextureView()

virtual void Cogs::ITextures::releaseTextureView ( const TextureViewHandle handle)
pure virtual

Release the given texture view.

Parameters
handleValid handle to a previously created texture view.

◆ uploadTextureData()

virtual void Cogs::ITextures::uploadTextureData ( TextureHandle  textureHandle,
const TextureData data,
uint32_t  layer_offset = 0,
uint32_t  face_offset = 0,
uint32_t  level_offset = 0 
)
inlinevirtual

Upload a texture from the given description.

Parameters
descTexture description.
dataOptional texture content.

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