44class FGE_API VertexBuffer :
public ContextAware
47 explicit VertexBuffer(
Context const& context);
48 VertexBuffer(VertexBuffer
const& r);
49 VertexBuffer(VertexBuffer&& r)
noexcept;
50 ~VertexBuffer()
override;
52 VertexBuffer& operator=(VertexBuffer
const& r);
53 VertexBuffer& operator=(VertexBuffer&& r)
noexcept;
55 void create(std::size_t vertexSize, VkPrimitiveTopology topology, BufferTypes type = BufferTypes::DEFAULT);
58 void resize(std::size_t vertexSize);
59 void append(
Vertex const& vertex);
65 [[nodiscard]] std::size_t getCount()
const;
67 [[nodiscard]]
Vertex* getVertices();
68 [[nodiscard]]
Vertex const* getVertices()
const;
70 [[nodiscard]]
Vertex& operator[](std::size_t index);
71 [[nodiscard]]
Vertex const& operator[](std::size_t index)
const;
73 void setPrimitiveTopology(VkPrimitiveTopology topology);
74 [[nodiscard]] VkPrimitiveTopology getPrimitiveTopology()
const;
76 [[nodiscard]] VkBuffer getVerticesBuffer()
const;
77 [[nodiscard]] VmaAllocation getVerticesBufferAllocation()
const;
79 [[nodiscard]] BufferTypes getType()
const;
81 [[nodiscard]] fge::RectFloat getBounds()
const;
84 void mapBuffer()
const;
85 void cleanBuffer()
const;
86 void updateBuffer()
const;
88 std::vector<Vertex> g_vertices;
92 mutable std::size_t g_bufferCapacity;
94 mutable bool g_needUpdate;
98 mutable VkPrimitiveTopology g_primitiveTopology;
101class FGE_API IndexBuffer :
public ContextAware
104 explicit IndexBuffer(
Context const& context);
105 IndexBuffer(IndexBuffer
const& r);
106 IndexBuffer(IndexBuffer&& r)
noexcept;
107 ~IndexBuffer()
override;
109 IndexBuffer& operator=(IndexBuffer
const& r);
110 IndexBuffer& operator=(IndexBuffer&& r)
noexcept;
112 void create(std::size_t indexSize, BufferTypes type = BufferTypes::DEFAULT);
115 void resize(std::size_t indexSize);
116 void append(uint16_t index = std::numeric_limits<uint16_t>::max());
118 void destroy()
final;
122 [[nodiscard]] std::size_t getCount()
const;
124 [[nodiscard]] uint16_t* getIndices();
125 [[nodiscard]] uint16_t
const* getIndices()
const;
127 [[nodiscard]] uint16_t& operator[](std::size_t index);
128 [[nodiscard]] uint16_t
const& operator[](std::size_t index)
const;
130 [[nodiscard]] VkBuffer getIndicesBuffer()
const;
131 [[nodiscard]] VmaAllocation getIndicesBufferAllocation()
const;
133 [[nodiscard]] BufferTypes getType()
const;
136 void mapBuffer()
const;
137 void cleanBuffer()
const;
138 void updateBuffer()
const;
140 std::vector<uint16_t> g_indices;
144 mutable std::size_t g_bufferCapacity;
146 mutable bool g_needUpdate;
Vulkan context.
Definition C_context.hpp:70