• 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_COMPONENT_ENVIRONMENT_COMPONENT_H
17 #define SCENE_SRC_COMPONENT_ENVIRONMENT_COMPONENT_H
18 
19 #include <scene/ext/component_fwd.h>
20 #include <scene/interface/intf_environment.h>
21 
22 #include <meta/ext/object.h>
23 
24 SCENE_BEGIN_NAMESPACE()
25 
26 META_REGISTER_CLASS(
27     EnvironmentComponent, "0dc6c2ca-ed0e-4ee5-bdde-91eeb7a67b91", META_NS::ObjectCategoryBits::NO_CATEGORY)
28 
29 class EnvironmentComponent : public META_NS::IntroduceInterfaces<ComponentFwd, IEnvironment> {
30     META_OBJECT(EnvironmentComponent, ClassId::EnvironmentComponent, IntroduceInterfaces)
31 
32 public:
33     META_BEGIN_STATIC_DATA()
34     SCENE_STATIC_PROPERTY_DATA(IEnvironment, EnvBackgroundType, Background, "EnvironmentComponent.background")
35     SCENE_STATIC_PROPERTY_DATA(
36         IEnvironment, BASE_NS::Math::Vec4, IndirectDiffuseFactor, "EnvironmentComponent.indirectDiffuseFactor")
37     SCENE_STATIC_PROPERTY_DATA(
38         IEnvironment, BASE_NS::Math::Vec4, IndirectSpecularFactor, "EnvironmentComponent.indirectSpecularFactor")
39     SCENE_STATIC_PROPERTY_DATA(IEnvironment, BASE_NS::Math::Vec4, EnvMapFactor, "EnvironmentComponent.envMapFactor")
40     SCENE_STATIC_PROPERTY_DATA(
41         IEnvironment, uint32_t, RadianceCubemapMipCount, "EnvironmentComponent.radianceCubemapMipCount")
42     SCENE_STATIC_PROPERTY_DATA(IEnvironment, float, EnvironmentMapLodLevel, "EnvironmentComponent.envMapLodLevel")
43     SCENE_STATIC_PROPERTY_DATA(
44         IEnvironment, BASE_NS::Math::Quat, EnvironmentRotation, "EnvironmentComponent.environmentRotation")
45     SCENE_STATIC_ARRAY_PROPERTY_DATA(
46         IEnvironment, BASE_NS::Math::Vec3, IrradianceCoefficients, "EnvironmentComponent.irradianceCoefficients")
47     SCENE_STATIC_DYNINIT_PROPERTY_DATA(
48         IEnvironment, IBitmap::Ptr, RadianceImage, "EnvironmentComponent.radianceCubemap")
49     SCENE_STATIC_DYNINIT_PROPERTY_DATA(IEnvironment, IBitmap::Ptr, EnvironmentImage, "EnvironmentComponent.envMap")
50     META_END_STATIC_DATA()
51 
52     META_IMPLEMENT_PROPERTY(EnvBackgroundType, Background)
53     META_IMPLEMENT_PROPERTY(BASE_NS::Math::Vec4, IndirectDiffuseFactor)
54     META_IMPLEMENT_PROPERTY(BASE_NS::Math::Vec4, IndirectSpecularFactor)
55     META_IMPLEMENT_PROPERTY(BASE_NS::Math::Vec4, EnvMapFactor)
56     META_IMPLEMENT_PROPERTY(uint32_t, RadianceCubemapMipCount)
57     META_IMPLEMENT_PROPERTY(float, EnvironmentMapLodLevel)
58     META_IMPLEMENT_PROPERTY(BASE_NS::Math::Quat, EnvironmentRotation)
59     META_IMPLEMENT_ARRAY_PROPERTY(BASE_NS::Math::Vec3, IrradianceCoefficients)
60     META_IMPLEMENT_PROPERTY(IBitmap::Ptr, RadianceImage)
61     META_IMPLEMENT_PROPERTY(IBitmap::Ptr, EnvironmentImage)
62 
63     bool InitDynamicProperty(const META_NS::IProperty::Ptr& p, BASE_NS::string_view path) override;
64 
65 public:
66     BASE_NS::string GetName() const override;
67 };
68 
69 SCENE_END_NAMESPACE()
70 
71 #endif
72