• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef SCENE_SRC_POSTPROCESS_BLOOM_H
17 #define SCENE_SRC_POSTPROCESS_BLOOM_H
18 
19 #include <scene/ext/ecs_lazy_property.h>
20 #include <scene/ext/scene_property.h>
21 #include <scene/interface/postprocess/intf_bloom.h>
22 #include <scene/interface/postprocess/intf_postprocess_effect.h>
23 
24 #include <meta/ext/implementation_macros.h>
25 
26 #include "util.h"
27 
28 SCENE_BEGIN_NAMESPACE()
29 
30 META_REGISTER_CLASS(Bloom, "6718b07d-c3d1-4036-bd0f-88d1380b846a", META_NS::ObjectCategoryBits::NO_CATEGORY)
31 
32 class Bloom : public META_NS::IntroduceInterfaces<EcsLazyProperty, IBloom, IPPEffectInit> {
33     META_OBJECT(Bloom, ClassId::Bloom, IntroduceInterfaces)
34 public:
35     META_BEGIN_STATIC_DATA()
36     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IPostProcessEffect, bool, Enabled, "")
37     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, BloomType, Type, "bloomType")
38     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, EffectQualityType, Quality, "bloomQualityType")
39     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, float, ThresholdHard, "thresholdHard")
40     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, float, ThresholdSoft, "thresholdSoft")
41     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, float, AmountCoefficient, "amountCoefficient")
42     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, float, DirtMaskCoefficient, "dirtMaskCoefficient")
43     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, IImage::Ptr, DirtMaskImage, "dirtMaskImage")
44     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, bool, UseCompute, "useCompute")
45     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, float, Scatter, "scatter")
46     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IBloom, float, ScaleFactor, "scaleFactor")
47     META_END_STATIC_DATA()
48 
49     META_IMPLEMENT_PROPERTY(bool, Enabled)
50     META_IMPLEMENT_PROPERTY(BloomType, Type)
51     META_IMPLEMENT_PROPERTY(EffectQualityType, Quality)
52     META_IMPLEMENT_PROPERTY(float, ThresholdHard)
53     META_IMPLEMENT_PROPERTY(float, ThresholdSoft)
54     META_IMPLEMENT_PROPERTY(float, AmountCoefficient)
55     META_IMPLEMENT_PROPERTY(float, DirtMaskCoefficient)
56     META_IMPLEMENT_PROPERTY(IImage::Ptr, DirtMaskImage)
57     META_IMPLEMENT_PROPERTY(bool, UseCompute)
58     META_IMPLEMENT_PROPERTY(float, Scatter)
59     META_IMPLEMENT_PROPERTY(float, ScaleFactor)
60 
61     bool InitDynamicProperty(const META_NS::IProperty::Ptr& p, BASE_NS::string_view path) override;
Init(const META_NS::IProperty::Ptr & flags)62     bool Init(const META_NS::IProperty::Ptr& flags) override
63     {
64         flags_ = flags;
65         return static_cast<bool>(flags_);
66     }
67 
68 private:
69     META_NS::Property<uint32_t> flags_;
70 };
71 
72 SCENE_END_NAMESPACE()
73 
74 #endif