void OrderedScene::prepend(Renderable &r)
{
- renderables.push_front(&r);
+ renderables.insert(renderables.begin(), &r);
}
void OrderedScene::insert(unsigned index, Renderable &r)
using Scene::Loader;
private:
- std::list<Renderable *> renderables;
+ std::vector<Renderable *> renderables;
public:
virtual void add(Renderable &);
void ResourceManager::dispatch_work()
{
- queue.sort(age_order);
+ sort(queue, age_order);
if(queue.front()->last_used+min_retain_frames<frame)
{
}
MutexLock lock(queue_mutex);
- sync_queue.splice(sync_queue.end(), async_queue, async_queue.begin());
+ sync_queue.push_back(async_queue.front());
+ async_queue.pop_front();
wait_for_work = async_queue.empty();
}
else
}
}
-ResourceManager::ManagedResource *ResourceManager::LoadingThread::front(list<ManagedResource *> &que)
+ResourceManager::ManagedResource *ResourceManager::LoadingThread::front(deque<ManagedResource *> &que)
{
MutexLock lock(queue_mutex);
if(que.empty())
{
MutexLock lock(queue_mutex);
bool was_empty = async_queue.empty();
- async_queue.splice(async_queue.end(), sync_queue, sync_queue.begin());
+ async_queue.push_back(sync_queue.front());
+ sync_queue.pop_front();
if(was_empty)
sem.signal();
}
#ifndef MSP_GL_RESOURCEMANAGER_H_
#define MSP_GL_RESOURCEMANAGER_H_
+#include <deque>
#include <msp/core/inttypes.h>
#include <msp/core/mutex.h>
#include <msp/core/semaphore.h>
private:
Semaphore sem;
Mutex queue_mutex;
- std::list<ManagedResource *> async_queue;
- std::list<ManagedResource *> sync_queue;
+ std::deque<ManagedResource *> async_queue;
+ std::deque<ManagedResource *> sync_queue;
unsigned capacity;
unsigned size;
std::list<resource_load_error> error_queue;
private:
virtual void main();
- ManagedResource *front(std::list<ManagedResource *> &);
+ ManagedResource *front(std::deque<ManagedResource *> &);
public:
void add_resource(ManagedResource &);
bool async_loads;
mutable Mutex map_mutex;
std::map<const Resource *, ManagedResource> resources;
- std::list<ManagedResource *> queue;
+ std::deque<ManagedResource *> queue;
UInt64 total_data_size;
UInt64 size_limit;
unsigned frame;