Gamp v0.0.7-54-gccdc599
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
RenderMode.hpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com> (C++, Java) and Rami Santina (Java)
3 * Copyright Gothel Software e.K. and the authors
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * This Source Code Form is subject to the terms of the MIT License
8 * If a copy of the MIT was not distributed with this file,
9 * you can obtain one at https://opensource.org/license/mit/.
10 */
11#ifndef JAU_GAMP_GRAPH_RENDERMODE_HPP_
12#define JAU_GAMP_GRAPH_RENDERMODE_HPP_
13
14#include <cstdint>
15
16#include <jau/enum_util.hpp>
17
18namespace gamp::graph {
19
20 using namespace jau::enums;
21
22 /** \addtogroup Gamp_Graph
23 *
24 * @{
25 */
26
27 /**
28 * Render mode bits being part of the shader-selection-key.
29 * @see renderMode()
30 */
31 enum class RenderMode : uint16_t {
32 /**
33 * One pass `none` rendering either using no AA or underlying full-screen AA (fsaa) nor extra channels nor data.
34 */
35 none = 0,
36
37 /**
38 * MSAA based Anti-Aliasing, a two pass region rendering, slower and more
39 * resource hungry (FBO with sample buffer), but providing fast MSAA in case
40 * the whole scene is not rendered with MSAA.
41 *
42 * In case sample count is 1, no FBO sample buffer is used but a simple bilinear texture filter.
43 */
44 msaa = 1 << 0,
45
46 /**
47 * View based Anti-Aliasing, a two pass region rendering, slower and more
48 * resource hungry (FBO), but AA is perfect. Otherwise the default fast one
49 * pass MSAA region rendering is being used.
50 *
51 * In case sample count is 1, no FBO supersampling is performed but a simple bilinear texture filter used.
52 *
53 * Depending on AA-quality, {@link #MAX_AA_QUALITY} denotes full 4x billinear filtering per sample
54 * and {@code 0} denotes 1x flipquad filtering per sample.
55 */
56 vbaa = 1 << 1,
57
58 /** 2-pass rendering bit-mask including RenderBits::msaa and RenderBits::vbaa. */
60
61 /**
62 * Use non uniform weights [0.0 .. 1.9] for curve region rendering.
63 * Otherwise the default weight 1.0 for uniform curve region rendering is
64 * being applied.
65 */
66 varweight = 1 << 8,
67
68 /**
69 * If set, a full normal channel attribute per vertex is added to the stream.
70 */
71 normalchannel = 1 << 9,
72
73 /**
74 * If set, a color channel attribute per vertex is added to the stream,
75 * otherwise static color can being used for a monotonic color.
76 */
77 colorchannel = 1 << 10,
78
79 /**
80 * If set, a color texture is used to determine the color via TextureSequence passed to the implementation.
81 * @see TextureSequence#useARatioAdjustment()
82 * @see TextureSequence#useARatioLetterbox()
83 */
84 colortexture = 1 << 11,
85
86 /// Enable light0, implies normalchannel
87 light0 = 1 << 12
88 };
90
91 /** Returns true if given {@code renderModes} has RenderMode::vbaa set. */
92 constexpr inline bool isVBAA(RenderMode renderMode) noexcept { return is_set(renderMode, RenderMode::vbaa); }
93
94 /** Returns true if given {@code renderModes} has RenderMode::msaa set. */
95 constexpr inline bool isMSAA(RenderMode renderMode) noexcept { return is_set(renderMode, RenderMode::msaa); }
96
97 /** Returns true if given {@code renderModes} has any of RenderMode::aa_mask set. */
98 constexpr inline bool isGraphAA(RenderMode renderMode) noexcept { return has_any(renderMode, RenderMode::aa_mask); }
99
100 /** Returns true if given {@code renderModes} has any of RenderMode::aa_mask set. */
101 constexpr inline bool isTwoPass(RenderMode renderMode) noexcept { return isGraphAA(renderMode); }
102
103 constexpr inline bool hasVariableWeight(RenderMode renderMode) noexcept { return is_set(renderMode, RenderMode::varweight); }
104
105 constexpr inline bool hasNormalChannel(RenderMode m) noexcept { return is_set(m, RenderMode::light0) || is_set(m, RenderMode::normalchannel); }
106 constexpr inline bool hasColorChannel(RenderMode m) noexcept { return is_set(m, RenderMode::colorchannel); }
107
108 /**
109 * Returns true if render mode has a color texture,
110 * i.e. the bit {@link #COLORTEXTURE_RENDERING_BIT} is set,
111 * otherwise false.
112 */
113 constexpr inline bool hasColorTexture(RenderMode renderMode) noexcept { return is_set(renderMode, RenderMode::colortexture); }
114
115 constexpr inline bool hasLight0(RenderMode m) noexcept { return is_set(m, RenderMode::light0); }
116
117 /**@}*/
118
119} // namespace gamp::graph
120
121#endif // JAU_GAMP_GRAPH_RENDERMODE_HPP_
122
constexpr bool has_any(const E mask, const E bits) noexcept
#define JAU_MAKE_BITFIELD_ENUM_STRING(type,...)
constexpr bool is_set(const E mask, const E bits) noexcept
constexpr bool hasLight0(RenderMode m) noexcept
constexpr bool hasNormalChannel(RenderMode m) noexcept
RenderMode
Render mode bits being part of the shader-selection-key.
constexpr bool isGraphAA(RenderMode renderMode) noexcept
Returns true if given renderModes has any of RenderMode::aa_mask set.
constexpr bool isMSAA(RenderMode renderMode) noexcept
Returns true if given renderModes has RenderMode::msaa set.
constexpr bool isTwoPass(RenderMode renderMode) noexcept
Returns true if given renderModes has any of RenderMode::aa_mask set.
constexpr bool hasColorChannel(RenderMode m) noexcept
constexpr bool isVBAA(RenderMode renderMode) noexcept
Returns true if given renderModes has RenderMode::vbaa set.
constexpr bool hasVariableWeight(RenderMode renderMode) noexcept
constexpr bool hasColorTexture(RenderMode renderMode) noexcept
Returns true if render mode has a color texture, i.e.
@ light0
Enable light0, implies normalchannel.
@ varweight
Use non uniform weights [0.0 .
@ aa_mask
2-pass rendering bit-mask including RenderBits::msaa and RenderBits::vbaa.
@ msaa
MSAA based Anti-Aliasing, a two pass region rendering, slower and more resource hungry (FBO with samp...
@ vbaa
View based Anti-Aliasing, a two pass region rendering, slower and more resource hungry (FBO),...
@ normalchannel
If set, a full normal channel attribute per vertex is added to the stream.
@ colorchannel
If set, a color channel attribute per vertex is added to the stream, otherwise static color can being...
@ colortexture
If set, a color texture is used to determine the color via TextureSequence passed to the implementati...