]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/bufferable.cpp
Add correct copy and move semantics to most classes
[libs/gl.git] / source / core / bufferable.cpp
index c312a4339a876f8436877842f44e689aa3f32b7a..374c4eeb3b83ee5d1617b9249383696a9f7aa15f 100644 (file)
@@ -8,6 +8,23 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
+Bufferable::Bufferable(Bufferable &&other):
+       buffer(other.buffer),
+       offset(other.offset),
+       next_in_buffer(other.next_in_buffer),
+       prev_in_buffer(other.prev_in_buffer),
+       location_dirty(other.location_dirty),
+       dirty(other.dirty)
+{
+       other.buffer = 0;
+       other.next_in_buffer = 0;
+       other.prev_in_buffer = 0;
+       if(next_in_buffer)
+               next_in_buffer->prev_in_buffer = this;
+       if(prev_in_buffer)
+               prev_in_buffer->next_in_buffer = this;
+}
+
 Bufferable::~Bufferable()
 {
        unlink_from_buffer();