31 #include "element_array_buffer.h"
36 template<
typename Type>
56 : _buffer(
ElementArrayBuffer::create(gc, data.empty() ? (Type*)0 : &data[0], data.size() * sizeof(Type), usage))
70 _buffer->upload_data(gc, data, size *
sizeof(Type));
76 _buffer->upload_data(gc, data.data(), data.size() *
sizeof(Type));
83 size = size *
sizeof(Type);
84 _buffer->copy_from(gc, buffer, dest_pos *
sizeof(Type), src_pos *
sizeof(Type), size);
91 size = size *
sizeof(Type);
92 _buffer->copy_to(gc, buffer, dest_pos *
sizeof(Type), src_pos *
sizeof(Type), size);
const ElementArrayBufferPtr & buffer() const
Returns the element array buffer used by the vector.
Definition: element_array_vector.h:61
Element Array Buffer.
Definition: element_array_buffer.h:41
Typed access to a element array buffer.
Definition: element_array_vector.h:37
BufferUsage
Array Buffer usage enum.
Definition: buffer_usage.h:35
Definition: buffer_usage.h:40
std::shared_ptr< ElementArrayBuffer > ElementArrayBufferPtr
Definition: d3d_target.h:43
void copy_to(const GraphicContextPtr &gc, StagingVector< Type > &buffer, int dest_pos=0, int src_pos=0, int size=-1)
Copies data to transfer buffer.
Definition: element_array_vector.h:88
ElementArrayVector(const GraphicContextPtr &gc, const std::vector< Type > &data, BufferUsage usage=usage_static_draw)
Definition: element_array_vector.h:55
ElementArrayVector(const GraphicContextPtr &gc, int size, BufferUsage usage=usage_static_draw)
Definition: element_array_vector.h:45
ElementArrayVector()
Constructs a element array vector.
Definition: element_array_vector.h:41
void copy_from(const GraphicContextPtr &gc, StagingVector< Type > &buffer, int dest_pos=0, int src_pos=0, int size=-1)
Copies data from transfer buffer.
Definition: element_array_vector.h:80
std::shared_ptr< GraphicContext > GraphicContextPtr
Definition: d3d_target.h:49
void upload_data(const GraphicContextPtr &gc, const Type *data, int size)
Uploads data to element array buffer.
Definition: element_array_vector.h:68
Typed access to a transfer buffer.
Definition: staging_vector.h:37
ElementArrayVector(const GraphicContextPtr &gc, Type *data, int size, BufferUsage usage=usage_static_draw)
Definition: element_array_vector.h:50
Definition: Application/application.h:35
void upload_data(const GraphicContextPtr &gc, const std::vector< Type > &data)
Uploads data to element array buffer.
Definition: element_array_vector.h:74