You.i Engine
YiAssetTexture.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_ASSET_TEXTURE_H_
3 #define _YI_ASSET_TEXTURE_H_
4 
6 
7 class CYIBitmap;
8 
22 {
23 public:
25  CYIAssetTexture(const CYIString &path, PathType pathType = PathType::Relative, Usage usage = Usage::Static);
26 
27  virtual ~CYIAssetTexture();
28 
34  virtual int32_t GetWidth() const override;
35 
41  virtual int32_t GetHeight() const override;
42 
49  const std::shared_ptr<CYIBitmap> &GetBitmap();
50 
54  void SetBitmap(const std::shared_ptr<CYIBitmap> &pBitmap);
55 
59  void SetBitmap(std::unique_ptr<CYIBitmap> pBitmap);
60 
65 
66  virtual std::pair<size_t, size_t> GetApproximateSize() const override;
67 
68 protected:
69  virtual std::shared_ptr<IYIGPUObject> CreateGPUObject() const override;
70 
71  virtual void OnUnload() override;
72 
73 private:
74  void UpdateCachedInfo(const std::shared_ptr<CYIBitmap> &pBitmap);
75  void UpdateEstimatedSize(bool hardwareLoadRequested);
76 
77  std::shared_ptr<CYIBitmap> m_pBitmap;
78 
80 };
81 
84 #endif // _YI_ASSET_TEXTURE_H_
virtual int32_t GetHeight() const override
ColorSpace
Definition: YiMaterialFactory.h:37
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
PathType
Definition: YiAsset.h:42
A texture asset representing an image which will be loaded into the GPU.
Definition: YiAssetTexture.h:21
static uint32_t GetBytesPerPixelFromColorSpace(IYIMaterialFactory::ColorSpace colorSpace)
The core bitmap container class used by You.i Engine.
Definition: YiBitmap.h:20
virtual ~CYIAssetTexture()
virtual void OnUnload() override
virtual int32_t GetWidth() const override
virtual std::pair< size_t, size_t > GetApproximateSize() const override
CYIAssetTexture(Usage usage=Usage::Static)
virtual std::shared_ptr< IYIGPUObject > CreateGPUObject() const override
This asset represents the base class for POT (Power Of Two) and NPOT (Non-Power Of Two) textures...
Definition: YiAssetTextureBase.h:22
const std::shared_ptr< CYIBitmap > & GetBitmap()
Usage
Definition: YiAssetTextureBase.h:53
void SetBitmap(const std::shared_ptr< CYIBitmap > &pBitmap)
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:259