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.
#include <asset/YiAssetTexture.h>
Public Member Functions | |
CYIAssetTexture (Usage usage=Usage::Static) | |
CYIAssetTexture (const CYIString &path, PathType pathType=PathType::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< size_t, size_t > | GetApproximateSize () const override |
![]() | |
CYIAssetTextureBase (Usage usage=Usage::Static) | |
virtual | ~CYIAssetTextureBase () override |
void | AddDirtyRegion (const YI_RECT_REL &dirtyRectangle) |
void | GrowDirtyRegion (const YI_RECT_REL &dirtyRectangle) |
void | ClearDirtyRegions () |
const std::vector< YI_RECT_REL > & | GetDirtyRegions () const |
const TextureConfig & | GetConfiguration () const |
IYIMaterialFactory::ColorSpace | GetColorSpace () const |
void | SetConfiguration (const TextureConfig &config) |
void | SetMinificationFilter (Filtering minFilter=Filtering::Linear, Filtering magFilter=Filtering::Linear) |
void | SetMipmappingEnabled (bool enable) |
bool | IsMipmappingEnabled () const |
void | SetTextureWrap (WrapMode wrapS=WrapMode::ClampToEdge, WrapMode wrapT=WrapMode::ClampToEdge) |
virtual bool | HasExtendedDimensions () const |
Usage | GetUsage () const |
virtual void | ApplyRetainmentPolicy () override |
![]() | |
CYIAssetHardware () | |
virtual | ~CYIAssetHardware () override |
virtual bool | RequestHardwareLoad () |
virtual bool | RequestHardwareUnload () |
virtual bool | RequestInvalidate () |
virtual bool | RequestRestore () |
virtual bool | Prepare () override |
const std::shared_ptr< IYIGPUObject > & | GetGPUObject () const |
bool | IsLoadedOnGPU () const |
RetentionPolicy | GetRetentionPolicy () const |
void | SetRetentionPolicy (RetentionPolicy policy) |
![]() | |
virtual | ~CYIAsset () |
const CYIString & | GetPath () const |
CYIAssetLoadParams * | GetLoadParameters () const |
bool | SetName (const CYIString &name) |
const CYIString & | GetName () const |
bool | Load () |
void | Unload () |
bool | IsLoaded () const |
bool | Equals (const std::shared_ptr< CYIAsset > &pAsset) |
Static Public Member Functions | |
static uint32_t | GetBytesPerPixelFromColorSpace (IYIMaterialFactory::ColorSpace colorSpace) |
Protected Member Functions | |
virtual std::shared_ptr< IYIGPUObject > | CreateGPUObject () const override |
virtual void | OnUnload () override |
![]() | |
virtual void | DirtyEntireTexture () |
void | SetWidth (int32_t width) |
void | SetHeight (int32_t height) |
void | SetColorSpace (IYIMaterialFactory::ColorSpace colorSpace) |
![]() | |
virtual void | OnLoad () override |
![]() | |
CYIAsset () | |
ssize_t | GetID () const |
void | SetPath (const CYIString &path, PathType pathType) |
void | SetApproximateSize (size_t size) |
void | SetLoaded (bool assetLoaded) |
void | SetLoadParameters (std::unique_ptr< CYIAssetLoadParams > pParams) |
Additional Inherited Members | |
![]() | |
enum | Filtering { Filtering::Linear, Filtering::Nearest } |
enum | WrapMode { WrapMode::ClampToEdge, WrapMode::Mirror, WrapMode::Repeat } |
enum | Usage { Usage::Static, Usage::Dynamic, Usage::RenderTarget } |
![]() | |
enum | RetentionPolicy { RetentionPolicy::Retain = 0, RetentionPolicy::Unload } |
The CYIAssetHardware::RetentionPolicy 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... | |
![]() | |
enum | PathType { PathType::Absolute = 0, PathType::Relative } |
![]() | |
bool | m_hardwareLoadRequested |
std::shared_ptr< IYIGPUObject > | m_pGPUObject |
RetentionPolicy | m_retentionPolicy |
![]() | |
static ssize_t | INVALID_ID |
CYIAssetTexture::CYIAssetTexture | ( | Usage | usage = Usage::Static | ) |
CYIAssetTexture::CYIAssetTexture | ( | const CYIString & | path, |
PathType | pathType = PathType::Relative , |
||
Usage | usage = Usage::Static |
||
) |
|
virtual |
|
overrideprotectedvirtual |
Each sub-type must implement this function and returns an IYIGPUObject representing the hardware type.
Implements CYIAssetTextureBase.
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.
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.
|
static |
Returns the number of bytes per pixel for a given ColorSpace.
|
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.
Reimplemented from CYIAssetTextureBase.
|
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.
Reimplemented from CYIAssetTextureBase.
|
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.