#ifndef STREAMBUFFER_H #define STREAMBUFFER_H #include class StreamBuffer final { public: StreamBuffer(int size, int bytesPerVertex); StreamBuffer(const StreamBuffer& other) = delete; StreamBuffer(StreamBuffer&& other) = delete; StreamBuffer& operator=(const StreamBuffer& other) = delete; StreamBuffer& operator=(StreamBuffer&& other) = delete; void reset(int size); template StreamBuffer& add(const T& t) { std::memcpy(buffer + index, &t, sizeof (t)); index += sizeof (t); return *this; } void draw(); private: int bufferSize; int offset; int bytesPerVertex; int index; char* buffer; }; #endif