54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#include "RenderQueue.h"
|
|
|
|
namespace BlueCore
|
|
{
|
|
|
|
void RenderQueue::addOpaqueItem(RenderItem *item, const Vector3& position,
|
|
const Quaternion& orientation)
|
|
{
|
|
_OpaqueItems.push_back(QueueItem(item, position, orientation));
|
|
}
|
|
|
|
void RenderQueue::addTransparentItem(RenderItem *item, const Vector3& position,
|
|
const Quaternion& orientation)
|
|
{
|
|
_TransparentItems.push_back(QueueItem(item, position, orientation));
|
|
}
|
|
|
|
const std::list<RenderQueue::QueueItem>& RenderQueue::getOpaqueItems()
|
|
{
|
|
return _OpaqueItems;
|
|
}
|
|
|
|
const std::list<RenderQueue::QueueItem>& RenderQueue::getTransparentItems()
|
|
{
|
|
return _TransparentItems;
|
|
}
|
|
|
|
void RenderQueue::clear()
|
|
{
|
|
_OpaqueItems.clear();
|
|
_TransparentItems.clear();
|
|
}
|
|
|
|
void RenderQueue::render(RenderDevice *device) const
|
|
{
|
|
std::list<QueueItem>::const_iterator i;
|
|
|
|
for (i = _OpaqueItems.begin(); i != _OpaqueItems.end(); i++)
|
|
{
|
|
device->pushTransformation((*i).position, (*i).orientation);
|
|
(*i).item->render(device);
|
|
device->popTransformation();
|
|
}
|
|
|
|
for (i = _TransparentItems.begin(); i != _TransparentItems.end(); i++)
|
|
{
|
|
device->pushTransformation((*i).position, (*i).orientation);
|
|
(*i).item->render(device);
|
|
device->popTransformation();
|
|
}
|
|
}
|
|
|
|
}
|