added RenderQueue
This commit is contained in:
51
engine/RenderQueue.cpp
Normal file
51
engine/RenderQueue.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#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->setTransformation((*i).position, (*i).orientation);
|
||||
(*i).item->render(device);
|
||||
}
|
||||
|
||||
for (i = _TransparentItems.begin(); i != _TransparentItems.end(); i++)
|
||||
{
|
||||
device->setTransformation((*i).position, (*i).orientation);
|
||||
(*i).item->render(device);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user