FPLBase
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
render_state.h
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef FPLBASE_RENDER_STATE_H
16 #define FPLBASE_RENDER_STATE_H
17 
18 #include "fplbase/internal/detailed_render_state.h"
19 #include "fplbase/renderer_common.h"
20 
21 namespace fplbase {
22 
23 /// @brief Specifies the type for the Stencil Mask.
24 typedef uint32_t StencilMask;
25 
26 /// @brief Specifies stencil modes for the stencil test.
28  kStencilDisabled, /**< No stencil test. */
29  kStencilCompareEqual, /**< Compare the that reference written reference and
30  given reference are equal, if they are, write to the
31  pixel buffer. */
32  kStencilWrite, /**< Always pass the test and write to the pixel and stencil
33  buffers. */
34  kStencilUnknown, /**< An unknown mode, usually happens when accessing the
35  graphics API directly. */
36  kStencilModeCount
37 };
38 
39 /// @brief Specifies the blending mode used by the blend function.
40 enum BlendMode {
41  kBlendModeOff = 0, /**< No blending is done. The alpha channel is ignored. */
42  kBlendModeTest, /**< Used to provide a function via `glAlphaFunc` instead of
43  `glBlendFunc`.*/
44  kBlendModeAlpha, /**< Normal alpha channel blending. */
45  kBlendModeAdd, /**< Additive blending, where the resulting color is the sum of
46  the two colors. */
47  kBlendModeAddAlpha, /**< Additive blending, where the resulting color is the
48  sum of the two colors, and the image is affected
49  by the alpha. (Note: The background is not affected
50  by the image's alpha.) */
51  kBlendModeMultiply, /**< Multiplicative blending, where the resulting color is
52  the product of the image color and the background
53  color. */
54  kBlendModePreMultipliedAlpha, /**< Like Alpha, except the source RGB values
55  are assumed to have already been multiplied
56  by the alpha, so the blend function doesn't
57  touch them. */
58  kBlendModeUnknown, /**< An unknown mode, usually happens when accessing the
59  graphics API directly. */
60  kBlendModeCount /** Used at the end of the enum as sentinel value. */
61 };
62 
63 /// @brief Specifies the depth function used for rendering.
65  kDepthFunctionDisabled,
66  kDepthFunctionNever,
67  kDepthFunctionAlways,
68  kDepthFunctionLess,
69  kDepthFunctionLessEqual,
70  kDepthFunctionGreater,
71  kDepthFunctionGreaterEqual,
72  kDepthFunctionEqual,
73  kDepthFunctionNotEqual,
74  kDepthFunctionUnknown, /**< An unknown mode, usually happens when accessing
75  the graphics API directly. */
76  kDepthFunctionCount
77 };
78 
79 /// @brief Specifies the which face is culled when rendering.
81  kCullingModeNone,
82  kCullingModeFront,
83  kCullingModeBack,
84  kCullingModeFrontAndBack,
85  kCullingModeUnknown /**< An unknown mode, usually happens when accessing the
86  graphics API directly. */
87 };
88 
89 } // namespace fplbase
90 
91 #endif // FPLBASE_RENDER_STATE_H
Definition: render_state.h:41
Definition: render_state.h:42
Definition: render_state.h:47
BlendMode
Specifies the blending mode used by the blend function.
Definition: render_state.h:40
CullingMode
Specifies the which face is culled when rendering.
Definition: render_state.h:80
StencilMode
Specifies stencil modes for the stencil test.
Definition: render_state.h:27
uint32_t StencilMask
Specifies the type for the Stencil Mask.
Definition: render_state.h:24
Definition: render_state.h:85
Definition: render_state.h:54
Definition: render_state.h:58
DepthFunction
Specifies the depth function used for rendering.
Definition: render_state.h:64
Definition: render_state.h:51
Definition: render_state.h:45
Definition: render_state.h:44
Definition: render_state.h:74
Definition: render_state.h:34
Definition: render_state.h:32
Definition: render_state.h:60
Definition: render_state.h:28
Definition: render_state.h:29