added RenderQueue

This commit is contained in:
cirdan
2008-01-17 16:42:24 +00:00
parent 8f17a3a819
commit 7a3d5f6eb5
17 changed files with 578 additions and 347 deletions

51
engine/RenderQueue.cpp Normal file
View 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);
}
}
}