]> git.localhorst.tv Git - blank.git/blobdiff - src/model.cpp
world class for multiple chunks
[blank.git] / src / model.cpp
index b50ccf0b168888ce0dff21e7d7423cc643c4cc01..f6a4476ecba2a98c6be7be87f0a70861ab7a1810 100644 (file)
@@ -18,6 +18,28 @@ Model::~Model() {
        glDeleteBuffers(ATTRIB_COUNT, handle);
 }
 
+Model::Model(Model &&other)
+: vertices(std::move(other.vertices))
+, colors(std::move(other.colors))
+, normals(std::move(other.normals))
+, dirty(other.dirty) {
+       for (int i = 0; i < ATTRIB_COUNT; ++i) {
+               handle[i] = other.handle[i];
+               other.handle[i] = 0;
+       }
+}
+
+Model &Model::operator =(Model &&other) {
+       vertices = std::move(other.vertices);
+       colors = std::move(other.colors);
+       normals = std::move(other.normals);
+       for (int i = 0; i < ATTRIB_COUNT; ++i) {
+               std::swap(handle[i], other.handle[i]);
+       }
+       dirty = other.dirty;
+       return *this;
+}
+
 
 void Model::Clear() {
        vertices.clear();