Add OpenGL waterfall renderer

This commit is contained in:
2026-05-25 20:41:06 +03:00
parent 5090838563
commit 08c5f0ddb7
6 changed files with 578 additions and 23 deletions
+30 -9
View File
@@ -431,7 +431,7 @@ type
PbSpectrum: TControl;
PbRuler: TPaintBox; // полоса частотных меток между спектром и водопадом
PanelSplitter: TPanel; // перетаскиваемый разделитель спектр/водопад
PbWaterfall: TPaintBox;
PbWaterfall: TControl;
// ---- Status bar ----
StatusPanel: TMainStatusBar;
@@ -1469,6 +1469,8 @@ begin
FSplitterDrag := False;
FUseOpenGLSpectrum := HasOpenGLSpectrumSwitch;
if FUseOpenGLSpectrum then
FWaterfallFrameInterval := 1;
if FUseOpenGLSpectrum then
FSpecView := TSpectrumViewOpenGL.Create
else
@@ -2186,12 +2188,26 @@ begin
PanelSplitter.OnMouseMove := SplitterMouseMove;
PanelSplitter.OnMouseUp := SplitterMouseUp;
PbWaterfall := TPaintBox.Create(Self);
if FUseOpenGLSpectrum then
begin
PbWaterfall := TOpenGLControl.Create(Self);
TOpenGLControl(PbWaterfall).AutoResizeViewport := False;
TOpenGLControl(PbWaterfall).DoubleBuffered := True;
TOpenGLControl(PbWaterfall).OnPaint := FSpecView.PaintWaterfall;
TOpenGLControl(PbWaterfall).OnMouseDown := PbWaterfallMouseDown;
TOpenGLControl(PbWaterfall).OnMouseMove := PbWaterfallMouseMove;
TOpenGLControl(PbWaterfall).OnMouseUp := PbWaterfallMouseUp;
TSpectrumViewOpenGL(FSpecView).AttachWaterfallControl(TOpenGLControl(PbWaterfall));
end
else
begin
PbWaterfall := TPaintBox.Create(Self);
TPaintBox(PbWaterfall).OnPaint := FSpecView.PaintWaterfall;
TPaintBox(PbWaterfall).OnMouseDown := PbWaterfallMouseDown;
TPaintBox(PbWaterfall).OnMouseMove := PbWaterfallMouseMove;
TPaintBox(PbWaterfall).OnMouseUp := PbWaterfallMouseUp;
end;
PbWaterfall.Parent := PanelRight;
PbWaterfall.OnPaint := FSpecView.PaintWaterfall;
PbWaterfall.OnMouseDown := PbWaterfallMouseDown;
PbWaterfall.OnMouseMove := PbWaterfallMouseMove;
PbWaterfall.OnMouseUp := PbWaterfallMouseUp;
// Initial layout
ResizeSpectrumPanels;
@@ -2616,7 +2632,8 @@ begin
if PbSpectrum is TPaintBox then
TPaintBox(PbSpectrum).Color := T.BG;
PbWaterfall.Color := T.BG;
if PbWaterfall is TPaintBox then
TPaintBox(PbWaterfall).Color := T.BG;
if PanelSMeterRight <> nil then PanelSMeterRight.Color := T.Panel;
if PbSMeterRight <> nil then PbSMeterRight.Color := T.Panel;
ApplyStatusTheme(T);
@@ -7025,8 +7042,12 @@ begin
if FPS > 100 then FPS := 100;
FDisplayFPS := FPS;
FSpectrumTimer.Interval := 1000 div FPS;
// Thetis по умолчанию обновляет водопад через один display frame.
FWaterfallFrameInterval := 2;
// CPU path keeps the historical every-other-frame waterfall update.
// OpenGL uploads only one texture row per frame, so it can match display FPS.
if FUseOpenGLSpectrum then
FWaterfallFrameInterval := 1
else
FWaterfallFrameInterval := 2;
FWaterfallFrameCounter := 0;
FWaterfallDirty := True;
FSpecView.WfFrameInterval := FWaterfallFrameInterval;