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.

openglrenderdevice.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef OPENGLRENDERDEVICE_H
  2. #define OPENGLRENDERDEVICE_H
  3. #include "engine/abstractrenderdevice.h"
  4. struct OpenGLTextureData
  5. {
  6. unsigned id;
  7. QImage image;
  8. };
  9. class OpenGLRenderDevice : public AbstractRenderDevice
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit OpenGLRenderDevice(QObject *parent = 0);
  14. virtual Vector3D get2DFrom3D(const Vector3D& pos);
  15. virtual Vector3D get3DFrom2D(const Vector2D& pos);
  16. signals:
  17. public slots:
  18. virtual void loadTexture(const QVariant& id, const QImage& texture);
  19. virtual void initialize(int fov, int width, int height);
  20. virtual void resize(int width, int height);
  21. virtual void preDraw();
  22. virtual void postDraw();
  23. virtual void drawVertex(const ColorVector3D& point);
  24. virtual void drawPoint(const ColorVector3D& point);
  25. virtual void drawLine(const ColorVector3D& begin, const ColorVector3D& end, double width = 1.0);
  26. virtual void drawPolygon(const QList<ColorVector3D>& points);
  27. virtual void drawPolygonTexture(const QList<TextureVector3D>& points, const QVariant& textureId);
  28. private:
  29. int _width;
  30. int _height;
  31. int _fov;
  32. QMap<QVariant, OpenGLTextureData> _textures;
  33. };
  34. #endif // OPENGLRENDERDEVICE_H