Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Aster/Math/math.h"
- namespace Aster {
- struct ASTER_API BufferElement
- {
- std::string name;
- uint type;
- uint size;
- uint count;
- uint offset;
- bool normalized;
- };
- class ASTER_API BufferLayout
- {
- public:
- BufferLayout();
- template<typename T>
- void Push(const std::string& name, uint count = 1, bool normalized = false)
- {
- AT_CORE_ASSERT(false, "Unknown type");
- };
- template<>
- virtual void Push<float>(const std::string& name, uint count, bool normalized) = 0;
- template<>
- virtual void Push<uint>(const std::string& name, uint count, bool normalized) = 0;
- template<>
- virtual void Push<byte>(const std::string& name, uint count, bool normalized) = 0;
- template<>
- virtual void Push<math::vec2>(const std::string& name, uint count, bool normalized) = 0;
- template<>
- virtual void Push<math::vec3>(const std::string& name, uint count, bool normalized) = 0;
- template<>
- virtual void Push<math::vec4>(const std::string& name, uint count, bool normalized) = 0;
- inline const std::vector<BufferElement>& GetLayout() const { return m_Layout; }
- inline uint GetStride() const { return m_Size; }
- protected:
- void Push(const std::string& name, uint type, uint size, uint count, bool normalized);
- protected:
- uint m_Size;
- std::vector<BufferElement> m_Layout;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement