Files
qbz/crates/qbz-qt/cxx/tunnelflow_item.h
T
vicrodh e6c058c2f2 feat(qt): immersive shader scenes — RHI items, scene menu, GL link pairing
Port the immersive GPU scenes: Plasma, Tunnel, Aurora, Ambient, Spectral
Ribbon and Line Bed as QQuickRhiItems/ShaderEffects under a pulse-driven
ShaderSceneLayer, plus the Qt-only Tunnel Flow (Tauri Canvas2D port) fed
by the Viz16 stream. Scene rows live in the header view menu (no Off row);
g cycles the ring. A fresh immersive open defaults to Split > Lyrics
(owner ruling).

OpenGL link fix (owner smoke: Tunnel black with "uniform _22 declared as
type buf and type buf"): every ShaderEffect fragment with its own uniform
layout now ships a paired vertex stage declaring the identical block —
the shared spectrum.vert only ever linked under Vulkan.

RHI hardening: render pass descriptors on the ping-pong targets (the
Tunnel Flow segfault / Plasma dead window), mirrorVertically tied to the
backend (!== OpenGL), ribbon sub-uploads carry setSourceSize.

km
2026-08-16 08:22:57 -06:00

56 lines
2.1 KiB
C++

// Tunnel Flow (immersive shader scene, mode 8 — Qt-only) — the
// QQuickRhiItem behind the feedback tunnel. Block B1 of the 2026-08-15
// immersive-completion contract (spec 02-tauri-tunnel-port.md): a rewrite of
// the legacy Tauri Canvas2D panel (TunnelFlowPanel.svelte) as
// qml/assets/shaders/tunnel_flow.frag. Same mechanism as PlasmaItem
// (cxx/plasma_item.h): a feedback ping-pong over two owned RGBA8 textures a
// ShaderEffect cannot own.
//
// QML properties are MEMBER-only (no NOTIFY): the QML wrapper
// (TunnelFlowScene.qml) computes the audio state (Viz16 smoothing, kick
// detector, the TAURI phase accumulator) and writes these on the pulse edge
// via pulseTick() — the same cadence contract as PlasmaItem/LineBedItem.
//
// Registered as QML type `TunnelFlowItem` in `com.blitzfc.qbz` 1.0 (see the
// .cpp).
#pragma once
#include <QtGui/QColor>
#include <QtQuick/QQuickRhiItem>
class TunnelFlowItem : public QQuickRhiItem
{
Q_OBJECT
Q_PROPERTY(float time MEMBER m_time)
Q_PROPERTY(float phase MEMBER m_phase)
Q_PROPERTY(float bass MEMBER m_bass)
Q_PROPERTY(float mid MEMBER m_mid)
Q_PROPERTY(float high MEMBER m_high)
Q_PROPERTY(float kick MEMBER m_kick)
Q_PROPERTY(QColor palette0 MEMBER m_palette0)
Q_PROPERTY(QColor palette1 MEMBER m_palette1)
Q_PROPERTY(QColor palette2 MEMBER m_palette2)
Q_PROPERTY(QColor palette3 MEMBER m_palette3)
public:
explicit TunnelFlowItem(QQuickItem *parent = nullptr) : QQuickRhiItem(parent) {}
QQuickRhiItemRenderer *createRenderer() override;
// Member snapshots the renderer reads in synchronize(). The palette
// defaults are the Tauri fallback (TunnelFlowPanel.svelte:63-68) so a
// pre-art track still looks right; time is SECONDS here (the shader
// converts to the source's ms domain).
float m_time = 0.0f;
float m_phase = 0.0f;
float m_bass = 0.0f;
float m_mid = 0.0f;
float m_high = 0.0f;
float m_kick = 0.0f;
QColor m_palette0{ 255, 106, 106 };
QColor m_palette1{ 255, 205, 92 };
QColor m_palette2{ 104, 220, 170 };
QColor m_palette3{ 110, 176, 255 };
};