86 glBufferSubData(getEnumValue<BufferType>(
type), 0,
sizeof(
T) *
data.size(),
data.data());
158 glDeleteBuffers(1, &
buffer);
164 [[nodiscard]]
size_t size()
const {
189 typename std::vector<T>::iterator
begin() {
196 typename std::vector<T>::iterator
end() {
203 typename std::vector<T>::const_iterator
cbegin()
const {
204 return data.cbegin();
210 typename std::vector<T>::const_iterator
cend()
const {
218 glBindBuffer(getEnumValue<BufferType>(
type),
buffer);
226 template <
size_t N>
void modify(
size_t i,
const std::array<T, N>& val) {
227 std::copy(
data.begin() + i,
data.begin() + i +
N, val.data());
229 glBufferSubData(getEnumValue<BufferType>(
type),
sizeof(
T) * i,
sizeof(
T) *
N,
data.data());
237 void modify(
size_t i,
const std::vector<T>& val) {
238 std::copy(
data.begin() + i,
data.begin() + i + val.size(), val.data());
240 glBufferSubData(getEnumValue<BufferType>(
type),
sizeof(
T) * i,
sizeof(
T) * val.size(),
data.data());
249 void modify(
size_t i,
const T* arr,
size_t n) {
250 std::copy(
data.begin() + i,
data.begin() + i + n, arr);
252 glBufferSubData(getEnumValue<BufferType>(
type),
sizeof(
T) * i,
sizeof(
T) * n,
data.data());
263 glBufferSubData(getEnumValue<BufferType>(
type),
sizeof(
T) * i,
sizeof(
T) * val.size(),
data.data());
272 data.resize(newSize);
283 std::copy(
data.begin(),
data.end(), arr.data());
303 data = std::move(vec);
315 data.insert(
data.begin(), arr, arr + n);
void resize(BufferUsage usage, const std::array< T, N > &arr)
std::vector< T >::const_iterator cend() const
void resize(BufferUsage usage, std::vector< T > &&vec)
Buffer(BufferType type, BufferUsage usage, std::vector< T > &&dat)
std::vector< T >::iterator end()
void modify(size_t i, const std::vector< T > &val)
void allocBuffer(BufferUsage usage)
Buffer(BufferType type, BufferUsage usage, const std::array< T, N > &data)
void resize(BufferUsage usage, size_t newSize)
void modify(size_t i, T val)
Buffer(const Buffer &other)=delete
void resize(BufferUsage usage, const std::vector< T > &vec)
Buffer(BufferType type, BufferUsage usage, const T *arr, size_t n)
void modify(size_t i, const std::array< T, N > &val)
void resize(BufferUsage usage, const T *arr, size_t n)
void modify(size_t i, const T *arr, size_t n)
void operator=(const Buffer &other)=delete
std::vector< T >::iterator begin()
Buffer(BufferType type, BufferUsage usage, const std::vector< T > &dat)
const T & operator[](size_t i) const
std::vector< T >::const_iterator cbegin() const
GLenum getEnumValue(T value)