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.

abstractrenderdevice.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef ABSTRACTRENDERDEVICE_H
  2. #define ABSTRACTRENDERDEVICE_H
  3. #include <QObject>
  4. #include <QColor>
  5. #include <QImage>
  6. #include "utils/colorvector3d.h"
  7. #include "utils/texturevector3d.h"
  8. class AbstractRenderDevice : public QObject
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit AbstractRenderDevice(QObject *parent = 0);
  13. virtual ~AbstractRenderDevice();
  14. QColor getCurrentColor() const;
  15. Vector3D getLookEye() const;
  16. Vector3D getLookCenter() const;
  17. Vector3D getLookUp() const;
  18. QColor getClearColor() const;
  19. virtual Vector3D get2DFrom3D(const Vector3D& pos) = 0;
  20. virtual Vector3D get3DFrom2D(const Vector2D& pos) = 0;
  21. public slots:
  22. virtual void setClearColor(const QColor &clearColor);
  23. virtual void setCurrentColor(const QColor &color);
  24. virtual void lookAt(const Vector3D& eye, const Vector3D& center, const Vector3D& up = Vector3D(0.0, 1.0, 0.0));
  25. void loadTextureFromFile(const QVariant& id, const QString& filename);
  26. virtual void loadTexture(const QVariant& id, const QImage& texture) = 0;
  27. virtual void initialize(int fov, int width, int height) = 0;
  28. virtual void resize(int width, int height) = 0;
  29. virtual void preDraw() = 0;
  30. virtual void postDraw() = 0;
  31. virtual void drawPoint(const ColorVector3D& point) = 0;
  32. virtual void drawLine(const ColorVector3D& begin, const ColorVector3D& end, double width = 1.0) = 0;
  33. virtual void drawPolygon(const QList<ColorVector3D>& points) = 0;
  34. virtual void drawPolygonTexture(const QList<TextureVector3D>& points, const QVariant& textureId) = 0;
  35. protected:
  36. QColor _clearColor;
  37. QColor _currentColor;
  38. Vector3D _lookEye;
  39. Vector3D _lookCenter;
  40. Vector3D _lookUp;
  41. };
  42. #endif // ABSTRACTRENDERDEVICE_H