5#include "structure/container/spk_flags.hpp"
6#include "structure/graphics/spk_color.hpp"
7#include "structure/graphics/spk_extend_2d.hpp"
8#include "structure/math/spk_matrix.hpp"
55 inline static size_t _maxLayer = 1;
62 static spk::Matrix4x4 _computeScreenToOpenGLMatrix(
const spk::Extend2D &p_viewport,
size_t p_maxLayer);
63 static spk::Matrix4x4 _computeOpenGLToScreenMatrix(
const spk::Matrix4x4 &p_screenToOpenGLMatrix);
100 static
void setMaxLayer(
size_t p_maxLayer) noexcept;
137 static spk::Vector3
convertScreenToOpenGL(const spk::Vector2Int &p_screenPosition,
float p_layer = 0.0f) noexcept;
145 static spk::Vector2Int
convertOpenGLToScreen(const spk::Vector2 &p_openGLPosition,
float p_layer = 0.0f) noexcept;
static spk::IMatrix< SizeX, SizeY > identity()
Definition spk_matrix.hpp:139
Manages viewport and scissor rectangles and clearing.
Definition spk_view_region.hpp:26
void setScissor(const spk::Extend2D &p_extend) noexcept
Sets the GL scissor rectangle.
Definition spk_view_region.cpp:111
static void clear(const Color &p_backgroundColor, const ClearMask &p_clearMask=defaultClearMask)
Clears framebuffer with given color and mask.
Definition spk_view_region.cpp:190
const spk::Extend2D & scissor() const noexcept
Returns current scissor settings.
Definition spk_view_region.cpp:121
static spk::Vector2Int convertOpenGLToScreen(const spk::Vector2 &p_openGLPosition, float p_layer=0.0f) noexcept
Converts an OpenGL normalized position back to screen-space pixels.
Definition spk_view_region.cpp:209
static const spk::Extend2D & windowSize() noexcept
Returns the current window size.
Definition spk_view_region.cpp:141
static size_t maxLayer() noexcept
Returns the current configured maximum layer value.
Definition spk_view_region.cpp:126
const spk::Extend2D & viewport() const noexcept
Returns current viewport settings.
Definition spk_view_region.cpp:116
ClearMode
Buffer types that can be cleared.
Definition spk_view_region.hpp:32
static void setWindowSize(const spk::Extend2D &p_windowSize) noexcept
Sets the logical window size used for Y inversion (top-left -> bottom-left).
Definition spk_view_region.cpp:136
void apply() const
Applies viewport and scissor to OpenGL state.
Definition spk_view_region.cpp:151
static const spk::OpenGL::ViewRegion * activeViewRegion()
Returns the active view region used for OpenGL operations.
Definition spk_view_region.cpp:146
spk::Flags< ClearMode > ClearMask
Mask of buffers to clear at once.
Definition spk_view_region.hpp:41
static const ClearMask defaultClearMask
Default mask clearing color, depth, and stencil.
Definition spk_view_region.hpp:45
static spk::Vector3 convertScreenToOpenGL(const spk::Vector2Int &p_screenPosition, float p_layer=0.0f) noexcept
Converts a screen-space pixel position to OpenGL normalized device coordinates.
Definition spk_view_region.cpp:200
static void setMaxLayer(size_t p_maxLayer) noexcept
Sets the maximum layer value used for depth mapping.
Definition spk_view_region.cpp:131
void setViewport(const spk::Extend2D &p_extend) noexcept
Sets the GL viewport rectangle.
Definition spk_view_region.cpp:106
RGBA color utility storing normalized floating components.
Definition spk_color.hpp:18
Axis-aligned rectangle defined by an anchor point and size.
Definition spk_extend_2d.hpp:24
Type-safe bitmask wrapper for enum flags.
Definition spk_flags.hpp:111