Cumulia Illustrator Rendering Engine v2.1.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
state.h
1//##################################################################################################
2//
3// Copyright (c) 2024 Beijing Qiongqi Tech Co.,Ltd. All rights reserved.
4
5// This source code is confidential and proprietary to Beijing Qiongqi Tech Co.,Ltd(The Holder).
6// Any unauthorized use, copying, modification, or distribution of the code is strictly prohibited.
7// Any user shall obtain authorizaition from the Holder before modifying the source code. And the user shall not
8// sublicense, sell, distribute, or transfer the source code, whether in original or modified form, to any third party
9// without the prior written consent of the Holder.
10
11// This copyright notice and permission grant shall be included in all copies or substantial portions of the source code.
12
13// Author Cumulia Illustrator
14// Date 2025-08-05
15// Version V2.1.0
16//##################################################################################################
17
18#pragma once
19
20#include "../object/object.h"
21#include "../variant/types.h"
22#include "types.h"
23#include "sampler.h"
24
25#include <string>
26
27namespace cil
28{
30 class State : public Object
31 {
32 protected:
33 std::string m_className;
34
35 public:
37
38 const std::string& className() const;
39 };
40
85
87 class ColorMask : public State
88 {
89 public:
90 bool red;
91 bool green;
92 bool blue;
93 bool alpha;
94
95 ColorMask(bool red = true,
96 bool green = true,
97 bool blue = true,
98 bool alpha = true);
99 };
100
102 class Culling : public State
103 {
104 public:
106 enum class Mode
107 {
108 BACK,
109 FRONT,
111 };
113 enum class Face
114 {
115 CCW,
116 CW
117 };
118
122
123 Culling(bool enabled = false,
126 };
127
129 class Depth : public State
130 {
131 public:
134 enum class Function
135 {
136 NEVER,
137 LESS,
138 LEQUAL,
139 EQUAL,
140 NOTEQUAL,
141 GEQUAL,
142 GREATER,
143 ALWAYS
144 };
145
146 bool enabled;
149
150 Depth(bool enabled = false,
152 bool writeMask = true);
153 };
154
156 class Line : public State
157 {
158 public:
159 float width;
160
161 Line(float width = 1.0f);
162 };
163
165 class Point : public State
166 {
167 public:
168 float size;
170
171 Point(float size = 1.0f,
172 bool programmable = false);
173 };
174
176 class Polygon : public State
177 {
178 public:
179 enum class Mode
180 {
181 POINT,
182 LINE,
183 FILL
184 };
185
187
189 };
190
192 class PolygonOffset : public State
193 {
194 public:
196 float factor;
197 float units;
198
199 PolygonOffset(bool enabled = false,
200 float factor = 0.0f,
201 float units = 0.0f);
202 };
203
205 class Scissor : public State
206 {
207 public:
209 int x;
210 int y;
211 int width;
213
214 Scissor(bool enabled = false,
215 int x = 0,
216 int y = 0,
217 int width = 0,
218 int height = 0);
219 };
220
222 class Stencil : public State
223 {
224 public:
225
228 enum class Function
229 {
230 NEVER,
231 LESS,
232 LEQUAL,
233 EQUAL,
234 NOTEQUAL,
235 GEQUAL,
236 GREATER,
237 ALWAYS
238 };
239
241 enum class Operation
242 {
243 KEEP,
244 ZERO,
245 REPLACE,
246 INCR,
247 DECR,
248 INVERT,
249 INCR_WRAP,
251 };
252
254
258
260 int ref;
261 int mask;
262
263 Stencil(bool enabled = false,
268 int ref = 0,
269 int mask = 0xFF);
270 };
271
273 class Texture : public State
274 {
275 public:
276 int unit;
279
281 const ImagePtr& image,
282 const SamplerPtr& sampler);
283 };
284}
The Blend class inherits from the State class, describing the blending operation during rendering tra...
Definition state.h:43
Function dstFunc
Definition state.h:77
Function srcFunc
Definition state.h:76
bool enabled
This member allows you to enable/diable blending.
Definition state.h:75
Function
The factors in this enumeration specify how the source and destination color values are combined duri...
Definition state.h:47
Equation
This enumeration defines different operations used in the blend equation. These operations determine ...
Definition state.h:67
Blend(bool enabled=false, Blend::Function srcFunc=Blend::Function::SRC_ALPHA, Blend::Function dstFunc=Blend::Function::ONE_MINUS_SRC_ALPHA, Blend::Equation equation=Blend::Equation::FUNC_ADD)
Equation equation
Definition state.h:78
The ColorMask class represents the color channel writing during rendering.
Definition state.h:88
bool green
Similar to red.
Definition state.h:91
bool alpha
Similar to red.
Definition state.h:93
bool red
This flag determines whether the red color channel is written to the framebuffer.
Definition state.h:90
ColorMask(bool red=true, bool green=true, bool blue=true, bool alpha=true)
bool blue
Similar to red.
Definition state.h:92
The Culling class inherits from the base class State, describing the culling operation during renderi...
Definition state.h:103
Mode
The enumeration defines the type of the face we want to cull.
Definition state.h:107
Mode mode
Definition state.h:121
Face face
Definition state.h:120
Culling(bool enabled=false, Culling::Face face=Culling::Face::CCW, Culling::Mode mode=Culling::Mode::BACK)
Face
The enumeration defines the ordering (counter-clockwise and clockwise) of the front-faces or the back...
Definition state.h:114
bool enabled
Definition state.h:119
The Depth class inherits from the base class State, describing how the depth test is operated during ...
Definition state.h:130
Depth(bool enabled=false, Depth::Function func=Depth::Function::LESS, bool writeMask=true)
Function
This enumeration defines different comparison operators used for the depth test.
Definition state.h:135
Function func
Definition state.h:147
bool writeMask
Definition state.h:148
bool enabled
This member allows you to enable/diable depth test.
Definition state.h:146
The Line class inherits from the base class State, defining width of Line.
Definition state.h:157
float width
Definition state.h:159
Line(float width=1.0f)
Definition object.h:23
The Point class inherits from the base class State, defining size and other properties of Point.
Definition state.h:166
bool programmable
Definition state.h:169
Point(float size=1.0f, bool programmable=false)
float size
Definition state.h:168
The PolygonOffset class inherits from the base class State, defining the polygon offset.
Definition state.h:193
PolygonOffset(bool enabled=false, float factor=0.0f, float units=0.0f)
float units
Definition state.h:197
bool enabled
Definition state.h:195
float factor
Definition state.h:196
The Polygon class inherits from the base class State, defining mode of Polygon.
Definition state.h:177
Polygon(Mode mode=Polygon::Mode::FILL)
Mode
Definition state.h:180
Mode mode
Definition state.h:186
The Scissor class inherits from the base class State, defining a scissor test that discards fragments...
Definition state.h:206
Scissor(bool enabled=false, int x=0, int y=0, int width=0, int height=0)
int height
Definition state.h:212
int y
Definition state.h:210
bool enabled
Definition state.h:208
int x
Definition state.h:209
int width
Definition state.h:211
The State class is a basic class representing the rendering state setting.
Definition state.h:31
std::string m_className
Definition state.h:33
const std::string & className() const
The Stencil class inherits from the base class State, describing how the stencil test is operated dur...
Definition state.h:223
Operation dpfail
Action to take if the stencil test passes, but the depth test fails.
Definition state.h:256
Operation dppass
Action to take if both the stencil and the depth test pass.
Definition state.h:257
bool enabled
Definition state.h:253
Operation sfail
Action to take if the stencil test fails.
Definition state.h:255
Function func
Definition state.h:259
int mask
Definition state.h:261
Function
This enumeration defines different comparison operators used for the stencil test.
Definition state.h:229
Stencil(bool enabled=false, Stencil::Operation sfail=Stencil::Operation::KEEP, Stencil::Operation dpfail=Stencil::Operation::KEEP, Stencil::Operation dppass=Stencil::Operation::KEEP, Stencil::Function func=Stencil::Function::ALWAYS, int ref=0, int mask=0xFF)
int ref
This member specifies the reference value for the stencil test.
Definition state.h:260
Operation
This enumeration defines how to update the stencil buffer after the stencil test.
Definition state.h:242
The Texture class defines the texture image and sampling behaviour when you need to map a texture to ...
Definition state.h:274
int unit
Definition state.h:276
Texture(int unit, const ImagePtr &image, const SamplerPtr &sampler)
SamplerPtr sampler
Definition state.h:278
ImagePtr image
Definition state.h:277
Definition decal.h:23
std::shared_ptr< Image > ImagePtr
Definition types.h:53
std::shared_ptr< Sampler > SamplerPtr
Definition types.h:60