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.

114 lines
3.2 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __OPEN_GL_RADAR_WIDGET_HEADER__
  2. #define __OPEN_GL_RADAR_WIDGET_HEADER__
  3. #include "../guiClass.h"
  4. #include "../../components/base/basicMutex.h"
  5. #include "../../hardware/soc/general/3DLRF.h"
  6. #include <QtWidgets/QOpenGLWidget>
  7. #include <QtGui/QOpenGLFunctions>
  8. #include <QtGui/QOpenGLBuffer>
  9. #include <QtGui/QVector3D>
  10. #include <QtGui/QMatrix4x4>
  11. #include <QtCore/QTime>
  12. #include <QtCore/QVector>
  13. #include <QtWidgets/QPushButton>
  14. #include <QtGui/QPainter>
  15. #include <QtGui/QPaintEngine>
  16. #include <QtGui/QOpenGLShaderProgram>
  17. #include <QtGui/QOpenGLTexture>
  18. #include <QtCore/QCoreApplication>
  19. #include <math.h>
  20. #include <queue>
  21. #include "targetDisplay.h"
  22. //class objectLGS;
  23. typedef struct {
  24. float x, y, z;
  25. } sTrg3D;
  26. //typedef std::queue<sTrg3D> Targets3DFIFO;
  27. typedef std::vector<sTrg3D> Targets3DFIFO;
  28. class GLRadar : public QOpenGLWidget, protected QOpenGLFunctions, public targetDisplay {
  29. //Q_OBJECT
  30. public:
  31. GLRadar(QWidget* parent);//, const QColor &background);
  32. ~GLRadar();
  33. //void updateRanges(uint16_t *Ranges, uint32_t count);
  34. //void updateRanges(uint32_t *Ranges, uint32_t count);
  35. //uint32_t *m_pRanges;
  36. //uint32_t m_nRangesCount;
  37. //objectLGS *m_pDeviceControl;
  38. //void addTarget(uint32_t Id, uint32_t Range, bool isMaster= true );
  39. //void clearTargets(void);
  40. //bool loadFromFile(char *fName);
  41. /* For Targets */
  42. uint16_t *m_pActiveRanges;
  43. uint32_t m_nActiveRangesCount;
  44. uint8_t m_bLoadProcessPercent;
  45. bool m_bLoadProcessShown;
  46. bool m_bShowMinimums;
  47. public slots:
  48. void setScaling(int scale);
  49. //void attachLGS(objectLGS *ptr){ m_pDeviceControl = ptr; };
  50. //void showLoadProcess( int p );
  51. private slots:
  52. void handleButtonPress();
  53. void keyPressEvent( QKeyEvent *event);
  54. void mouseMoveEvent( QMouseEvent *event);
  55. void wheelEvent( QWheelEvent *event);
  56. virtual void updateDisplay( void );
  57. virtual void updateBackStage( void );
  58. protected:
  59. void resizeGL(int w, int h) Q_DECL_OVERRIDE;
  60. void paintGL() Q_DECL_OVERRIDE;
  61. void initializeGL() Q_DECL_OVERRIDE;
  62. private:
  63. // http://pmg.org.ru/nehe/nehe02.htm
  64. Targets3DFIFO m_fTargets;
  65. //bool saveToFile(char *fName);
  66. void paintRadar();
  67. void createGeometry();
  68. void voxel(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, qreal z1, qreal z2);
  69. void pushDataIntoVBO( void );
  70. basicMutex m_mDataProtectorMutex;
  71. qreal m_fAngleZ;
  72. qreal m_fAngleX;
  73. qreal m_fAngleY;
  74. qreal m_fScale;
  75. QPoint m_slastPos;
  76. bool m_bMustUpdateVBOData;
  77. float *m_pOutputBuffer;
  78. size_t m_zOutputBufferCount;
  79. size_t m_zOutputBufferSize;
  80. //QVector<QVector3D> m_vertices;
  81. //QVector<QVector3D> m_normals;
  82. QOpenGLShader *m_vshader;
  83. QOpenGLShader *m_fshader;
  84. QOpenGLShaderProgram *m_program;
  85. QOpenGLTexture *m_texture;
  86. QOpenGLBuffer m_vbo;
  87. int m_vertexAttr;
  88. int m_colorAttr;
  89. int m_matrixUniform;
  90. //bool m_transparent;
  91. //QPushButton *m_btn;
  92. //bool m_hasButton;
  93. QColor m_background;
  94. };
  95. #endif