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_TONEMAP_H 17 #define SCENE_SRC_POSTPROCESS_TONEMAP_H 18 19 #include <scene/ext/ecs_lazy_property.h> 20 #include <scene/ext/scene_property.h> 21 #include <scene/interface/postprocess/intf_postprocess_effect.h> 22 #include <scene/interface/postprocess/intf_tonemap.h> 23 24 #include <meta/ext/implementation_macros.h> 25 26 #include "util.h" 27 28 SCENE_BEGIN_NAMESPACE() 29 30 META_REGISTER_CLASS(Tonemap, "56c1fc6e-90aa-486d-846e-c9a5c780a90a", META_NS::ObjectCategoryBits::NO_CATEGORY) 31 32 class Tonemap : public META_NS::IntroduceInterfaces<EcsLazyProperty, ITonemap, IPPEffectInit> { 33 META_OBJECT(Tonemap, ClassId::Tonemap, IntroduceInterfaces) 34 public: 35 META_BEGIN_STATIC_DATA() 36 SCENE_STATIC_DYNINIT_PROPERTY_DATA(IPostProcessEffect, bool, Enabled, "") 37 SCENE_STATIC_DYNINIT_PROPERTY_DATA(ITonemap, TonemapType, Type, "tonemapType") 38 SCENE_STATIC_DYNINIT_PROPERTY_DATA(ITonemap, float, Exposure, "exposure") 39 META_END_STATIC_DATA() 40 41 META_IMPLEMENT_PROPERTY(bool, Enabled) 42 META_IMPLEMENT_PROPERTY(TonemapType, Type) 43 META_IMPLEMENT_PROPERTY(float, Exposure) 44 45 bool InitDynamicProperty(const META_NS::IProperty::Ptr& p, BASE_NS::string_view path) override; Init(const META_NS::IProperty::Ptr & flags)46 bool Init(const META_NS::IProperty::Ptr& flags) override 47 { 48 flags_ = flags; 49 return static_cast<bool>(flags_); 50 } 51 52 private: 53 META_NS::Property<uint32_t> flags_; 54 }; 55 56 SCENE_END_NAMESPACE() 57 58 #endif