PixelLightAPI
.
|
Abstract renderer texture buffer resource base class. More...
#include <TextureBuffer.h>
Public Types | |
enum | EFlags { Mipmaps = 1<<0, Compression = 1<<1, RenderTarget = 1<<2 } |
Texture buffer flags. More... | |
enum | EPixelFormat { L8 = 0, L16 = 1, A8 = 2, L4A4 = 3, L8A8 = 4, D16 = 5, D24 = 6, D32 = 7, R3G3B2 = 8, R5G6B5 = 9, R5G5B5A1 = 10, R4G4B4A4 = 11, R8G8B8 = 12, R8G8B8A8 = 13, R10G10B10A2 = 14, R16G16B16A16 = 15, DXT1 = 16, DXT3 = 17, DXT5 = 18, LATC1 = 19, LATC2 = 20, L16F = 21, L32F = 22, R16G16B16A16F = 23, R32G32B32A32F = 24, Unknown = 25 } |
Texture buffer pixel formats. More... | |
Public Member Functions | |
virtual PLRENDERER_API | ~TextureBuffer () |
Destructor. | |
PLCore::uint32 | GetFlags () const |
Returns the texture buffer flags. | |
EPixelFormat | GetFormat () const |
Returns the texture buffer pixel format. | |
bool | IsCompressedFormat () const |
Returns whether or not the used texture buffer format is compressed. | |
bool | IsDepthFormat () const |
Returns whether or not the used texture buffer format is a depth buffer format. | |
EPixelFormat | GetUncompressedFormat () const |
If the used texture buffer format is compressed, a proper uncompressed texture buffer format will be returned. | |
bool | IsFloatingPointFormat () const |
Returns whether or not the used texture buffer format is a floating point format. | |
PLCore::uint32 | GetComponentsPerPixel () const |
Returns the number of components per pixel. | |
PLCore::uint32 | GetBytesPerPixelComponent () const |
Returns the number of bytes per pixel component. | |
PLCore::uint32 | GetBytesPerPixel () const |
Returns the number of bytes per pixel. | |
PLCore::uint32 | GetNumOfMipmaps () const |
Returns the number of mipmap levels. | |
PLCore::uint8 | GetNumOfFaces () const |
Returns the number of faces. | |
PLRENDERER_API PLCore::uint32 | GetTotalNumOfPixels () const |
Returns the total number of pixels including all mipmaps. | |
PLCore::uint32 | GetTotalNumOfBytes () const |
Returns the total number of bytes required for the texture buffer data including all mipmaps. | |
PLRENDERER_API bool | GetFormatForImage (PLGraphics::EDataFormat &nDataFormat, PLGraphics::EColorFormat &nColorFormat, PLGraphics::ECompression &nCompression, EPixelFormat &nTextureBufferFomat) const |
Returns the image (PLGraphics::Image) settings required to be able to store the texture buffer data within an image. | |
PLRENDERER_API bool | DownloadAsImage (PLGraphics::Image &cImage) const |
Returns the texture buffer data as image. | |
PLRENDERER_API PLCore::uint32 | GetNumOfNANValues (PLCore::uint32 nMipmap=0, PLCore::uint8 nFace=0) const |
Downloads the texture buffer content and returns the number of NAN values in it. | |
PLRENDERER_API PLCore::uint32 | FixNANValues (const PLGraphics::Color4 &cColor, PLCore::uint32 nMipmap=0, PLCore::uint8 nFace=0) |
Downloads the texture buffer content, replaces pixels containing a NAN value by a given color, and uploads the fixed texture buffer. | |
virtual bool | IsPowerOfTwo () const =0 |
Returns whether or not the texture has a power of two dimension (POT) | |
virtual PLCore::uint32 | GetNumOfPixels (PLCore::uint32 nMipmap=0) const =0 |
Returns the number of pixels of a certain mipmap level. | |
virtual PLCore::uint32 | GetNumOfBytes (PLCore::uint32 nMipmap=0, EPixelFormat nFormat=Unknown) const =0 |
Returns the number of bytes required to hold certain mipmap level texture buffer data. | |
virtual bool | Upload (PLCore::uint32 nMipmap, EPixelFormat nFormat, const void *pData, PLCore::uint8 nFace=0)=0 |
Uploads data to the GPU. | |
virtual bool | Download (PLCore::uint32 nMipmap, EPixelFormat nFormat, void *pData, PLCore::uint8 nFace=0) const =0 |
Downloads data from the GPU. | |
Static Public Member Functions | |
static PLRENDERER_API EPixelFormat | GetFormatFromImage (const PLGraphics::Image &cImage, bool bNoCompression=false) |
Returns the texture buffer pixel format of a given image (PLGraphics::Image) | |
static PLRENDERER_API bool | IsCompressedFormat (EPixelFormat nFormat) |
Returns whether or not the given texture buffer format is compressed. | |
static PLRENDERER_API bool | IsDepthFormat (EPixelFormat nFormat) |
Returns whether or not the given texture buffer format is a depth buffer format. | |
static PLRENDERER_API EPixelFormat | GetUncompressedFormat (EPixelFormat nFormat) |
If the given texture buffer format is compressed, a proper uncompressed texture buffer format will be returned. | |
static PLRENDERER_API bool | IsFloatingPointFormat (EPixelFormat nFormat) |
Returns whether or not the given texture buffer format is a floating point format. | |
static PLRENDERER_API PLCore::uint32 | GetComponentsPerPixel (EPixelFormat nFormat) |
Returns the number of components per pixel. | |
static PLRENDERER_API PLCore::uint32 | GetBytesPerPixelComponent (EPixelFormat nFormat) |
Returns the number of bytes per pixel component. | |
static PLRENDERER_API PLCore::uint32 | GetBytesPerPixel (EPixelFormat nFormat) |
Returns the number of bytes per pixel. | |
Static Public Attributes | |
static const PLCore::uint32 | NumOfPixelFormats = 25 |
Protected Member Functions | |
PLRENDERER_API | TextureBuffer (Renderer &cRenderer, EType nType, PLCore::uint32 nFlags) |
Constructor. | |
virtual bool | MakeCurrent (PLCore::uint32 nStage)=0 |
Makes this texture buffer to the renderers current texture buffer. | |
Protected Attributes | |
PLCore::uint32 | m_nFlags |
EPixelFormat | m_nFormat |
PLCore::uint32 | m_nNumOfElements |
PLCore::uint32 | m_nNumOfMipmaps |
PLCore::uint32 | m_nTotalNumOfBytes |
Abstract renderer texture buffer resource base class.
Texture buffer flags.
Mipmaps |
Use mipmaps (see GetNumOfMipmaps() for more information) |
Compression |
Use texture buffer compression if possible (is ignored if a certain internal format is forced) |
RenderTarget |
This texture buffer can be used as render target |
Texture buffer pixel formats.
virtual PLRENDERER_API PLRenderer::TextureBuffer::~TextureBuffer | ( | ) | [virtual] |
Destructor.
PLRENDERER_API PLRenderer::TextureBuffer::TextureBuffer | ( | Renderer & | cRenderer, |
EType | nType, | ||
PLCore::uint32 | nFlags | ||
) | [protected] |
static PLRENDERER_API EPixelFormat PLRenderer::TextureBuffer::GetFormatFromImage | ( | const PLGraphics::Image & | cImage, |
bool | bNoCompression = false |
||
) | [static] |
Returns the texture buffer pixel format of a given image (PLGraphics::Image)
[in] | cImage | Image to get the texture buffer pixel format from |
[in] | bNoCompression | Do NOT use texture buffer compression? |
static PLRENDERER_API bool PLRenderer::TextureBuffer::IsCompressedFormat | ( | EPixelFormat | nFormat | ) | [static] |
Returns whether or not the given texture buffer format is compressed.
[in] | nFormat | Texture buffer pixel format |
static PLRENDERER_API bool PLRenderer::TextureBuffer::IsDepthFormat | ( | EPixelFormat | nFormat | ) | [static] |
Returns whether or not the given texture buffer format is a depth buffer format.
[in] | nFormat | Texture buffer pixel format |
static PLRENDERER_API EPixelFormat PLRenderer::TextureBuffer::GetUncompressedFormat | ( | EPixelFormat | nFormat | ) | [static] |
If the given texture buffer format is compressed, a proper uncompressed texture buffer format will be returned.
[in] | nFormat | Texture buffer pixel format |
static PLRENDERER_API bool PLRenderer::TextureBuffer::IsFloatingPointFormat | ( | EPixelFormat | nFormat | ) | [static] |
Returns whether or not the given texture buffer format is a floating point format.
[in] | nFormat | Texture buffer pixel format |
static PLRENDERER_API PLCore::uint32 PLRenderer::TextureBuffer::GetComponentsPerPixel | ( | EPixelFormat | nFormat | ) | [static] |
Returns the number of components per pixel.
[in] | nFormat | Texture buffer pixel format |
static PLRENDERER_API PLCore::uint32 PLRenderer::TextureBuffer::GetBytesPerPixelComponent | ( | EPixelFormat | nFormat | ) | [static] |
Returns the number of bytes per pixel component.
[in] | nFormat | Texture buffer pixel format |
static PLRENDERER_API PLCore::uint32 PLRenderer::TextureBuffer::GetBytesPerPixel | ( | EPixelFormat | nFormat | ) | [static] |
Returns the number of bytes per pixel.
[in] | nFormat | Texture buffer pixel format |
PLCore::uint32 PLRenderer::TextureBuffer::GetFlags | ( | ) | const [inline] |
Returns the texture buffer flags.
TextureBuffer::EPixelFormat PLRenderer::TextureBuffer::GetFormat | ( | ) | const [inline] |
Returns the texture buffer pixel format.
bool PLRenderer::TextureBuffer::IsCompressedFormat | ( | ) | const [inline] |
Returns whether or not the used texture buffer format is compressed.
bool PLRenderer::TextureBuffer::IsDepthFormat | ( | ) | const [inline] |
Returns whether or not the used texture buffer format is a depth buffer format.
TextureBuffer::EPixelFormat PLRenderer::TextureBuffer::GetUncompressedFormat | ( | ) | const [inline] |
If the used texture buffer format is compressed, a proper uncompressed texture buffer format will be returned.
bool PLRenderer::TextureBuffer::IsFloatingPointFormat | ( | ) | const [inline] |
Returns whether or not the used texture buffer format is a floating point format.
PLCore::uint32 PLRenderer::TextureBuffer::GetComponentsPerPixel | ( | ) | const [inline] |
Returns the number of components per pixel.
PLCore::uint32 PLRenderer::TextureBuffer::GetBytesPerPixelComponent | ( | ) | const [inline] |
Returns the number of bytes per pixel component.
PLCore::uint32 PLRenderer::TextureBuffer::GetBytesPerPixel | ( | ) | const [inline] |
Returns the number of bytes per pixel.
PLCore::uint32 PLRenderer::TextureBuffer::GetNumOfMipmaps | ( | ) | const [inline] |
Returns the number of mipmap levels.
Note that mipmaps are only created/used from a given image if the flag 'Mipmaps' is set.
PLCore::uint8 PLRenderer::TextureBuffer::GetNumOfFaces | ( | ) | const [inline] |
Returns the number of faces.
PLRENDERER_API PLCore::uint32 PLRenderer::TextureBuffer::GetTotalNumOfPixels | ( | ) | const |
Returns the total number of pixels including all mipmaps.
PLCore::uint32 PLRenderer::TextureBuffer::GetTotalNumOfBytes | ( | ) | const [inline] |
Returns the total number of bytes required for the texture buffer data including all mipmaps.
PLRENDERER_API bool PLRenderer::TextureBuffer::GetFormatForImage | ( | PLGraphics::EDataFormat & | nDataFormat, |
PLGraphics::EColorFormat & | nColorFormat, | ||
PLGraphics::ECompression & | nCompression, | ||
EPixelFormat & | nTextureBufferFomat | ||
) | const |
Returns the image (PLGraphics::Image) settings required to be able to store the texture buffer data within an image.
[out] | nDataFormat | Receives the required image data format |
[out] | nColorFormat | Receives the required image color format |
[out] | nCompression | Receives the required image compression |
[out] | nTextureBufferFomat | Receives the required texture buffer format to use within "TextureBuffer::Download()" in order to ask the GPU for the texture buffer data |
PLRENDERER_API bool PLRenderer::TextureBuffer::DownloadAsImage | ( | PLGraphics::Image & | cImage | ) | const |
Returns the texture buffer data as image.
[out] | cImage | Receives the texture buffer data (no need to allocated the image, this is done automatically, just pass in any image instance) |
PLRENDERER_API PLCore::uint32 PLRenderer::TextureBuffer::GetNumOfNANValues | ( | PLCore::uint32 | nMipmap = 0 , |
PLCore::uint8 | nFace = 0 |
||
) | const |
Downloads the texture buffer content and returns the number of NAN values in it.
[in] | nMipmap | Mipmap level (0 - GetNumOfMipmaps()) |
[in] | nFace | ID of the texture buffer face which should be downloaded if this is a cube texture buffer |
PLRENDERER_API PLCore::uint32 PLRenderer::TextureBuffer::FixNANValues | ( | const PLGraphics::Color4 & | cColor, |
PLCore::uint32 | nMipmap = 0 , |
||
PLCore::uint8 | nFace = 0 |
||
) |
Downloads the texture buffer content, replaces pixels containing a NAN value by a given color, and uploads the fixed texture buffer.
[in] | cColor | Color for pixels containing a NAN value |
[in] | nMipmap | Mipmap level (0 - GetNumOfMipmaps()) |
[in] | nFace | ID of the texture buffer face which should be fixed if this is a cube texture buffer |
virtual bool PLRenderer::TextureBuffer::IsPowerOfTwo | ( | ) | const [pure virtual] |
Returns whether or not the texture has a power of two dimension (POT)
Implemented in PLRenderer::TextureBufferCube, PLRenderer::TextureBufferRectangle, PLRenderer::TextureBuffer2D, PLRenderer::TextureBuffer2DArray, PLRenderer::TextureBuffer3D, and PLRenderer::TextureBuffer1D.
virtual PLCore::uint32 PLRenderer::TextureBuffer::GetNumOfPixels | ( | PLCore::uint32 | nMipmap = 0 | ) | const [pure virtual] |
Returns the number of pixels of a certain mipmap level.
[in] | nMipmap | Mipmap level (0 - GetNumOfMipmaps()) |
Implemented in PLRenderer::TextureBufferCube, PLRenderer::TextureBufferRectangle, PLRenderer::TextureBuffer2D, PLRenderer::TextureBuffer2DArray, PLRenderer::TextureBuffer3D, and PLRenderer::TextureBuffer1D.
virtual PLCore::uint32 PLRenderer::TextureBuffer::GetNumOfBytes | ( | PLCore::uint32 | nMipmap = 0 , |
EPixelFormat | nFormat = Unknown |
||
) | const [pure virtual] |
Returns the number of bytes required to hold certain mipmap level texture buffer data.
[in] | nMipmap | Mipmap level (0 - GetNumOfMipmaps()) |
[in] | nFormat | Target texture buffer pixel format, if Unknown, the format of THIS texture buffer is chosen automatically |
Implemented in PLRenderer::TextureBufferCube, PLRenderer::TextureBufferRectangle, PLRenderer::TextureBuffer2D, PLRenderer::TextureBuffer2DArray, PLRenderer::TextureBuffer3D, and PLRenderer::TextureBuffer1D.
virtual bool PLRenderer::TextureBuffer::Upload | ( | PLCore::uint32 | nMipmap, |
EPixelFormat | nFormat, | ||
const void * | pData, | ||
PLCore::uint8 | nFace = 0 |
||
) | [pure virtual] |
Uploads data to the GPU.
[in] | nMipmap | Mipmap level (0 - GetNumOfMipmaps()) |
[in] | nFormat | Texture buffer pixel format of 'pData', can not be 'Unknown'. If this is a compressed format, it MUST be the same format this texture buffer has. |
[in] | pData | Pointer to the data to upload, MUST have at least GetNumOfBytes(nMipmap, nFormat) bytes! |
[in] | nFace | ID of the texture buffer face which should be uploaded if this is a cube texture buffer |
virtual bool PLRenderer::TextureBuffer::Download | ( | PLCore::uint32 | nMipmap, |
EPixelFormat | nFormat, | ||
void * | pData, | ||
PLCore::uint8 | nFace = 0 |
||
) | const [pure virtual] |
Downloads data from the GPU.
[in] | nMipmap | Mipmap level (0 - GetNumOfMipmaps()) |
[in] | nFormat | Texture buffer pixel format of 'pData', can not be 'Unknown'. If this is a compressed format, it MUST be the same format this texture buffer has. |
[out] | pData | Will receive the downloaded data, MUST have at least GetNumOfBytes(nMipmap, nFormat) bytes! |
[in] | nFace | ID of the texture buffer face which should be downloaded if this is a cube texture buffer |
virtual bool PLRenderer::TextureBuffer::MakeCurrent | ( | PLCore::uint32 | nStage | ) | [protected, pure virtual] |
Makes this texture buffer to the renderers current texture buffer.
[in] | nStage | Texture stage |
const PLCore::uint32 PLRenderer::TextureBuffer::NumOfPixelFormats = 25 [static] |
Number of pixel formats
PLCore::uint32 PLRenderer::TextureBuffer::m_nFlags [protected] |
Texture buffer flags (see EFlags)
EPixelFormat PLRenderer::TextureBuffer::m_nFormat [protected] |
Texture buffer pixel format
PLCore::uint32 PLRenderer::TextureBuffer::m_nNumOfElements [protected] |
The number of elements
PLCore::uint32 PLRenderer::TextureBuffer::m_nNumOfMipmaps [protected] |
Number of mipmap levels (the base level is 0)
PLCore::uint32 PLRenderer::TextureBuffer::m_nTotalNumOfBytes [protected] |
Total number of bytes required to the texture buffer data including all mipmaps
|