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
114 lines
3.2 KiB
#ifndef __OPEN_GL_RADAR_WIDGET_HEADER__
|
|
#define __OPEN_GL_RADAR_WIDGET_HEADER__
|
|
|
|
#include "../guiClass.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
|
|
#include "../../hardware/soc/general/3DLRF.h"
|
|
|
|
#include <QtWidgets/QOpenGLWidget>
|
|
#include <QtGui/QOpenGLFunctions>
|
|
#include <QtGui/QOpenGLBuffer>
|
|
#include <QtGui/QVector3D>
|
|
#include <QtGui/QMatrix4x4>
|
|
#include <QtCore/QTime>
|
|
#include <QtCore/QVector>
|
|
#include <QtWidgets/QPushButton>
|
|
#include <QtGui/QPainter>
|
|
#include <QtGui/QPaintEngine>
|
|
#include <QtGui/QOpenGLShaderProgram>
|
|
#include <QtGui/QOpenGLTexture>
|
|
#include <QtCore/QCoreApplication>
|
|
#include <math.h>
|
|
#include <queue>
|
|
#include "targetDisplay.h"
|
|
|
|
//class objectLGS;
|
|
|
|
typedef struct {
|
|
float x, y, z;
|
|
} sTrg3D;
|
|
|
|
//typedef std::queue<sTrg3D> Targets3DFIFO;
|
|
typedef std::vector<sTrg3D> Targets3DFIFO;
|
|
|
|
class GLRadar : public QOpenGLWidget, protected QOpenGLFunctions, public targetDisplay {
|
|
//Q_OBJECT
|
|
public:
|
|
GLRadar(QWidget* parent);//, const QColor &background);
|
|
~GLRadar();
|
|
|
|
//void updateRanges(uint16_t *Ranges, uint32_t count);
|
|
//void updateRanges(uint32_t *Ranges, uint32_t count);
|
|
//uint32_t *m_pRanges;
|
|
//uint32_t m_nRangesCount;
|
|
//objectLGS *m_pDeviceControl;
|
|
//void addTarget(uint32_t Id, uint32_t Range, bool isMaster= true );
|
|
//void clearTargets(void);
|
|
//bool loadFromFile(char *fName);
|
|
/* For Targets */
|
|
|
|
uint16_t *m_pActiveRanges;
|
|
uint32_t m_nActiveRangesCount;
|
|
uint8_t m_bLoadProcessPercent;
|
|
bool m_bLoadProcessShown;
|
|
bool m_bShowMinimums;
|
|
public slots:
|
|
void setScaling(int scale);
|
|
//void attachLGS(objectLGS *ptr){ m_pDeviceControl = ptr; };
|
|
//void showLoadProcess( int p );
|
|
private slots:
|
|
void handleButtonPress();
|
|
|
|
void keyPressEvent( QKeyEvent *event);
|
|
void mouseMoveEvent( QMouseEvent *event);
|
|
void wheelEvent( QWheelEvent *event);
|
|
virtual void updateDisplay( void );
|
|
virtual void updateBackStage( void );
|
|
protected:
|
|
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
|
void paintGL() Q_DECL_OVERRIDE;
|
|
void initializeGL() Q_DECL_OVERRIDE;
|
|
|
|
private:
|
|
// http://pmg.org.ru/nehe/nehe02.htm
|
|
Targets3DFIFO m_fTargets;
|
|
//bool saveToFile(char *fName);
|
|
void paintRadar();
|
|
void createGeometry();
|
|
void voxel(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, qreal z1, qreal z2);
|
|
void pushDataIntoVBO( void );
|
|
|
|
basicMutex m_mDataProtectorMutex;
|
|
|
|
qreal m_fAngleZ;
|
|
qreal m_fAngleX;
|
|
qreal m_fAngleY;
|
|
qreal m_fScale;
|
|
QPoint m_slastPos;
|
|
bool m_bMustUpdateVBOData;
|
|
float *m_pOutputBuffer;
|
|
size_t m_zOutputBufferCount;
|
|
size_t m_zOutputBufferSize;
|
|
//QVector<QVector3D> m_vertices;
|
|
//QVector<QVector3D> m_normals;
|
|
|
|
QOpenGLShader *m_vshader;
|
|
QOpenGLShader *m_fshader;
|
|
QOpenGLShaderProgram *m_program;
|
|
|
|
QOpenGLTexture *m_texture;
|
|
QOpenGLBuffer m_vbo;
|
|
|
|
int m_vertexAttr;
|
|
int m_colorAttr;
|
|
int m_matrixUniform;
|
|
//bool m_transparent;
|
|
//QPushButton *m_btn;
|
|
//bool m_hasButton;
|
|
QColor m_background;
|
|
};
|
|
|
|
|
|
|
|
#endif
|