Simple game engine with complete export to scripting language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RenderQueue.cpp 1.2 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "RenderQueue.h"
  2. namespace BlueCore
  3. {
  4. void RenderQueue::addOpaqueItem(RenderItem *item, const Vector3& position,
  5. const Quaternion& orientation)
  6. {
  7. _OpaqueItems.push_back(QueueItem(item, position, orientation));
  8. }
  9. void RenderQueue::addTransparentItem(RenderItem *item, const Vector3& position,
  10. const Quaternion& orientation)
  11. {
  12. _TransparentItems.push_back(QueueItem(item, position, orientation));
  13. }
  14. const std::list<RenderQueue::QueueItem>& RenderQueue::getOpaqueItems()
  15. {
  16. return _OpaqueItems;
  17. }
  18. const std::list<RenderQueue::QueueItem>& RenderQueue::getTransparentItems()
  19. {
  20. return _TransparentItems;
  21. }
  22. void RenderQueue::clear()
  23. {
  24. _OpaqueItems.clear();
  25. _TransparentItems.clear();
  26. }
  27. void RenderQueue::render(RenderDevice *device) const
  28. {
  29. std::list<QueueItem>::const_iterator i;
  30. for (i = _OpaqueItems.begin(); i != _OpaqueItems.end(); i++)
  31. {
  32. device->pushTransformation((*i).position, (*i).orientation);
  33. (*i).item->render(device);
  34. device->popTransformation();
  35. }
  36. for (i = _TransparentItems.begin(); i != _TransparentItems.end(); i++)
  37. {
  38. device->pushTransformation((*i).position, (*i).orientation);
  39. (*i).item->render(device);
  40. device->popTransformation();
  41. }
  42. }
  43. }