110using StencilOp = std::tuple<StencilAction, StencilAction, StencilAction>;
void bind_texture_2d(State *states, const Uniform &uniform, const Texture2d &texture)
void bind_texture_cubemap(State *states, const Uniform &uniform, const TextureCubemap &texture)
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.
@ increase
The stencil value is increased by 1 if it is lower than the maximum value.
@ keep
The currently stored stencil value is kept.
@ invert
Bitwise inverts the current stencil buffer value.
@ replace
The stencil value is replaced with the reference value set with stencil_func.
@ decrease
The stencil value is decreased by 1 if it is higher than the minimum value.
@ increase_wrap
Same as increase, but wraps it back to 0 as soon as the maximum value is exceeded.
@ decrease_wrap
Same as decrease, but wraps it to the maximum value if it ends up lower than 0.
@ Uniform
the model source is provided as a mat4 uniform.
@ one_minus_constant_color
@ one_minus_constant_alpha
constexpr std::size_t MAX_TEXTURES_SUPPORTED
A (inclusive) range between two values.
"render to texture" feature
A helper class to change both the opengl state and the cache.
StateChanger & depth_func(Compare new_state)
StateChanger & blending(bool new_state)
StateChanger & cull_face(bool new_state)
StateChanger & cull_face_mode(CullFace new_state)
StateChanger & render_mode(RenderMode new_state)
StateChanger & stencil_func(Compare func, i32 ref, u32 mask)
StateChanger & depth_mask(bool new_state)
StateChanger & activate_texture(int new_texture)
StateChanger & stencil_op(StencilAction stencil_fail, StencilAction depth_fail, StencilAction pass)
StateChanger & bind_texture_cubemap(int slot, unsigned int texture)
StateChanger & bind_texture_2d(int slot, unsigned int texture)
StateChanger & stencil_test(bool new_state)
StateChanger & stencil_mask(u32 new_state)
Set a bitmask that is ANDed with the stencil value about to be written to the buffer.
StateChanger & blend_mode(Blend src, Blend dst)
StateChanger & depth_test(bool new_state)
A "cache" for the current open gl state.
std::optional< StencilFunc > stencil_func
std::optional< bool > blending
std::optional< Compare > depth_func
std::array< std::optional< unsigned int >, MAX_TEXTURES_SUPPORTED > texture_bound
std::optional< bool > depth_test
std::optional< RenderMode > render_mode
std::optional< bool > cull_face
std::optional< bool > depth_mask
std::optional< BlendMode > blend_mode
std::optional< int > active_texture
std::optional< u32 > stencil_mask
std::optional< CullFace > cull_face_mode
std::optional< StencilOp > stencil_op
std::optional< bool > stencil_test