Euphoria
opengl_states.h
Go to the documentation of this file.
1#pragma once
2
3#include "render/blend.h"
4#include "render/compare.h"
5#include "render/constants.h"
6#include "render/cullface.h"
7#include "render/rendermode.h"
9
10#include <optional>
11#include <array>
12
13namespace eu::render
14{
15
21using BlendMode = std::tuple<Blend, Blend>;
22
25using StencilFunc = std::tuple<Compare, i32, u32>;
26
28using StencilOp = std::tuple<StencilAction, StencilAction, StencilAction>;
29
32{
33 std::optional<bool> cull_face;
34 std::optional<CullFace> cull_face_mode;
35
36 std::optional<bool> blending;
37 std::optional<BlendMode> blend_mode;
38
39 std::optional<bool> depth_test;
40 std::optional<bool> depth_mask;
41 std::optional<Compare> depth_func;
42
43 std::optional<bool> stencil_test;
44 std::optional<u32> stencil_mask;
45
46 std::optional<RenderMode> render_mode;
47 std::optional<StencilFunc> stencil_func;
48 std::optional<StencilOp> stencil_op;
49
50 std::optional<int> active_texture;
51 std::array<std::optional<unsigned int>, MAX_TEXTURES_SUPPORTED> texture_bound;
52};
53
58} // namespace klotter
std::tuple< StencilAction, StencilAction, StencilAction > StencilOp
Stencil operation state consisting of the stencil fail, depth fail and the pass action.
std::tuple< Compare, i32, u32 > StencilFunc
Stencil function state consisiting of the compare function, the ref and the state.
std::tuple< Blend, Blend > BlendMode
Blend mode state consisting of src and dst blend functions.
constexpr std::size_t MAX_TEXTURES_SUPPORTED
Definition constants.h:7
A "cache" for the current open gl state.
std::optional< CullFace > cull_face_mode
std::array< std::optional< unsigned int >, MAX_TEXTURES_SUPPORTED > texture_bound
std::optional< BlendMode > blend_mode
std::optional< bool > depth_test
std::optional< bool > depth_mask
std::optional< StencilOp > stencil_op
std::optional< int > active_texture
std::optional< StencilFunc > stencil_func
std::optional< bool > blending
std::optional< Compare > depth_func
std::optional< RenderMode > render_mode
std::optional< bool > stencil_test
std::optional< u32 > stencil_mask
std::optional< bool > cull_face