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 #ifndef SCENEPLUGIN_INTF_ENVIRONMENT_H
16 #define SCENEPLUGIN_INTF_ENVIRONMENT_H
17 
18 #include <scene_plugin/namespace.h>
19 #include <scene_plugin/interface/intf_bitmap.h>
20 
21 #include <meta/api/internal/object_api.h>
22 #include <meta/base/types.h>
23 
24 SCENE_BEGIN_NAMESPACE()
25 
26 // Implemented by SCENE_NS::ClassId::Environment
27 REGISTER_INTERFACE(IEnvironment, "8940546e-9717-475a-a799-60b93546dc9c")
28 class IEnvironment : public CORE_NS::IInterface {
29 public:
30     META_INTERFACE(CORE_NS::IInterface, IEnvironment, InterfaceId::IEnvironment)
31 
32 public:
33     enum BackgroundType : uint8_t {
34         /** Background none */
35         NONE = 0,
36         /** Background image */
37         IMAGE = 1,
38         /** Background cubemap */
39         CUBEMAP = 2,
40         /** Background equirectangular */
41         EQUIRECTANGULAR = 3,
42     };
43 
44     /**
45      * @brief The type of the background fill when rendering.
46      * @return property pointer
47      */
48     META_PROPERTY(BackgroundType, Background)
49 
50     /**
51      * @brief Indirect diffuse factor with intensity in alpha.
52      * @return property pointer
53      */
54     META_PROPERTY(BASE_NS::Math::Vec4, IndirectDiffuseFactor)
55 
56     /**
57      * @brief Indirect specular factor with intensity in alpha.
58      * @return property pointer
59      */
60     META_PROPERTY(BASE_NS::Math::Vec4, IndirectSpecularFactor)
61 
62     /**
63      * @brief Environment map factor with intensity in alpha.
64      * @return property pointer
65      */
66     META_PROPERTY(BASE_NS::Math::Vec4, EnvMapFactor)
67 
68     /**
69      * @brief Radiance cubemap.
70      * @return property pointer
71      */
72     META_PROPERTY(IBitmap::Ptr, RadianceImage)
73 
74     /**
75      * @brief Number of mip map levels in radiance cubemap, zero value indicates that full mip chain is available.
76      * @return property pointer
77      */
78     META_PROPERTY(uint32_t, RadianceCubemapMipCount)
79 
80     /**
81      * @brief  Environment map. (Cubemap, Equirect, Image).
82      * @return property pointer
83      */
84     META_PROPERTY(IBitmap::Ptr, EnvironmentImage)
85 
86     /**
87      * @brief Mip lod level for env map sampling, allows to have blurred / gradient background for the scene.
88      * @return property pointer
89      */
90     META_PROPERTY(float, EnvironmentMapLodLevel)
91 
92     /**
93      * @brief Irradiance lighting coefficients.
94      * Values are expected to be prescaled with 1.0 / PI for Lambertian diffuse
95      * @return property pointer
96      */
97     META_ARRAY_PROPERTY(BASE_NS::Math::Vec3, IrradianceCoefficients);
98 
99     /**
100      * @brief IBL environment rotation.
101      * @return property pointer
102      */
103     META_PROPERTY(BASE_NS::Math::Quat, EnvironmentRotation)
104 
105     /**
106      * @brief Additional factor for shader customization.
107      * @return property pointer
108      */
109     META_PROPERTY(BASE_NS::Math::Vec4, AdditionalFactor)
110 
111     /**
112      * @brief Shader. Prefer using automatic selection if no custom shaders.
113      * Needs to match default material env layouts and specializations (api/3d/shaders/common).
114      * @return property pointer
115      */
116     META_PROPERTY(uint64_t, ShaderHandle)
117 };
118 SCENE_END_NAMESPACE()
119 
120 META_TYPE(SCENE_NS::IEnvironment::BackgroundType)
121 META_TYPE(SCENE_NS::IEnvironment::WeakPtr);
122 META_TYPE(SCENE_NS::IEnvironment::Ptr);
123 
124 #endif // SCENEPLUGIN_INTF_LIGHT_H
125