Class IndexBuffer#
Defined in File IndexBuffer.h
Class Documentation#
-
class IndexBuffer#
Public Functions
-
IndexBuffer(IndexBuffer&&) noexcept = default#
Move constructor.
-
IndexBuffer &operator=(IndexBuffer&&) noexcept = default#
Move assignment operator.
-
consteval IndexBuffer(const IndexBuffer&) noexcept = delete#
Copy constructor.
-
consteval IndexBuffer &operator=(const IndexBuffer&) noexcept = delete#
Copy assignment operator.
-
~IndexBuffer() = default#
Destructor.
-
u32 GetCount() const noexcept#
Retrieve the count of indices inside this buffer.
- Returns:
Count of indices.
-
u64 GetSize() const noexcept#
Retrieve the total byte size of the buffer.
- Returns:
Total buffer byte size.
-
UpdateFrequency GetUpdateFrequency() const noexcept#
Retrieve the update frequency used by this buffer.
- Returns:
Update frequency.
-
void Use(const Window &window = *TRAP::Application::GetWindow()) const#
Use this buffer for rendering on the given window.
Remark
Headless mode: This function is not available in headless mode.
-
void SetData(std::span<const u16> indices, u64 offset = 0)#
Update the buffers index data.
- Parameters:
indices – Pointer to the updated data.
offset – Byte offset into the currently used index data.
-
void SetData(std::span<const u32> indices, u64 offset = 0)#
Update the buffers index data.
- Parameters:
indices – Pointer to the updated data.
offset – Byte offset into the currently used index data.
-
bool IsLoaded() const#
Check whether uploading data to the GPU has finished.
- Returns:
True if uploading data to the GPU has finished.
-
void AwaitLoading() const#
Wait until uploading data to the GPU has finished.
Public Static Functions
-
static Scope<IndexBuffer> Create(std::span<const u16> indices, UpdateFrequency updateFrequency)#
Create a new index buffer and set its data.
- Parameters:
indices – Pointer to the data to upload.
updateFrequency – Update frequency for the buffer.
- Returns:
New index buffer.
-
static Scope<IndexBuffer> Create(std::span<const u32> indices, UpdateFrequency updateFrequency)#
Create a new index buffer and set its data.
- Parameters:
indices – Pointer to the data to upload.
updateFrequency – Update frequency for the buffer.
- Returns:
New index buffer.
-
static Scope<IndexBuffer> Create(u64 size, UpdateFrequency updateFrequency)#
Create a new index buffer and set its size.
- Parameters:
size – Byte size for the index buffer.
updateFrequency – Update frequency for the buffer.
- Returns:
New index buffer.
Protected Functions
-
IndexBuffer(RendererAPI::IndexType indexType, API::SyncToken syncToken, const TRAP::Ref<TRAP::Graphics::Buffer> &indexBuffer) noexcept#
Constructor.
- Parameters:
indexType – Index type of the index buffer.
syncToken – Synchronization token of the index buffer.
indexBuffer – Interal index buffer object.
-
IndexBuffer(IndexBuffer&&) noexcept = default#