Bufferable *next_in_buffer = 0;
Bufferable *prev_in_buffer = 0;
mutable bool location_dirty = false;
- mutable bool dirty = false;
+ mutable uint8_t dirty = 0;
protected:
Bufferable() = default;
std::size_t get_required_buffer_size(bool = false) const;
/** Uploads new data into the buffer if necessary. */
- void refresh() const { if(dirty) upload_data(0); }
+ void refresh(unsigned f) const { if(dirty&(1<<f)) upload_data(f, 0); }
/** Returns an object which can be used to upload data to the buffer using
mapped memory. If data is not dirty, returns null. */
- AsyncUpdater *refresh_async() const { return dirty ? new AsyncUpdater(*this) : 0; }
+ AsyncUpdater *refresh_async() const { return dirty ? create_async_updater() : 0; }
private:
void unlink_from_buffer();
private:
/** Uploads data to the buffer. Receives pointer to mapped buffer memory as
parameter, or null to use the buffer upload interface. */
- void upload_data(char *) const;
+ void upload_data(unsigned, char *) const;
+
+ AsyncUpdater *create_async_updater() const;
};
} // namespace GL
return;
const Mesh *mesh = object.get_mesh();
- mesh->get_vertices().refresh();
if(instance_buffer->get_size()==0)
instance_buffer->storage(instance_data.get_required_buffer_size(), STREAMING);
- instance_data.refresh();
Renderer::Push push(renderer);
method->apply(renderer);