颜色映射图例,规格尺寸修改

This commit is contained in:
2026-01-15 16:13:36 +08:00
parent f700dd360e
commit 354552dc88
21 changed files with 1200 additions and 223 deletions

View File

@@ -14,6 +14,7 @@
#include <QMatrix4x4>
#include <QVector3D>
#include <QString>
#include <QColor>
#include <atomic>
#include <qtmetamacros.h>
#include <qvectornd.h>
@@ -26,6 +27,8 @@ struct Ray {
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions_3_3_Core {
Q_OBJECT
Q_PROPERTY(float yaw READ yaw WRITE setYaw NOTIFY yawChanged)
Q_PROPERTY(int row READ row WRITE setRow)
Q_PROPERTY(int col READ col WRITE setCol)
// Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid NOTIFY showGridChanged)
public:
enum RenderMode {
@@ -59,7 +62,8 @@ public:
bool showGrid() const { return m_showGrid; }
int row() const { return m_rows; }
int col() const { return m_cols; }
public slots:
// 值域范围,用于 shader 里把 value 映射到颜色(绿->红)
@@ -70,6 +74,11 @@ public slots:
void setLightMode(bool on);
void setShowBg(bool on);
void setShowGrid(bool on);
void setCol(int col);
void setRow(int row);
void setColorLow(const QColor& color);
void setColorMid(const QColor& color);
void setColorHigh(const QColor& color);
signals:
void yawChanged();
@@ -85,6 +94,7 @@ protected:
void wheelEvent(QWheelEvent *event) override;
private:
void initGeometry_();
void initPanelGeometry_();
void initDotGeometry_();
void initBackgroundGeometry_();
@@ -154,6 +164,9 @@ private:
unsigned int m_bgVbo = 0;
bool m_lightMode = true;
bool m_showBg = true;
QVector3D m_colorLow{0.10f, 0.75f, 1.00f};
QVector3D m_colorMid{0.10f, 0.95f, 0.35f};
QVector3D m_colorHigh{1.00f, 0.22f, 0.10f};
// MVP = Projection * View * Model。
// 这里 panel/dots 顶点基本已经是“世界坐标”,所以我们用 proj*view 即可model 先省略)。