23#ifndef VCL_BGFX_BUFFERS_VERTEX_BUFFER_H
24#define VCL_BGFX_BUFFERS_VERTEX_BUFFER_H
26#include "generic_buffer.h"
46 bool mCompute =
false;
109 bgfx::Attrib::Enum
attrib,
116 bgfx::VertexLayout
layout;
163 bgfx::Attrib::Enum
attrib,
167 bgfx::Access::Enum
access = bgfx::Access::Read,
173 bgfx::VertexLayout
layout;
210 const bgfx::Memory* data,
211 const bgfx::VertexLayout&
layout,
215 if (bgfx::isValid(mHandle))
216 bgfx::destroy(mHandle);
218 mHandle = bgfx::createVertexBuffer(data,
layout, flags);
233 if (bgfx::isValid(mHandle)) {
235 bgfx::setVertexBuffer(
stream, mHandle);
The GenericBuffer manages the lifetime of a bgfx BufferHandle.
Definition generic_buffer.h:44
void destroy()
Definition generic_buffer.h:59
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The VertexBuffer manages the lifetime of a bgfx::VertexBufferHandle.
Definition vertex_buffer.h:43
VertexBuffer()=default
Empty constructor.
void swap(VertexBuffer &other)
Swap the content of this object with another VertexBuffer object.
Definition vertex_buffer.h:61
void create(const void *bufferData, uint vertNum, bgfx::Attrib::Enum attrib, uint attribNumPerVertex, PrimitiveType attribType, bool normalize=false, bgfx::ReleaseFn releaseFn=nullptr)
Creates the vertex buffer and sets the data for rendering.
Definition vertex_buffer.h:106
void create(const bgfx::Memory *data, const bgfx::VertexLayout &layout, uint64_t flags=BGFX_BUFFER_NONE, bool compute=false)
Creates the vertex buffer and sets the data.
Definition vertex_buffer.h:209
void createForCompute(const void *bufferData, const uint vertNum, bgfx::Attrib::Enum attrib, uint attribNumPerVertex, PrimitiveType attribType, bool normalize=false, bgfx::Access::Enum access=bgfx::Access::Read, bgfx::ReleaseFn releaseFn=nullptr)
Creates the vertex buffer and sets the data for compute shaders.
Definition vertex_buffer.h:160
void setCompute(bool compute)
Set if the VertexBuffer is used for compute shaders.
Definition vertex_buffer.h:84
bool isCompute() const
Check if the VertexBuffer is used for compute shaders.
Definition vertex_buffer.h:76
void bind(uint stream, bgfx::Access::Enum access=bgfx::Access::Read) const
Bind the vertex buffer to the rendering pipeline.
Definition vertex_buffer.h:231
PrimitiveType
A simple type that enumerates the main primitive types.
Definition base.h:58