You.i Engine
CYIAssetTexture Class Reference

Detailed Description

A texture asset representing an image which will be loaded into the GPU.

This texture asset contains a CYIBitmap image and is used by You.i Engine's asset management system when loading assets.

See also
CYIAssetManager

#include <asset/YiAssetTexture.h>

Inheritance diagram for CYIAssetTexture:

Public Member Functions

 CYIAssetTexture (USAGE usage=USAGE_STATIC)
 
 CYIAssetTexture (const CYIString &path, PATH_TYPE ePathType=PATH_RELATIVE, USAGE usage=USAGE_STATIC)
 
virtual ~CYIAssetTexture ()
 
virtual int32_t GetWidth () const override
 
virtual int32_t GetHeight () const override
 
const std::shared_ptr< CYIBitmap > & GetBitmap ()
 
void SetBitmap (const std::shared_ptr< CYIBitmap > &pBitmap)
 
void SetBitmap (std::unique_ptr< CYIBitmap > pBitmap)
 
virtual std::pair< uint32_t, uint32_t > GetApproximateSize () const override
 
- Public Member Functions inherited from CYIAssetTextureBase
 CYIAssetTextureBase (USAGE usage=USAGE_STATIC)
 
virtual ~CYIAssetTextureBase ()
 
void AddDirtyRegion (const YI_RECT_REL &dirtyRectangle)
 
void ClearDirtyRegions ()
 
const std::vector< YI_RECT_REL > & GetDirtyRegions () const
 
const YI_TEXTURE_CONFIGGetConfiguration () const
 
IYIMaterialFactory::YI_COLORSPACE GetColorSpace () const
 
void SetConfiguration (const YI_TEXTURE_CONFIG &config)
 
void SetMinificationFilter (YI_MIN_MAG_FILTER minFilter=YI_LINEAR, YI_MIN_MAG_FILTER magFilter=YI_LINEAR)
 
void SetMipmappingEnabled (bool bEnable)
 
bool IsMipmappingEnabled () const
 
void SetTextureWrap (YI_TEXTURE_WRAP wrapS=YI_CLAMP_TO_EDGE, YI_TEXTURE_WRAP wrapT=YI_CLAMP_TO_EDGE)
 
virtual bool HasExtendedDimensions () const
 
USAGE GetUsage () const
 
- Public Member Functions inherited from CYIAssetHardware
 CYIAssetHardware ()
 
virtual ~CYIAssetHardware ()
 
virtual bool RequestHardwareLoad ()
 
virtual bool RequestHardwareUnload ()
 
virtual bool RequestInvalidate ()
 
virtual bool RequestRestore ()
 
virtual bool Prepare () override
 
std::shared_ptr< IYIGPUObjectGetGPUObject () const
 
bool IsLoadedOnGPU () const
 
RETENTION_POLICY GetRetentionPolicy () const
 
void SetRetentionPolicy (RETENTION_POLICY ePolicy)
 
- Public Member Functions inherited from CYIAsset
virtual ~CYIAsset ()
 
const CYIStringGetPath () const
 
CYIAssetLoadParamsGetLoadParameters () const
 
bool SetName (const CYIString &name)
 
const CYIStringGetName () const
 
bool Load ()
 
void Unload ()
 
bool IsLoaded () const
 
bool Equals (const std::shared_ptr< CYIAsset > &pAsset)
 
- Public Member Functions inherited from CYIScriptableRTTIObject
 CYIScriptableRTTIObject ()
 
virtual ~CYIScriptableRTTIObject ()
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const override
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 

Protected Member Functions

virtual std::shared_ptr< IYIGPUObjectCreateGPUObject () const override
 
virtual void OnUnload () override
 
- Protected Member Functions inherited from CYIAssetTextureBase
virtual void DirtyEntireTexture ()
 
void SetWidth (int32_t nWidth)
 
void SetHeight (int32_t nHeight)
 
void SetColorSpace (IYIMaterialFactory::YI_COLORSPACE eColorSpace)
 
virtual void ApplyRetainmentPolicy () override
 
- Protected Member Functions inherited from CYIAssetHardware
virtual void OnLoad () override
 
- Protected Member Functions inherited from CYIAsset
 CYIAsset ()
 
ssize_t GetID () const
 
void SetPath (const CYIString &path, PATH_TYPE ePathType)
 
void SetApproximateSize (uint32_t nSize)
 
void SetLoaded (bool bAssetLoaded)
 
void SetLoadParameters (std::unique_ptr< CYIAssetLoadParams > pParams)
 
- Protected Member Functions inherited from CYIScriptableRTTIObject
virtual std::pair< const CYIRuntimeTypeInfo *, const void * > GetRuntimeTypeInfoWithObject () const =0
 

Additional Inherited Members

- Public Types inherited from CYIAssetTextureBase
enum  YI_MIN_MAG_FILTER {
  YI_LINEAR,
  YI_NEAREST
}
 
enum  YI_TEXTURE_WRAP {
  YI_CLAMP_TO_EDGE,
  YI_MIRROR,
  YI_REPEAT
}
 
enum  USAGE {
  USAGE_STATIC,
  USAGE_DYNAMIC,
  USAGE_RENDER_TARGET
}
 
- Public Types inherited from CYIAssetHardware
enum  RETENTION_POLICY {
  RETAIN = 0,
  UNLOAD
}
 The YI_HW_ASSET_RETENTION_POLICY enum specifies the retention policy of static hardware assets from the CPU memory once they are loaded onto the GPU. It is globally configurable, where new CYIAssetHardware will be making use of it and the can also change directly per assets. Be aware that on some platform, it is best to leave the assets retained on the CPU side when the platform lifecycle has the ability to destroy the graphic context while the app still runs, giving You.i Engine the ability to re-load every assets back onto GPU memory really fast. A good example of such platform would be Android. More...
 
- Public Types inherited from CYIAsset
enum  PATH_TYPE {
  PATH_ABSOLUTE = 0,
  PATH_RELATIVE
}
 
- Protected Attributes inherited from CYIAssetHardware
bool m_bHardwareLoadRequested
 
std::shared_ptr< IYIGPUObjectm_pGPUObject
 
RETENTION_POLICY m_eRetentionPolicy
 
- Static Protected Attributes inherited from CYIAsset
static ssize_t INVALID_ID
 

Constructor & Destructor Documentation

CYIAssetTexture::CYIAssetTexture ( USAGE  usage = USAGE_STATIC)
CYIAssetTexture::CYIAssetTexture ( const CYIString path,
PATH_TYPE  ePathType = PATH_RELATIVE,
USAGE  usage = USAGE_STATIC 
)
virtual CYIAssetTexture::~CYIAssetTexture ( )
virtual

Member Function Documentation

virtual std::shared_ptr<IYIGPUObject> CYIAssetTexture::CreateGPUObject ( ) const
overrideprotectedvirtual

Each sub-type must implement this function and returns an IYIGPUObject representing the hardware type.

Implements CYIAssetTextureBase.

virtual std::pair<uint32_t, uint32_t> CYIAssetTexture::GetApproximateSize ( ) const
overridevirtual

Calculates and returns the approximate number of bytes currently used by this asset. The first item of the returned pair object represents the memory currently taken in the CPU main memory, and the second item of the returned pair object represents the memory currently taken in the GPU memory.

Note
This function only returns an approximate memory consumption as the exact memory consumption changes depending on the used C++ libraries and on the specific GPU infrastructure and drivers used by the system.

Reimplemented from CYIAsset.

const std::shared_ptr<CYIBitmap>& CYIAssetTexture::GetBitmap ( )

Returns the underlying bitmap associated with this texture asset. If the asset will be loaded if it is not currently loaded.

See also
CYIAsset::IsLoaded
CYIAsset::Load
virtual int32_t CYIAssetTexture::GetHeight ( ) const
overridevirtual

Returns the height of the underlying bitmap, in pixels. If the bitmap has not been set the height of the CYIAssetTextureBase will be returned, this is the cached height of the last bitmpa set on this texture asset.

See also
CYIBitmap::GetHeight

Reimplemented from CYIAssetTextureBase.

virtual int32_t CYIAssetTexture::GetWidth ( ) const
overridevirtual

Returns the width of the underlying bitmap, in pixels. If the bitmap is not available the width of the base CYIAssetTextureBase will be returned, this is the cached width of the last bitmap set on this texture asset.

See also
CYIBitmap::GetWidth

Reimplemented from CYIAssetTextureBase.

virtual void CYIAssetTexture::OnUnload ( )
overrideprotectedvirtual

Implements CYIAssetTextureBase.

void CYIAssetTexture::SetBitmap ( const std::shared_ptr< CYIBitmap > &  pBitmap)

Sets a new bitmap on this texture asset using a shared pointer, pBitmap.

void CYIAssetTexture::SetBitmap ( std::unique_ptr< CYIBitmap pBitmap)

Sets a new bitmap on this texture asset using a raw pointer, pBitmap.


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