Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

renderwidget.h 890B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef RENDERWIDGET_H
  2. #define RENDERWIDGET_H
  3. #include <QGLWidget>
  4. #include <QMouseEvent>
  5. #include <QWheelEvent>
  6. #include <QKeyEvent>
  7. #include "engine/ugameengine.h"
  8. #include "openglrenderdevice.h"
  9. class RenderWidget : public QGLWidget
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit RenderWidget(QWidget *parent = 0);
  14. protected:
  15. void initializeGL();
  16. void paintGL();
  17. void resizeGL(int width, int height);
  18. float normalizeAngle(float angle);
  19. void mousePressEvent(QMouseEvent* event);
  20. void mouseMoveEvent(QMouseEvent* event);
  21. void wheelEvent(QWheelEvent* event);
  22. void keyPressEvent(QKeyEvent* event);
  23. void rotate(float phi, float theta);
  24. signals:
  25. public slots:
  26. private:
  27. AbstractRenderDevice* _device;
  28. UGameEngine* _engine;
  29. QPoint _lastPoint;
  30. float _radius;
  31. float _phi;
  32. float _theta;
  33. Vector3D pos;
  34. };
  35. #endif // RENDERWIDGET_H