"L. Spiro Engine"
Public Member Functions | Protected Member Functions | Protected Attributes

lsg::CStandardTexture Class Reference

A standard texture. More...

#include <LSGStandardTexture.h>

Inheritance diagram for lsg::CStandardTexture:
lsg::CDirectX11StandardTexture lsg::CTextureBase lsg::CRenderTargetInterface

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:
_pfFormatThe 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:
_fStrThe strength of the normals. Must not be 0.
_bWrapXIf true, the normal map is calculated with wrapping at the horizontal borders.
_bWrapYIf 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:
_iImageThe source image to copy into this texture.
_ui32UsageTexture usage.
_bMipMapsIf true, mipmaps are generated.
_wmWrapModeWrapping mode of the texture.
_paAllocatorOptional allocator for all allocations made by this texture object.
Returns:
Returns true if creation of the texture succeeds.
LSBOOL LSE_CALL lsg::CStandardTexture::CreateFromRgbAndAlpha ( const CStandardTexture _stRgb,
const CStandardTexture _stAlpha,
const LSG_TEX_PARMS _tpSettings,
CAllocator *  _paAllocator = NULL 
)

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:
_stRgbThe texture from which to extract the RGB components for the final image.
_stAlphaThe texture from which to extract the alpha components for the final image.
_tpSettingsTexture creation parameters.
_paAllocatorOptional 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:
_pcPathPath of the file to load.
_tpSettingsTexture creation parameters.
_paAllocatorOptional 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:
_pcPathPath of the file to load.
_ui32UsageTexture usage.
_bMipMapsIf true, mipmaps are generated.
_wmWrapModeWrapping mode of the texture.
_paAllocatorOptional 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:
_pvBufferThe in-memory image of the image to load.
_uiptrSizeSize of the given image buffer in bytes.
_tpSettingsTexture creation parameters.
_paAllocatorOptional 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:
_pvBufferThe in-memory image of the image to load.
_uiptrSizeSize of the given image buffer in bytes.
_ui32UsageTexture usage.
_bMipMapsIf true, mipmaps are generated.
_wmWrapModeWrapping mode of the texture.
_paAllocatorOptional 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]

Reset everything.

Reimplemented from lsg::CTextureBase.

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:
_ui32WidthThe new width of the texture.
_ui32HeightThe new hieght of the texture.
_fFilterThe 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

LSI_PIXEL_FORMAT lsg::CStandardTexture::m_pfFormat [protected]

Texture format.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator