You.i Engine
YiAssetTexture.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ASSET_TEXTURE_H_
3 #define _YI_ASSET_TEXTURE_H_
4 
11 #include "framework/YiPredef.h"
12 #include "graphics/YiBitmap.h"
13 #include "utility/YiRtti.h"
14 
23 {
24 public:
26  CYIAssetTexture(const CYIString &path, PathType pathType = PathType::Relative, Usage usage = Usage::Static);
27 
28  virtual ~CYIAssetTexture();
29 
35  virtual int32_t GetWidth() const override;
36 
42  virtual int32_t GetHeight() const override;
43 
50  const std::shared_ptr<CYIBitmap> &GetBitmap();
51 
55  void SetBitmap(const std::shared_ptr<CYIBitmap> &pBitmap);
56 
60  void SetBitmap(std::unique_ptr<CYIBitmap> pBitmap);
61 
66 
67  virtual std::pair<size_t, size_t> GetApproximateSize() const override;
68 
69 protected:
70  virtual std::shared_ptr<IYIGPUObject> CreateGPUObject() const override;
71 
72  virtual void OnUnload() override;
73 
74 private:
75  void UpdateCachedInfo(const std::shared_ptr<CYIBitmap> &pBitmap);
76  void UpdateEstimatedSize(bool hardwareLoadRequested);
77 
78  std::shared_ptr<CYIBitmap> m_pBitmap;
79 
81 };
82 
85 #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:36
PathType
Definition: YiAsset.h:42
A texture asset representing an image which will be loaded into the GPU.
Definition: YiAssetTexture.h:22
static uint32_t GetBytesPerPixelFromColorSpace(IYIMaterialFactory::ColorSpace colorSpace)
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:24
const std::shared_ptr< CYIBitmap > & GetBitmap()
Usage
Definition: YiAssetTextureBase.h:55
void SetBitmap(const std::shared_ptr< CYIBitmap > &pBitmap)
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
This file contains the classes and macros used to implement RTTI in You.i Engine. ...