Loading...
Searching...
No Matches
WindowSettings.hpp
1#pragma once
2#include <QPointF>
3#include <QRectF>
4#include <QSize>
5#include <QString>
6
7namespace Gfx
8{
9
11{
12 int width{};
13 int height{};
14 double rate{};
15 bool viewportSize{};
16 bool vsync{};
17};
18
19enum class WindowMode : int
20{
21 Single = 0,
22 Background = 1,
23 MultiWindow = 2
24};
25
26enum class SwapchainFlag : int
27{
28 NoFlag = 0,
29 sRGB = (1 << 2)
30};
31
32// Matches QRhiSwapchainFormat
33enum class SwapchainFormat : int
34{
35 SDR,
36 HDRExtendedSrgbLinear,
37 HDR10,
38 HDRExtendedDisplayP3Linear
39};
40
41
43{
44 float width{0.0f}; // Blend width in UV space (0.0 = no blend, 0.15 = 15% of output)
45 float gamma{2.2f}; // Blend curve exponent (1.0 = linear, 2.2 = typical projector)
46};
47
49{
50 QPointF topLeft{0.0, 0.0};
51 QPointF topRight{1.0, 0.0};
52 QPointF bottomLeft{0.0, 1.0};
53 QPointF bottomRight{1.0, 1.0};
54
55 bool isIdentity() const noexcept
56 {
57 constexpr double eps = 1e-6;
58 return qAbs(topLeft.x()) < eps && qAbs(topLeft.y()) < eps
59 && qAbs(topRight.x() - 1.0) < eps && qAbs(topRight.y()) < eps
60 && qAbs(bottomLeft.x()) < eps && qAbs(bottomLeft.y() - 1.0) < eps
61 && qAbs(bottomRight.x() - 1.0) < eps && qAbs(bottomRight.y() - 1.0) < eps;
62 }
63};
64
65enum class OutputLockMode : int
66{
67 Free = 0, // No constraints
68 AspectRatio = 1, // Output window preserves input section aspect ratio
69 OneToOne = 2, // Output window size = input source rect pixels (1:1)
70 FullLock = 3 // Cannot move or resize in graphics scenes
71};
72
74static const constexpr QPoint defaultWindowPosition{100, 100};
75
84inline QPoint windowPositionForSource(QPoint p) noexcept
85{
86 return p.isNull() ? defaultWindowPosition : p;
87}
88
90{
91 QRectF sourceRect{0.0, 0.0, 1.0, 1.0}; // UV coords in input texture
92 int screenIndex{-1}; // -1 = default screen
96 QPoint windowPosition{defaultWindowPosition};
97 QSize windowSize{1280, 720};
98 bool fullscreen{false};
99
100 // Soft-edge blending per side
101 EdgeBlend blendLeft;
102 EdgeBlend blendRight;
103 EdgeBlend blendTop;
104 EdgeBlend blendBottom;
105
106 // 4-corner perspective warp (output UV space)
107 CornerWarp cornerWarp;
108
109 OutputLockMode lockMode{OutputLockMode::Free};
110
111 int rotation{0}; // 0, 90, 180, 270 degrees clockwise
112 bool mirrorX{false}; // Flip output horizontally (after rotation)
113 bool mirrorY{false}; // Flip output vertically (after rotation)
114};
115
116}
Binds the rendering pipeline to ossia processes.
Definition AssetTable.cpp:7
QPoint windowPositionForSource(QPoint p) noexcept
Where to put the window of an output whose source starts at p.
Definition WindowSettings.hpp:84
Definition WindowSettings.hpp:49
Definition WindowSettings.hpp:43
Definition WindowSettings.hpp:90
QPoint windowPosition
Definition WindowSettings.hpp:96
Definition WindowSettings.hpp:11