1 /*
2  * Copyright (c) 2024 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 #if !defined(API_3D_ECS_COMPONENTS_POST_PROCESS_COMPONENT_H) || defined(IMPLEMENT_MANAGER)
17 #define API_3D_ECS_COMPONENTS_POST_PROCESS_COMPONENT_H
18 
19 #if !defined(IMPLEMENT_MANAGER)
20 #include <3d/namespace.h>
21 #include <core/ecs/component_struct_macros.h>
22 #include <core/ecs/intf_component_manager.h>
23 #include <render/datastore/render_data_store_render_pods.h>
24 
25 CORE3D_BEGIN_NAMESPACE()
26 #endif
27 
28 /** Post-process component that can be used with cameras.
29  * Uses the core configuration of PostProcessConfiguration, expect fog control not used/implemented.
30  */
31 BEGIN_COMPONENT(IPostProcessComponentManager, PostProcessComponent)
32 #if !defined(IMPLEMENT_MANAGER)
33     enum FlagBits : uint32_t {
34         TONEMAP_BIT = (1 << 0),
35         VIGNETTE_BIT = (1 << 1),
36         DITHER_BIT = (1 << 2),
37         COLOR_CONVERSION_BIT = (1 << 3),
38         COLOR_FRINGE_BIT = (1 << 4),
39         BLUR_BIT = (1 << 8),
40         BLOOM_BIT = (1 << 9),
41         FXAA_BIT = (1 << 10),
42         TAA_BIT = (1 << 11),
43         DOF_BIT = (1 << 12),
44         MOTION_BLUR_BIT = (1 << 13),
45     };
46     /** Container for post-processing flag bits */
47     using Flags = uint32_t;
48 #endif
49 
50     /** The type of the background fill when rendering.
51      */
52     DEFINE_BITFIELD_PROPERTY(
53         Flags, enableFlags, "Enabled Effects", PropertyFlags::IS_BITFIELD, VALUE(0), PostProcessComponent::FlagBits)
54 
55     /** Tonemap configuration.
56      */
57     DEFINE_PROPERTY(RENDER_NS::TonemapConfiguration, tonemapConfiguration, "Tonemap Configuration", 0, ARRAY_VALUE())
58 
59     /** Bloom configuration.
60      */
61     DEFINE_PROPERTY(RENDER_NS::BloomConfiguration, bloomConfiguration, "Bloom Configuration", 0, ARRAY_VALUE())
62 
63     /** Vignette configuration.
64      */
65     DEFINE_PROPERTY(RENDER_NS::VignetteConfiguration, vignetteConfiguration, "Vignette Configuration", 0, ARRAY_VALUE())
66 
67     /** Color fringe configuration.
68      */
69     DEFINE_PROPERTY(
70         RENDER_NS::ColorFringeConfiguration, colorFringeConfiguration, "Color Fringe Configuration", 0, ARRAY_VALUE())
71 
72     /** Dither configuration.
73      */
74     DEFINE_PROPERTY(RENDER_NS::DitherConfiguration, ditherConfiguration, "Dither Configuration", 0, ARRAY_VALUE())
75 
76     /** Blur configuration.
77      */
78     DEFINE_PROPERTY(RENDER_NS::BlurConfiguration, blurConfiguration, "Target Blur Configuration", 0, ARRAY_VALUE())
79 
80     /** Color conversion configuration.
81      */
82     DEFINE_PROPERTY(RENDER_NS::ColorConversionConfiguration, colorConversionConfiguration,
83         "Color Conversion Configuration", 0, ARRAY_VALUE())
84 
85     /** FX anti-aliasing configuration.
86      */
87     DEFINE_PROPERTY(RENDER_NS::FxaaConfiguration, fxaaConfiguration, "Fast Approximate Anti-Aliasing Configuration", 0,
88         ARRAY_VALUE())
89 
90     /** Temporal anti-aliasing configuration.
91      */
92     DEFINE_PROPERTY(
93         RENDER_NS::TaaConfiguration, taaConfiguration, "Temporal Anti-Aliasing Configuration", 0, ARRAY_VALUE())
94 
95     /** Depth of field configuration.
96      */
97     DEFINE_PROPERTY(RENDER_NS::DofConfiguration, dofConfiguration, "Depth Of Field Configuration", 0, ARRAY_VALUE())
98 
99     /** Motion blur configuration.
100      */
101     DEFINE_PROPERTY(
102         RENDER_NS::MotionBlurConfiguration, motionBlurConfiguration, "Motion Blur Configuration", 0, ARRAY_VALUE())
103 
104 END_COMPONENT(IPostProcessComponentManager, PostProcessComponent, "a2c647e7-9c66-4565-af3b-3acc75b3718f")
105 #if !defined(IMPLEMENT_MANAGER)
106 CORE3D_END_NAMESPACE()
107 #endif
108 #endif
109