3 #include "VertexSlot.fpp"
4 #include "GLException.hpp"
5 #include "../service/StaticLogger.hpp"
7 #include <initializer_list>
20 template <
typename T,
typename... Ts>
23 using VertexSlot::VertexSlot;
26 *
static_cast<T*
>(this->m_buffer) = data;
30 void set(T head, Ts... tail) {
31 *
static_cast<T*
>(this->m_buffer) = head;
32 VertexSlotAssign<Ts...>(
static_cast<T*
>(this->m_buffer) + 1).set(tail...);
35 template <
typename...>
friend class VertexSet;
36 template <
typename,
typename...>
friend class VertexSlotAssign;
42 using VertexSlot::VertexSlot;
44 void operator=(T data) { *
static_cast<T*
>(this->m_buffer) = data; }
46 void set(T head) { *
static_cast<T*
>(this->m_buffer) = head; }
48 template <
typename...>
friend class VertexSet;
56 float& operator[](
int index) {
60 return static_cast<float*
>(this->m_buffer)[index];
62 void operator=(std::initializer_list<float> data) {
63 if(data.size() > m_size) {
64 slogError(
"[VertexSlot] Size of initializer_list <", data.size(),
65 "> bigger than size of the slot <", m_size,
">!");
66 throw GLException(
"[VertexSlot] Size of initializer_list bigger than "
69 std::memcpy(this->m_buffer, data.begin(), data.size() *
sizeof(float));
72 template <
typename...>
friend class VertexSet;
81 template <
typename T,
typename... Ts>
84 using VertexSlot::VertexSlot;
87 *
static_cast<T*
>(this->m_buffer) = data;
91 template <
typename,
typename...>
friend class VertexSlotAssign;
97 using VertexSlot::VertexSlot;
99 void operator,(T data) { *
static_cast<T*
>(this->m_buffer) = data; }
Definition: VertexSlot.fpp:8
Definition: VertexSlot.hpp:52
Definition: GLException.hpp:7
Definition: VertexSet.hpp:12
Definition: VertexSlot.fpp:7
Definition: VertexSlot.hpp:13
Definition: VertexSlot.hpp:95
Definition: VertexSlot.hpp:40