• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
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 
16 #ifndef API_3D_RENDER_RENDER_DATA_DEFINES_H
17 #define API_3D_RENDER_RENDER_DATA_DEFINES_H
18 
19 #include <cstdint>
20 
21 #include <3d/ecs/components/mesh_component.h>
22 #include <3d/render/default_material_constants.h>
23 #include <base/containers/fixed_string.h>
24 #include <base/math/matrix.h>
25 #include <base/math/quaternion.h>
26 #include <base/math/vector.h>
27 #include <core/namespace.h>
28 #include <render/render_data_structures.h>
29 
CORE3D_BEGIN_NAMESPACE()30 CORE3D_BEGIN_NAMESPACE()
31 /** \addtogroup group_render_renderdatadefines
32  *  @{
33  */
34 /** Render data constants */
35 namespace RenderSceneDataConstants {
36 /** Max morph target count */
37 static constexpr uint32_t MAX_MORPH_TARGET_COUNT { 64u };
38 
39 /** Mesh indices in index */
40 static constexpr uint32_t MESH_INDEX_INDEX { 5u };
41 /** Mesh weights in index */
42 static constexpr uint32_t MESH_WEIGHT_INDEX { 6u };
43 
44 /** Max vec3 count for 3 bands */
45 static constexpr uint32_t MAX_SH_VEC3_COUNT { 9u };
46 
47 /** Max camera target buffer count */
48 static constexpr uint32_t MAX_CAMERA_COLOR_TARGET_COUNT { 8u };
49 
50 /** Max custom push constant data size */
51 static constexpr uint32_t MAX_CUSTOM_PUSH_CONSTANT_DATA_SIZE {
52     RENDER_NS::PipelineLayoutConstants::MAX_PUSH_CONSTANT_BYTE_SIZE
53 };
54 
55 /** Max default material env custom resources */
56 static constexpr uint32_t MAX_ENV_CUSTOM_RESOURCE_COUNT { 4u };
57 
58 /** Additional custom data size which is bind with render mesh structure to shader
59  * Should match api/shaders/common/3d_dm_structures_common.h DefaultMaterialSingleMeshStruct userData
60  */
61 static constexpr uint32_t MESH_CUSTOM_DATA_VEC4_COUNT { 2u };
62 
63 /** Invalid index with default material indices */
64 static constexpr uint32_t INVALID_INDEX { ~0u };
65 
66 /** Invalid 64 bit id */
67 static constexpr uint64_t INVALID_ID { 0xFFFFFFFFffffffff };
68 
69 /** Default render sort layer id */
70 static constexpr uint8_t DEFAULT_RENDER_SORT_LAYER_ID { 32u };
71 
72 /** Default layer mask */
73 static constexpr uint64_t DEFAULT_LAYER_MASK { 0x1 };
74 } // namespace RenderSceneDataConstants
75 
76 /** Render draw command */
77 struct RenderDrawCommand {
78     /** Vertex count */
79     uint32_t vertexCount { 0 };
80     /** Index count */
81     uint32_t indexCount { 0 };
82     /** Instance count */
83     uint32_t instanceCount { 1 };
84 };
85 
86 /** Render vertex buffer */
87 struct RenderVertexBuffer {
88     /** Buffer handle */
89     RENDER_NS::RenderHandleReference bufferHandle {};
90     /** Buffer offset */
91     uint32_t bufferOffset { 0 };
92     /** Byte size */
93     uint32_t byteSize { RENDER_NS::PipelineStateConstants::GPU_BUFFER_WHOLE_SIZE };
94 };
95 
96 /** Render index buffer */
97 struct RenderIndexBuffer {
98     /** Buffer handle */
99     RENDER_NS::RenderHandleReference bufferHandle {};
100     /** Buffer offset */
101     uint32_t bufferOffset { 0 };
102     /** Byte size */
103     uint32_t byteSize { 0 };
104     /** Index type */
105     RENDER_NS::IndexType indexType { RENDER_NS::IndexType::CORE_INDEX_TYPE_MAX_ENUM };
106 };
107 
108 /** Convert RenderVertexBuffer to Renderer VertexBuffer */
ConvertVertexBuffer(const RenderVertexBuffer & rvb)109 inline RENDER_NS::VertexBuffer ConvertVertexBuffer(const RenderVertexBuffer& rvb)
110 {
111     return RENDER_NS::VertexBuffer { rvb.bufferHandle.GetHandle(), rvb.bufferOffset, rvb.byteSize };
112 }
113 
114 /** Convert RenderIndexBuffer to Renderer IndexBuffer */
ConvertIndexBuffer(const RenderIndexBuffer & rib)115 inline RENDER_NS::IndexBuffer ConvertIndexBuffer(const RenderIndexBuffer& rib)
116 {
117     return RENDER_NS::IndexBuffer { rib.bufferHandle.GetHandle(), rib.bufferOffset, rib.byteSize, rib.indexType };
118 }
119 
120 /** Render mesh data
121  * In default material pipeline created by:
122  * RenderMeshComponent creates RenderMeshData for every mesh.
123  */
124 struct RenderMeshData {
125     /** Regular world matrix. */
126     BASE_NS::Math::Mat4X4 world;
127     /** Normal world matrix. */
128     BASE_NS::Math::Mat4X4 normalWorld;
129     /** Regular previous frame world matrix. */
130     BASE_NS::Math::Mat4X4 prevWorld;
131 
132     /** 64 bit id for render instance. Can be used for rendering time identification. RenderMeshComponent entity. */
133     uint64_t id { RenderSceneDataConstants::INVALID_ID };
134     /** 64 bit id for mesh instance. MeshComponent entity. */
135     uint64_t meshId { RenderSceneDataConstants::INVALID_ID };
136 
137     /** layer mask. */
138     uint64_t layerMask { 1 };
139     /** Unused offset. */
140     uint64_t additional { 0 };
141 
142     /** Custom data. */
143     BASE_NS::Math::UVec4 customData[RenderSceneDataConstants::MESH_CUSTOM_DATA_VEC4_COUNT] {};
144 };
145 
146 /** The rendering material specialization flag bits
147  */
148 enum RenderMaterialFlagBits : uint32_t {
149     /** Defines whether this material receives shadow */
150     RENDER_MATERIAL_SHADOW_RECEIVER_BIT = (1 << 0),
151     /** Defines whether this material is a shadow caster */
152     RENDER_MATERIAL_SHADOW_CASTER_BIT = (1 << 1),
153     /** Defines whether this material has a normal map enabled */
154     RENDER_MATERIAL_NORMAL_MAP_BIT = (1 << 2),
155     /** Defines whether this material as one or many texture transforms */
156     RENDER_MATERIAL_TEXTURE_TRANSFORM_BIT = (1 << 3),
157     /** Defines whether to use clear-coat parameters to simulate multi-layer material */
158     RENDER_MATERIAL_CLEAR_COAT_BIT = (1 << 4),
159     /** Defines whether to use transmission parameters to simulate optically transparent materials. */
160     RENDER_MATERIAL_TRANSMISSION_BIT = (1 << 5),
161     /** Defines whether to use sheen parameters to simulate e.g. cloth and fabric materials. */
162     RENDER_MATERIAL_SHEEN_BIT = (1 << 6),
163     /** Defines and additional shader discard bit. e.g. alpha mask discard */
164     RENDER_MATERIAL_SHADER_DISCARD_BIT = (1 << 7),
165     /** Defines if object is opaque and alpha is ignored */
166     RENDER_MATERIAL_OPAQUE_BIT = (1 << 8),
167     /** Defines whether to use specular color and strength parameters. */
168     RENDER_MATERIAL_SPECULAR_BIT = (1 << 9),
169     /** Defines whether this material will receive light from punctual lights (points, spots, directional) */
170     RENDER_MATERIAL_PUNCTUAL_LIGHT_RECEIVER_BIT = (1 << 10),
171     /** Defines whether this material will receive indirect light from SH and cubemaps */
172     RENDER_MATERIAL_INDIRECT_LIGHT_RECEIVER_BIT = (1 << 11),
173     /** Defines if this material is "basic" in default material pipeline */
174     RENDER_MATERIAL_BASIC_BIT = (1 << 12),
175     /** Defines if this material is "complex" in default material pipeline */
176     RENDER_MATERIAL_COMPLEX_BIT = (1 << 13),
177 };
178 /** Container for material flag bits */
179 using RenderMaterialFlags = uint32_t;
180 
181 /** Render material type enumeration */
182 enum class RenderMaterialType : uint8_t {
183     /** Enumeration for Metallic roughness workflow */
184     METALLIC_ROUGHNESS = 0,
185     /** Enumumeration for Specular glossiness workflow */
186     SPECULAR_GLOSSINESS = 1,
187     /** Enumumeration for KHR materials unlit workflow */
188     UNLIT = 2,
189     /** Enumumeration for special unlit shadow receiver */
190     UNLIT_SHADOW_ALPHA = 3,
191     /** Custom material. Could be used with custom material model e.g. with shader graph.
192      * Disables automatic factor based modifications for flags.
193      * Note: that base color is always automatically pre-multiplied in all cases
194      */
195     CUSTOM = 4,
196     /** Custom complex material. Could be used with custom material model e.g. with shader graph.
197      * Disables automatic factor based modifications for flags.
198      * Does not use deferred rendering path in any case due to complex material model.
199      * Note: that base color is always automatically pre-multiplied in all cases
200      */
201     CUSTOM_COMPLEX = 5,
202 };
203 
204 /** The rendering submesh specialization flag bits
205  */
206 enum RenderSubmeshFlagBits : uint32_t {
207     /** Defines whether to use tangents with this submesh. */
208     RENDER_SUBMESH_TANGENTS_BIT = (1 << 0),
209     /** Defines whether to use vertex colors with this submesh. */
210     RENDER_SUBMESH_VERTEX_COLORS_BIT = (1 << 1),
211     /** Defines whether to use skinning with this submesh. */
212     RENDER_SUBMESH_SKIN_BIT = (1 << 2),
213     /** Defines whether the submesh has second texcoord set available. */
214     RENDER_SUBMESH_SECOND_TEXCOORD_BIT = (1 << 3),
215     /** Defines whether to use inverse winding with this submesh. */
216     RENDER_SUBMESH_INVERSE_WINDING_BIT = (1 << 4),
217     /** Defines whether to calculate correct velocity in shader. */
218     RENDER_SUBMESH_VELOCITY_BIT = (1 << 5),
219 };
220 /** Container for submesh flag bits */
221 using RenderSubmeshFlags = uint32_t;
222 
223 /** Rendering flags (specialized rendering flags) */
224 enum RenderExtraRenderingFlagBits : uint32_t {
225     /** Is an additional flag which can be used to discard some materials from rendering from render node graph */
226     RENDER_EXTRA_RENDERING_DISCARD_BIT = (1 << 0),
227 };
228 /** Container for extra material rendering flag bits */
229 using RenderExtraRenderingFlags = uint32_t;
230 
231 /** Render submesh */
232 struct RenderSubmesh {
233     /** 64 bit id for render instance. Can be used for rendering time identification. RenderMeshComponent entity. */
234     uint64_t id { RenderSceneDataConstants::INVALID_ID };
235     /** 64 bit id for mesh instance. MeshComponent entity. */
236     uint64_t meshId { RenderSceneDataConstants::INVALID_ID };
237     /** Submesh index. */
238     uint32_t subMeshIndex { 0 };
239 
240     /** Layer mask. */
241     uint64_t layerMask { RenderSceneDataConstants::DEFAULT_LAYER_MASK };
242 
243     /** Render sort layer id. Valid values are 0 - 63 */
244     uint8_t renderSortLayer { RenderSceneDataConstants::DEFAULT_RENDER_SORT_LAYER_ID };
245     /** Render sort layer id. Valid values are 0 - 255 */
246     uint8_t renderSortLayerOrder { 0 };
247 
248     /** A valid index to material. Get from AddMaterial() */
249     uint32_t materialIndex { RenderSceneDataConstants::INVALID_INDEX };
250     /** A valid index to mesh (matrix). Get from AddMeshData() */
251     uint32_t meshIndex { RenderSceneDataConstants::INVALID_INDEX };
252     /** A valid index to skin joint matrices if has skin. Get from AddSkinJointMatrices() */
253     uint32_t skinJointIndex { RenderSceneDataConstants::INVALID_INDEX };
254     /** A valid index to material custom resources if any. Get from AddMaterialCustomResources() */
255     uint32_t customResourcesIndex { RenderSceneDataConstants::INVALID_INDEX };
256 
257     /** World center vector */
258     BASE_NS::Math::Vec3 worldCenter { 0.0f, 0.0f, 0.0f };
259     /** World radius */
260     float worldRadius { 0.0f };
261 
262     /** Index buffer */
263     RenderIndexBuffer indexBuffer;
264     /** Vertex buffers */
265     RenderVertexBuffer vertexBuffers[RENDER_NS::PipelineStateConstants::MAX_VERTEX_BUFFER_COUNT];
266     /** Vertex buffer count */
267     uint32_t vertexBufferCount { 0 };
268 
269     /* Optional indirect args buffer for indirect draw. */
270     RenderVertexBuffer indirectArgsBuffer;
271 
272     /** Draw command */
273     RenderDrawCommand drawCommand;
274 
275     /** Submesh flags */
276     RenderSubmeshFlags submeshFlags { 0 };
277 };
278 
279 /** Render light */
280 struct RenderLight {
281     /** Light usage flag bits */
282     enum LightUsageFlagBits {
283         /** Directional light bit */
284         LIGHT_USAGE_DIRECTIONAL_LIGHT_BIT = (1 << 0),
285         /** Point light bit */
286         LIGHT_USAGE_POINT_LIGHT_BIT = (1 << 1),
287         /** Spot light bit */
288         LIGHT_USAGE_SPOT_LIGHT_BIT = (1 << 2),
289         /** Shadow light bit */
290         LIGHT_USAGE_SHADOW_LIGHT_BIT = (1 << 3),
291     };
292     /** Light usage flags */
293     using LightUsageFlags = uint32_t;
294 
295     /** Unique id. */
296     uint64_t id { RenderSceneDataConstants::INVALID_ID };
297 
298     /** Layer mask (light affect mask). All enabled by default */
299     uint64_t layerMask { RenderSceneDataConstants::INVALID_ID };
300 
301     /** Position */
302     BASE_NS::Math::Vec4 pos { 0.0f, 0.0f, 0.0f, 0.0f };
303     /** Direction */
304     BASE_NS::Math::Vec4 dir { 0.0f, 0.0f, 0.0f, 0.0f };
305     /** Color, w is intensity */
306     BASE_NS::Math::Vec4 color { 0.0f, 0.0f, 0.0f, 0.0f };
307 
308     /* Spot light params. .x = angleScale, .y = angleOffset, .z = innerAngle, .w = outerAngle */
309     BASE_NS::Math::Vec4 spotLightParams { 0.0f, 0.0f, 0.0f, 0.0f };
310     /* Point and spot params. */
311     float range { 0.0f };
312     // .x = shadow factor, .y = depth bias, .z = normal bias
313     BASE_NS::Math::Vec4 shadowFactors { 1.0f, 0.005f, 0.02f, 0.0f };
314     /* Shadow strength. 0-1 */
315     float shadowStrength { 1.0f };
316 
317     /** Object ID */
318     uint32_t objectId { ~0u };
319     /** Light usage flags */
320     LightUsageFlags lightUsageFlags { 0u };
321 
322     /** Shadow camera index in render lights */
323     uint32_t shadowCameraIndex { ~0u };
324     /** Filled by the data store */
325     uint32_t shadowIndex { ~0u };
326 };
327 
328 /** Render camera */
329 struct RenderCamera {
330     /** Target type */
331     enum class CameraTargetType : uint8_t {
332         /** Default targets */
333         TARGET_TYPE_DEFAULT_TARGETS = 0,
334         /** Custom targets */
335         TARGET_TYPE_CUSTOM_TARGETS = 1,
336     };
337 
338     enum CameraFlagBits : uint32_t {
339         /** Clear depth */
340         CAMERA_FLAG_CLEAR_DEPTH_BIT = (1 << 0),
341         /** Clear color */
342         CAMERA_FLAG_CLEAR_COLOR_BIT = (1 << 1),
343         /** Shadow camera */
344         CAMERA_FLAG_SHADOW_BIT = (1 << 2),
345         /** MSAA enabled */
346         CAMERA_FLAG_MSAA_BIT = (1 << 3),
347         /** Reflection camera */
348         CAMERA_FLAG_REFLECTION_BIT = (1 << 4),
349         /** Main scene camera. I.e. the final main camera which might try to render to swapchain */
350         CAMERA_FLAG_MAIN_BIT = (1 << 5),
351         /** This is a pre-pass color camera. */
352         CAMERA_FLAG_COLOR_PRE_PASS_BIT = (1 << 6),
353         /** Render only opaque. */
354         CAMERA_FLAG_OPAQUE_BIT = (1 << 7),
355         /** Use and flip history */
356         CAMERA_FLAG_HISTORY_BIT = (1 << 8),
357         /** Jitter camera. */
358         CAMERA_FLAG_JITTER_BIT = (1 << 9),
359         /** Output samplable velocity normal */
360         CAMERA_FLAG_OUTPUT_VELOCITY_NORMAL_BIT = (1 << 10),
361         /** Disable FW velocity */
362         CAMERA_FLAG_INVERSE_WINDING_BIT = (1 << 11),
363         /** Samplable depth target */
364         CAMERA_FLAG_OUTPUT_DEPTH_BIT = (1 << 12),
365     };
366     using Flags = uint32_t;
367 
368     enum class RenderPipelineType : uint32_t {
369         /** Forward */
370         LIGHT_FORWARD = 0,
371         /** Forward */
372         FORWARD = 1,
373         /** Deferred */
374         DEFERRED = 2,
375         /** Custom */
376         CUSTOM = 3,
377     };
378 
379     enum class CameraCullType : uint8_t {
380         /** None */
381         CAMERA_CULL_NONE = 0,
382         /** Front to back */
383         CAMERA_CULL_VIEW_FRUSTUM = 1,
384     };
385 
386     /** Matrices */
387     struct Matrices {
388         /** View matrix */
389         BASE_NS::Math::Mat4X4 view;
390         /** Projection matrix */
391         BASE_NS::Math::Mat4X4 proj;
392 
393         /** Previous view matrix */
394         BASE_NS::Math::Mat4X4 viewPrevFrame;
395         /** Previous projection matrix */
396         BASE_NS::Math::Mat4X4 projPrevFrame;
397     };
398 
399     /** Environment setup */
400     struct Environment {
401         /** Background type for env node */
402         enum BackgroundType {
403             /** None */
404             BG_TYPE_NONE = 0,
405             /** Image (2d) */
406             BG_TYPE_IMAGE = 1,
407             /** Cubemap */
408             BG_TYPE_CUBEMAP = 2,
409             /** Equirectangular */
410             BG_TYPE_EQUIRECTANGULAR = 3,
411         };
412 
413         /** Unique id. */
414         uint64_t id { RenderSceneDataConstants::INVALID_ID };
415 
416         /** Layer mask (camera render mask). All enabled by default */
417         uint64_t layerMask { RenderSceneDataConstants::INVALID_ID };
418 
419         /** Radiance cubemap resource handle */
420         RENDER_NS::RenderHandleReference radianceCubemap;
421         /** Radiance cubemap mip count. Zero indicates that full mipchain is available */
422         uint32_t radianceCubemapMipCount { 0u };
423 
424         /** Environment map resource handle */
425         RENDER_NS::RenderHandleReference envMap;
426         /** Environment map lod level for sampling */
427         float envMapLodLevel { 0.0f };
428 
429         /** Spherical harmonic coefficients for indirect diffuse (irradiance)
430          * Prescaled with 1.0 / PI. */
431         BASE_NS::Math::Vec4 shIndirectCoefficients[RenderSceneDataConstants::MAX_SH_VEC3_COUNT];
432 
433         /** Indirect diffuse color factor (.rgb = tint, .a = intensity) */
434         BASE_NS::Math::Vec4 indirectDiffuseFactor { 1.0f, 1.0f, 1.0f, 1.0f };
435         /** Indirect specular color factor (.rgb = tint, .a = intensity) */
436         BASE_NS::Math::Vec4 indirectSpecularFactor { 1.0f, 1.0f, 1.0f, 1.0f };
437         /** Env map color factor (.rgb = tint, .a = intensity) */
438         BASE_NS::Math::Vec4 envMapFactor { 1.0f, 1.0f, 1.0f, 1.0f };
439         /** Additional factor */
440         BASE_NS::Math::Vec4 additionalFactor { 0.0f, 0.0f, 0.0f, 0.0f };
441 
442         /** Environment rotation */
443         BASE_NS::Math::Quat rotation { 0.0f, 0.0f, 0.0f, 1.0f };
444 
445         /** Background type */
446         BackgroundType backgroundType { BackgroundType::BG_TYPE_NONE };
447 
448         /** Custom shader handle */
449         RENDER_NS::RenderHandleReference shader;
450         /** invalid handles if not given */
451         RENDER_NS::RenderHandleReference customResourceHandles[RenderSceneDataConstants::MAX_ENV_CUSTOM_RESOURCE_COUNT];
452     };
453 
454     /** Fog setup */
455     struct Fog {
456         /** Unique id. */
457         uint64_t id { RenderSceneDataConstants::INVALID_ID };
458 
459         /** Layer mask (camera render mask). All enabled by default */
460         uint64_t layerMask { RenderSceneDataConstants::INVALID_ID };
461 
462         /** .x = density, .y = heightFalloff, .z = heightFogOffset */
463         BASE_NS::Math::Vec4 firstLayer { 1.0f, 1.0f, 1.0f, 0.0f };
464         /** .x = density, .y = heightFalloff, .z = heightFogOffset */
465         BASE_NS::Math::Vec4 secondLayer { 1.0f, 1.0f, 1.0f, 0.0f };
466 
467         /** .x = startDistance, .y = cutoffDistance, .z = maxOpacity */
468         BASE_NS::Math::Vec4 baseFactors { 1.0f, -1.0f, 1.0f, 0.0f };
469 
470         /** Primary color for the fog (.rgb = tint, .a = intensity) */
471         BASE_NS::Math::Vec4 inscatteringColor { 1.0f, -1.0f, 1.0f, 0.0f };
472         /** Env map color factor (.rgb = tint, .a = intensity) */
473         BASE_NS::Math::Vec4 envMapFactor { 1.0f, -1.0f, 1.0f, 0.0f };
474 
475         /** Additional factor */
476         BASE_NS::Math::Vec4 additionalFactor { 0.0f, 0.0f, 0.0f, 0.0f };
477     };
478 
479     /** Unique id. */
480     uint64_t id { RenderSceneDataConstants::INVALID_ID };
481     /** Shadow id. (Can be invalid) */
482     uint64_t shadowId { RenderSceneDataConstants::INVALID_ID };
483 
484     /** Layer mask (camera render mask). All enabled by default */
485     uint64_t layerMask { RenderSceneDataConstants::INVALID_ID };
486 
487     /** Matrices (Contains view, projection, view of previous frame and projection of previous frame) */
488     Matrices matrices;
489 
490     /** Viewport (relative to render resolution) */
491     BASE_NS::Math::Vec4 viewport { 0.0f, 0.0f, 1.0f, 1.0f };
492     /** Scissor (relative to render resolution) */
493     BASE_NS::Math::Vec4 scissor { 0.0f, 0.0f, 1.0f, 1.0f };
494     /** Render resolution */
495     BASE_NS::Math::UVec2 renderResolution { 0u, 0u };
496 
497     /** Z near value */
498     float zNear { 0.0f };
499     /** Z far value */
500     float zFar { 0.0f };
501 
502     /** Target type */
503     CameraTargetType targetType { CameraTargetType::TARGET_TYPE_DEFAULT_TARGETS };
504 
505     /** Custom depth target */
506     RENDER_NS::RenderHandleReference depthTarget {};
507     /** Custom color targets */
508     RENDER_NS::RenderHandleReference colorTargets[RenderSceneDataConstants::MAX_CAMERA_COLOR_TARGET_COUNT];
509 
510     /** Custom pre-pass color target. Can be used e.g. for refraction. */
511     RENDER_NS::RenderHandleReference prePassColorTarget;
512     /** Custom pre-pass color target. Can be tried to fetch with a name if handle is not given. */
513     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> prePassColorTargetName;
514 
515     /** Flags for camera */
516     Flags flags { 0u };
517 
518     /** Flags for camera render pipeline */
519     RenderPipelineType renderPipelineType { RenderPipelineType::FORWARD };
520 
521     /** Clear depth / stencil values. Clear enabled if flags set. */
522     RENDER_NS::ClearDepthStencilValue clearDepthStencil { 1.0f, 0u };
523     /** Clear color values. Clear enabled if flags set */
524     RENDER_NS::ClearColorValue clearColorValues { 0.0f, 0.0f, 0.0f, 0.0f };
525 
526     /** Camera cull type */
527     CameraCullType cullType { CameraCullType::CAMERA_CULL_VIEW_FRUSTUM };
528 
529     /** Environment setup for camera */
530     Environment environment;
531 
532     /** Fog setup for camera */
533     Fog fog;
534 
535     /** Custom render node graph from camera component */
536     RENDER_NS::RenderHandleReference customRenderNodeGraph;
537 
538     /** Custom render node graph file from camera component */
539     BASE_NS::string customRenderNodeGraphFile;
540 
541     /** Target customization */
542     struct TargetUsage {
543         /** Target format */
544         BASE_NS::Format format { BASE_NS::Format::BASE_FORMAT_UNDEFINED };
545         /** Usage flags hints for optimizing resource creation */
546         RENDER_NS::ImageUsageFlags usageFlags { 0 };
547     };
548 
549     /** Depth target customization */
550     TargetUsage depthTargetCustomization;
551     /** Color target customization */
552     TargetUsage colorTargetCustomization[RenderSceneDataConstants::MAX_CAMERA_COLOR_TARGET_COUNT];
553 
554     /** Unique camera name for getting named camera. */
555     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> name;
556 
557     /** Camera post process name. Can be empty */
558     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> postProcessName;
559 };
560 
561 /** Render scene */
562 struct RenderScene {
563     /** Unique id. */
564     uint64_t id { RenderSceneDataConstants::INVALID_ID };
565     /** Unique scene name (If name is empty a default id/name is created with index) */
566     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> name;
567 
568     /** Scene render data store name needs to be known */
569 
570     /** Camera render data store name */
571     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> dataStoreNameCamera;
572     /** Light render data store name */
573     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> dataStoreNameLight;
574     /** Material data store name */
575     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> dataStoreNameMaterial;
576     /** Morphing data store name */
577     BASE_NS::fixed_string<RENDER_NS::RenderDataConstants::MAX_DEFAULT_NAME_LENGTH> dataStoreNameMorph;
578 
579     /** World scene center */
580     BASE_NS::Math::Vec3 worldSceneCenter { 0.0f, 0.0f, 0.0f };
581     /** World scene bounding sphere radius */
582     float worldSceneBoundingSphereRadius { 0.0f };
583 
584     /** Index of scene camera in rendering cameras */
585     uint32_t cameraIndex { RenderSceneDataConstants::INVALID_INDEX };
586 
587     /** Scene delta time in milliseconds */
588     float sceneDeltaTime { 0 };
589     /** Real total tick time in seconds */
590     float totalTime { 0u };
591     /** Real delta tick time in milliseconds */
592     float deltaTime { 0u };
593     /** Render scene frame index */
594     uint32_t frameIndex { 0u };
595 
596     /** Custom render node graph from scene component */
597     RENDER_NS::RenderHandleReference customRenderNodeGraph;
598 
599     /** Custom render node graph file from scene component */
600     BASE_NS::string customRenderNodeGraphFile;
601 };
602 
603 struct SlotSubmeshIndex {
604     uint32_t submeshIndex { 0 };
605 
606     uint32_t sortLayerKey { 0 };
607     uint64_t sortKey { 0 };
608     uint32_t renderMaterialSortHash { 0 };
609     RENDER_NS::RenderHandle shaderHandle;
610     RENDER_NS::RenderHandle gfxStateHandle;
611 };
612 
613 enum RenderSceneFlagBits : uint32_t {
614     RENDER_SCENE_DIRECT_POST_PROCESS_BIT = (1 << 0),
615     RENDER_SCENE_FLIP_WINDING_BIT = (1 << 1),
616     RENDER_SCENE_DISCARD_MATERIAL_BIT = (1 << 2),
617 };
618 using RenderSceneFlags = uint32_t;
619 /** @} */
620 CORE3D_END_NAMESPACE()
621 
622 #endif // API_3D_RENDER_RENDER_DATA_DEFINES_H
623