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.

ugameengine.cpp 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "ugameengine.h"
  2. UGameEngine::UGameEngine(AbstractRenderDevice* device)
  3. : _device(device)
  4. {
  5. }
  6. UGameEngine::~UGameEngine()
  7. {
  8. }
  9. void UGameEngine::draw()
  10. {
  11. _device->preDraw();
  12. for(int i = 0; i < _entitites.size(); ++i) {
  13. UGEEntity* entity = _entitites[i];
  14. if (entity->isVisible()) {
  15. entity->draw(_device);
  16. }
  17. }
  18. _device->postDraw();
  19. }
  20. void UGameEngine::addEntity(UGEEntity *entity)
  21. {
  22. _entitites.append(entity);
  23. }
  24. void UGameEngine::lookAt(const Vector3D &eye, const Vector3D &center, const Vector3D &up)
  25. {
  26. _device->lookAt(eye, center, up);
  27. }
  28. void UGameEngine::setClearColor(const QColor &clearColor)
  29. {
  30. _device->setClearColor(clearColor);
  31. }
  32. void UGameEngine::initialize(int fov, int width, int height)
  33. {
  34. _device->initialize(fov, width, height);
  35. }
  36. void UGameEngine::resize(int width, int height)
  37. {
  38. _device->resize(width, height);
  39. }
  40. void UGameEngine::loadTextureFromFile(const QVariant &id, const QString &filename)
  41. {
  42. _device->loadTextureFromFile(id, filename);
  43. }