2016-02-09 14:30:53 +00:00
|
|
|
#include "unrefqueue.hpp"
|
|
|
|
|
|
|
|
//#include <osg/Timer>
|
|
|
|
|
2018-08-14 15:42:41 +00:00
|
|
|
//#include <components/debug/debuglog.hpp>
|
2016-02-09 14:30:53 +00:00
|
|
|
|
|
|
|
namespace SceneUtil
|
|
|
|
{
|
2018-08-24 13:41:52 +00:00
|
|
|
void UnrefWorkItem::doWork()
|
2016-02-09 14:30:53 +00:00
|
|
|
{
|
2018-08-24 13:41:52 +00:00
|
|
|
mObjects.clear();
|
|
|
|
}
|
2016-02-09 14:30:53 +00:00
|
|
|
|
|
|
|
UnrefQueue::UnrefQueue()
|
|
|
|
{
|
|
|
|
mWorkItem = new UnrefWorkItem;
|
|
|
|
}
|
|
|
|
|
2017-02-04 01:24:42 +00:00
|
|
|
void UnrefQueue::push(const osg::Referenced *obj)
|
2016-02-09 14:30:53 +00:00
|
|
|
{
|
|
|
|
mWorkItem->mObjects.push_back(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnrefQueue::flush(SceneUtil::WorkQueue *workQueue)
|
|
|
|
{
|
|
|
|
if (mWorkItem->mObjects.empty())
|
|
|
|
return;
|
|
|
|
|
2016-03-28 22:25:51 +00:00
|
|
|
workQueue->addWorkItem(mWorkItem, true);
|
2016-02-09 14:30:53 +00:00
|
|
|
|
|
|
|
mWorkItem = new UnrefWorkItem;
|
|
|
|
}
|
|
|
|
|
2017-02-22 01:18:18 +00:00
|
|
|
unsigned int UnrefQueue::getNumItems() const
|
|
|
|
{
|
|
|
|
return mWorkItem->mObjects.size();
|
|
|
|
}
|
|
|
|
|
2016-02-09 14:30:53 +00:00
|
|
|
}
|