SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
scalarramplut.h File Reference
#include <QtGlobal>
#include <algorithm>
#include <cmath>
Include dependency graph for scalarramplut.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  OpenSWMM::Render::ScalarRampLut
 

Namespaces

namespace  OpenSWMM
 
namespace  OpenSWMM::Render
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

QSG-2D-1M Phase 8 — pure scalar→ramp-index math for GPU color mapping.

The shader fill path uploads raw per-vertex scalars plus a small 1-D ramp texture (LUT); the GPU normalizes the scalar and samples the LUT. This header holds the pure normalization/clamp contract shared by the CPU LUT baker and the shader (which mirrors it in GLSL):

 t = clamp((value - vMin) / (vMax - vMin), 0, 1)

Degenerate ranges (vMax <= vMin) and non-finite values clamp to 0 so a bad frame can never index out of the LUT. Unit-tested headlessly in tests/unit/test_scalarramplut.cpp; the texture itself is verified visually (shader output is not meaningfully unit-testable).