• 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_INTERFACE_IENVIRONMENT_H
17 #define SCENE_INTERFACE_IENVIRONMENT_H
18 
19 #include <scene/base/types.h>
20 #include <scene/interface/intf_image.h>
21 
22 SCENE_BEGIN_NAMESPACE()
23 
24 enum class EnvBackgroundType : uint8_t {
25     /** Background none */
26     NONE = 0,
27     /** Background image */
28     IMAGE = 1,
29     /** Background cubemap */
30     CUBEMAP = 2,
31     /** Background equirectangular */
32     EQUIRECTANGULAR = 3,
33 };
34 
35 class IEnvironment : public CORE_NS::IInterface {
36     META_INTERFACE(CORE_NS::IInterface, IEnvironment, "68341d9c-6252-4a72-9011-adda3a83b848")
37 public:
38     META_PROPERTY(EnvBackgroundType, Background)
39 
40     /**
41      * @brief Indirect diffuse factor with intensity in alpha.
42      */
43     META_PROPERTY(BASE_NS::Math::Vec4, IndirectDiffuseFactor)
44 
45     /**
46      * @brief Indirect specular factor with intensity in alpha.
47      */
48     META_PROPERTY(BASE_NS::Math::Vec4, IndirectSpecularFactor)
49 
50     /**
51      * @brief Environment map factor with intensity in alpha.
52      */
53     META_PROPERTY(BASE_NS::Math::Vec4, EnvMapFactor)
54 
55     /**
56      * @brief Radiance cubemap.
57      */
58     META_PROPERTY(IImage::Ptr, RadianceImage)
59 
60     /**
61      * @brief Number of mip map levels in radiance cubemap, zero value indicates that full mip chain is available.
62      */
63     META_PROPERTY(uint32_t, RadianceCubemapMipCount)
64 
65     /**
66      * @brief  Environment map. (Cubemap, Equirect, Image).
67      */
68     META_PROPERTY(IImage::Ptr, EnvironmentImage)
69 
70     /**
71      * @brief Mip lod level for env map sampling, allows to have blurred / gradient background for the scene.
72      */
73     META_PROPERTY(float, EnvironmentMapLodLevel)
74 
75     /**
76      * @brief Irradiance lighting coefficients.
77      * Values are expected to be prescaled with 1.0 / PI for Lambertian diffuse
78      */
79     META_ARRAY_PROPERTY(BASE_NS::Math::Vec3, IrradianceCoefficients)
80 
81     /**
82      * @brief IBL environment rotation.
83      */
84     META_PROPERTY(BASE_NS::Math::Quat, EnvironmentRotation)
85 };
86 
87 META_REGISTER_CLASS(Environment, "e839fed0-d4d2-4521-9df9-6aeb5f62161e", META_NS::ObjectCategoryBits::NO_CATEGORY)
88 
89 SCENE_END_NAMESPACE()
90 
91 META_TYPE(SCENE_NS::EnvBackgroundType)
92 META_INTERFACE_TYPE(SCENE_NS::IEnvironment)
93 
94 #endif
95