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.
		
		
		
		
		
			
		
			
				
					
					
						
							48 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
	
	
							48 lines
						
					
					
						
							1.2 KiB
						
					
					
				| #pragma once
 | |
| 
 | |
| #include <memory>
 | |
| 
 | |
| #include <QOpenGLFunctions>
 | |
| #include <QOpenGLShaderProgram>
 | |
| #include <QOpenGLWidget>
 | |
| 
 | |
| #include "cereal/visionipc/visionipc_client.h"
 | |
| #include "selfdrive/common/mat.h"
 | |
| #include "selfdrive/common/visionimg.h"
 | |
| #include "selfdrive/ui/ui.h"
 | |
| 
 | |
| class CameraViewWidget : public QOpenGLWidget, protected QOpenGLFunctions {
 | |
|   Q_OBJECT
 | |
| 
 | |
| public:
 | |
|   using QOpenGLWidget::QOpenGLWidget;
 | |
|   explicit CameraViewWidget(VisionStreamType stream_type, bool zoom, QWidget* parent = nullptr);
 | |
|   ~CameraViewWidget();
 | |
|   void setStreamType(VisionStreamType type);
 | |
| 
 | |
| signals:
 | |
|   void clicked();
 | |
|   void frameUpdated();
 | |
| 
 | |
| protected:
 | |
|   void paintGL() override;
 | |
|   void resizeGL(int w, int h) override;
 | |
|   void initializeGL() override;
 | |
|   void hideEvent(QHideEvent *event) override;
 | |
|   void mouseReleaseEvent(QMouseEvent *event) override;
 | |
|   void updateFrameMat(int w, int h);
 | |
|   std::unique_ptr<VisionIpcClient> vipc_client;
 | |
| 
 | |
| protected slots:
 | |
|   void updateFrame();
 | |
| 
 | |
| private:
 | |
|   bool zoomed_view;
 | |
|   VisionBuf *latest_frame = nullptr;
 | |
|   GLuint frame_vao, frame_vbo, frame_ibo;
 | |
|   mat4 frame_mat;
 | |
|   std::unique_ptr<EGLImageTexture> texture[UI_BUF_COUNT];
 | |
|   QOpenGLShaderProgram *program;
 | |
| 
 | |
|   VisionStreamType stream_type;
 | |
| };
 | |
| 
 |