X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel.cpp;fp=src%2Fmodel.cpp;h=f6a4476ecba2a98c6be7be87f0a70861ab7a1810;hb=5700ea3c08ea5e4a5c743f0413b65dc8eebfd220;hp=b50ccf0b168888ce0dff21e7d7423cc643c4cc01;hpb=8881c507009521d08648560984c0f50166224542;p=blank.git diff --git a/src/model.cpp b/src/model.cpp index b50ccf0..f6a4476 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -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();