A standard texture.
More...
#include <LSGStandardTexture.h>
List of all members.
Public Member Functions |
LSBOOL LSE_CALL | LoadTextureFromMemory (const LSVOID *_pvBuffer, LSUINTPTR _uiptrSize, LSUINT32 _ui32Usage, LSBOOL _bMipMaps=true, LSG_WRAP_MODE _wmWrapMode=LSG_WM_CLAMP, CAllocator *_paAllocator=NULL) |
LSBOOL LSE_CALL | LoadTextureFromMemory (const LSVOID *_pvBuffer, LSUINTPTR _uiptrSize, const LSG_TEX_PARMS &_tpSettings, CAllocator *_paAllocator=NULL) |
LSBOOL LSE_CALL | LoadTextureFromFile (const LSCHAR *_pcPath, LSUINT32 _ui32Usage, LSBOOL _bMipMaps=true, LSG_WRAP_MODE _wmWrapMode=LSG_WM_CLAMP, CAllocator *_paAllocator=NULL) |
LSBOOL LSE_CALL | LoadTextureFromFile (const LSCHAR *_pcPath, const LSG_TEX_PARMS &_tpSettings, CAllocator *_paAllocator=NULL) |
LSBOOL LSE_CALL | CreateFromImage (const CImage &_iImage, LSUINT32 _ui32Usage, LSBOOL _bMipMaps=true, LSG_WRAP_MODE _wmWrapMode=LSG_WM_CLAMP, CAllocator *_paAllocator=NULL) |
LSBOOL LSE_CALL | CreateFromRgbAndAlpha (const CStandardTexture &_stRgb, const CStandardTexture &_stAlpha, const LSG_TEX_PARMS &_tpSettings, CAllocator *_paAllocator=NULL) |
LSBOOL LSE_CALL | Finalize () |
virtual LSVOID LSE_CALL | Reset () |
LSVOID LSE_CALL | ConvertToFormat (LSI_PIXEL_FORMAT _pfFormat) |
LSBOOL LSE_CALL | ResizeTo (LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSI_FILTER _fFilter=LSI_F_ANY) |
LSBOOL LSE_CALL | Flip () |
LSVOID LSE_CALL | ConvertToNormalMap (LSFLOAT _fStr, LSBOOL _bWrapX=true, LSBOOL _bWrapY=true) |
LSBOOL LSE_CALL | ConvertToDxt () |
LSVOID LSE_CALL | MakeSetOnly () |
LSE_INLINE LSI_PIXEL_FORMAT
LSE_CALL | GetFormat () const |
LSE_INLINE const CImage &LSE_CALL | GetImage () const |
Protected Member Functions |
LSVOID LSE_CALL | FixUsage () |
Protected Attributes |
LSI_PIXEL_FORMAT | m_pfFormat |
Detailed Description
A standard texture.
Class CStandardTexture Description: A standard texture. Used for diffuse materials, mainly. Also sprites etc.
Member Function Documentation
LSBOOL LSE_CALL lsg::CStandardTexture::ConvertToDxt |
( |
| ) |
|
Converts the texture to a DXT-compressed texture. Texture must not already be DXT-compressed. ** Must be locked.
- Returns:
- Returns true if the compression was successful.
LSVOID LSE_CALL lsg::CStandardTexture::ConvertToFormat |
( |
LSI_PIXEL_FORMAT |
_pfFormat | ) |
|
Convert to another format in-place. ** Must be locked.
- Parameters:
-
_pfFormat | The format to which to convert the image data of this texture. |
LSVOID LSE_CALL lsg::CStandardTexture::ConvertToNormalMap |
( |
LSFLOAT |
_fStr, |
|
|
LSBOOL |
_bWrapX = true , |
|
|
LSBOOL |
_bWrapY = true |
|
) |
| |
Converts the given texture to a normal map. Typically the texture should be a black-and-white heightmap for this to work properly. ** Must be locked.
- Parameters:
-
_fStr | The strength of the normals. Must not be 0. |
_bWrapX | If true, the normal map is calculated with wrapping at the horizontal borders. |
_bWrapY | If true, the normal map is calculated with wrapping at the vertical borders. |
LSBOOL LSE_CALL lsg::CStandardTexture::CreateFromImage |
( |
const CImage & |
_iImage, |
|
|
LSUINT32 |
_ui32Usage, |
|
|
LSBOOL |
_bMipMaps = true , |
|
|
LSG_WRAP_MODE |
_wmWrapMode = LSG_WM_CLAMP , |
|
|
CAllocator * |
_paAllocator = NULL |
|
) |
| |
Creates a texture from an existing CImage image. The CImage is copied, so the input source can be deleted after a successful call to this function.
- Parameters:
-
_iImage | The source image to copy into this texture. |
_ui32Usage | Texture usage. |
_bMipMaps | If true, mipmaps are generated. |
_wmWrapMode | Wrapping mode of the texture. |
_paAllocator | Optional allocator for all allocations made by this texture object. |
- Returns:
- Returns true if creation of the texture succeeds.
Create a texture from an RGB and alpha source. The created texture is always in LSI_PF_R8G8B8A8 format. If the alpha source has no alpha channel, the intensities of its RGB channels are used to create the alpha. The dimensions of the created image are the the independant maximums of the widths and heights of the input images.
- Parameters:
-
_stRgb | The texture from which to extract the RGB components for the final image. |
_stAlpha | The texture from which to extract the alpha components for the final image. |
_tpSettings | Texture creation parameters. |
_paAllocator | Optional allocator for all allocations made by this texture object. |
- Returns:
- Returns true if there was enough memory to perform the combination.
LSBOOL LSE_CALL lsg::CStandardTexture::Finalize |
( |
| ) |
|
Send the graphics data to the hardware. If the texture is set-only it cannot be modified after calling this.
- Returns:
- Returns true if the upload to the graphics hardware succeeded.
LSVOID LSE_CALL lsg::CStandardTexture::FixUsage |
( |
| ) |
[protected] |
Fixes the usage flags. Removes invalid combinations and provides defaults for blank fields.
LSBOOL LSE_CALL lsg::CStandardTexture::Flip |
( |
| ) |
|
Flip the image vertically. ** Must be locked.
- Returns:
- Returns false if the texture is not locked.
LSE_INLINE LSI_PIXEL_FORMAT LSE_CALL lsg::CStandardTexture::GetFormat |
( |
| ) |
const |
Gets the format of the texture.
- Returns:
- Returns the texture format.
LSE_INLINE const CImage &LSE_CALL lsg::CStandardTexture::GetImage |
( |
| ) |
const |
Gets the base image for read-only. ** Must be locked.
- Returns:
- Returns the base image for read-only.
LSBOOL LSE_CALL lsg::CStandardTexture::LoadTextureFromFile |
( |
const LSCHAR * |
_pcPath, |
|
|
const LSG_TEX_PARMS & |
_tpSettings, |
|
|
CAllocator * |
_paAllocator = NULL |
|
) |
| |
Load an image from disc. The path must be given in UTF-8 format.
- Parameters:
-
_pcPath | Path of the file to load. |
_tpSettings | Texture creation parameters. |
_paAllocator | Optional allocator for all allocations made by this texture object. |
- Returns:
- Returns true if creation of the texture succeeds.
LSBOOL LSE_CALL lsg::CStandardTexture::LoadTextureFromFile |
( |
const LSCHAR * |
_pcPath, |
|
|
LSUINT32 |
_ui32Usage, |
|
|
LSBOOL |
_bMipMaps = true , |
|
|
LSG_WRAP_MODE |
_wmWrapMode = LSG_WM_CLAMP , |
|
|
CAllocator * |
_paAllocator = NULL |
|
) |
| |
Load an image from disc. The path must be given in UTF-8 format.
- Parameters:
-
_pcPath | Path of the file to load. |
_ui32Usage | Texture usage. |
_bMipMaps | If true, mipmaps are generated. |
_wmWrapMode | Wrapping mode of the texture. |
_paAllocator | Optional allocator for all allocations made by this texture object. |
- Returns:
- Returns true if creation of the texture succeeds.
LSBOOL LSE_CALL lsg::CStandardTexture::LoadTextureFromMemory |
( |
const LSVOID * |
_pvBuffer, |
|
|
LSUINTPTR |
_uiptrSize, |
|
|
const LSG_TEX_PARMS & |
_tpSettings, |
|
|
CAllocator * |
_paAllocator = NULL |
|
) |
| |
Load an image from memory.
- Parameters:
-
_pvBuffer | The in-memory image of the image to load. |
_uiptrSize | Size of the given image buffer in bytes. |
_tpSettings | Texture creation parameters. |
_paAllocator | Optional allocator for all allocations made by this texture object. |
- Returns:
- Returns true if creation of the texture succeeds.
LSBOOL LSE_CALL lsg::CStandardTexture::LoadTextureFromMemory |
( |
const LSVOID * |
_pvBuffer, |
|
|
LSUINTPTR |
_uiptrSize, |
|
|
LSUINT32 |
_ui32Usage, |
|
|
LSBOOL |
_bMipMaps = true , |
|
|
LSG_WRAP_MODE |
_wmWrapMode = LSG_WM_CLAMP , |
|
|
CAllocator * |
_paAllocator = NULL |
|
) |
| |
Load an image from memory.
- Parameters:
-
_pvBuffer | The in-memory image of the image to load. |
_uiptrSize | Size of the given image buffer in bytes. |
_ui32Usage | Texture usage. |
_bMipMaps | If true, mipmaps are generated. |
_wmWrapMode | Wrapping mode of the texture. |
_paAllocator | Optional allocator for all allocations made by this texture object. |
- Returns:
- Returns true if creation of the texture succeeds.
LSVOID LSE_CALL lsg::CStandardTexture::MakeSetOnly |
( |
| ) |
|
Make set-only. Can only be done on textures that were not originally set-only. After this is called the texture cannot be modified unless it is already locked. If it is locked, it will become unreadable and unwriteable when it is fully unlocked or finalized.
virtual LSVOID LSE_CALL lsg::CStandardTexture::Reset |
( |
| ) |
[virtual] |
LSBOOL LSE_CALL lsg::CStandardTexture::ResizeTo |
( |
LSUINT32 |
_ui32Width, |
|
|
LSUINT32 |
_ui32Height, |
|
|
LSI_FILTER |
_fFilter = LSI_F_ANY |
|
) |
| |
Resize the texture using a high-quality filter. ** Must be locked.
- Parameters:
-
_ui32Width | The new width of the texture. |
_ui32Height | The new hieght of the texture. |
_fFilter | The filter to use for the resize, or LSI_F_ANY to let the engine decide. |
- Returns:
- Returns true if the resize succeeds. If false is returned, the texture remains its previous size and is still valid.
Member Data Documentation
The documentation for this class was generated from the following file: