You.i Engine
YiAssetBufferObjectData.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_ASSET_BUFFER_OBJECT_DATA_H_
3 #define _YI_ASSET_BUFFER_OBJECT_DATA_H_
4 
6 #include "utility/YiRtti.h"
7 
18 {
19 public:
23  enum class BufferType : uint8_t
24  {
25  Vertex,
26  Index
27  };
28 
32  enum class IndexType : uint8_t
33  {
34  UnsignedShort,
35  UnsignedInt,
36  UnsignedShortLooping
37  };
38 
42  enum class BufferUsage : uint8_t
43  {
44  Static,
45  Dynamic,
46  };
47 
50 
51  virtual ~CYIAssetBufferObjectData() override;
52 
56  const std::vector<uint8_t> &GetData() const;
57 
61  BufferType GetType() const;
62 
68  IndexType GetIndexType() const;
69 
73  BufferUsage GetUsage() const;
74 
78  void SetData(uint8_t const *pData, size_t numOfElements, size_t sizeOfElement);
79 
83  void Resize(size_t numOfElements, size_t sizeOfElement);
84 
88  void SetData(const std::vector<uint8_t> &data);
89 
93  void SetType(BufferType type);
94 
100  void SetIndexType(IndexType indexType);
101 
109  void SetIndexLoopingCounts(uint8_t loopingIndexCount, uint8_t loopingVertexCount);
110 
116  uint8_t GetIndexLoopingIndexCount() const;
117 
123  uint8_t GetIndexLoopingVertexCount() const;
124 
128  void SetUsage(BufferUsage usage);
129 
133  size_t GetSizeInBytes() const;
134 
135  virtual std::pair<size_t, size_t> GetApproximateSize() const override;
136 
137  virtual void ApplyRetainmentPolicy() override;
138 
139 protected:
140  virtual std::shared_ptr<IYIGPUObject> CreateGPUObject() const override;
141 
142  virtual void OnUnload() override;
143 
144 private:
147 
148  std::vector<uint8_t> m_data;
149  size_t m_sizeInBytes;
150  BufferType m_type;
151  IndexType m_indexType;
152  BufferUsage m_usage;
153  uint8_t m_loopingIndexCount;
154  uint8_t m_loopingVertexCount;
155 
157 };
158 
163 #endif // _YI_ASSET_BUFFER_OBJECT_DATA_H_
BufferType
Definition: YiAssetBufferObjectData.h:23
IndexType
Definition: YiAssetBufferObjectData.h:32
void SetUsage(BufferUsage usage)
uint8_t GetIndexLoopingVertexCount() const
virtual std::pair< size_t, size_t > GetApproximateSize() const override
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
BufferType GetType() const
PathType
Definition: YiAsset.h:42
BufferUsage
Definition: YiAssetBufferObjectData.h:42
BufferUsage GetUsage() const
virtual void OnUnload() override
size_t GetSizeInBytes() const
virtual void ApplyRetainmentPolicy() override
void Resize(size_t numOfElements, size_t sizeOfElement)
virtual std::shared_ptr< IYIGPUObject > CreateGPUObject() const override
void SetType(BufferType type)
virtual ~CYIAssetBufferObjectData() override
Hardware-mirrored asset. These assets contain IYIGPUObject counterparts.
Definition: YiAssetHardware.h:19
void SetIndexType(IndexType indexType)
void SetIndexLoopingCounts(uint8_t loopingIndexCount, uint8_t loopingVertexCount)
IndexType GetIndexType() const
uint8_t GetIndexLoopingIndexCount() const
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:259
As asset container which wraps shared index or vertex buffer object data.
Definition: YiAssetBufferObjectData.h:17
const std::vector< uint8_t > & GetData() const
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
void SetData(uint8_t const *pData, size_t numOfElements, size_t sizeOfElement)