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_bitmap.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 * @return property pointer 43 */ 44 META_PROPERTY(BASE_NS::Math::Vec4, IndirectDiffuseFactor) 45 46 /** 47 * @brief Indirect specular factor with intensity in alpha. 48 * @return property pointer 49 */ 50 META_PROPERTY(BASE_NS::Math::Vec4, IndirectSpecularFactor) 51 52 /** 53 * @brief Environment map factor with intensity in alpha. 54 * @return property pointer 55 */ 56 META_PROPERTY(BASE_NS::Math::Vec4, EnvMapFactor) 57 58 /** 59 * @brief Radiance cubemap. 60 * @return property pointer 61 */ 62 META_PROPERTY(IBitmap::Ptr, RadianceImage) 63 64 /** 65 * @brief Number of mip map levels in radiance cubemap, zero value indicates that full mip chain is available. 66 * @return property pointer 67 */ 68 META_PROPERTY(uint32_t, RadianceCubemapMipCount) 69 70 /** 71 * @brief Environment map. (Cubemap, Equirect, Image). 72 * @return property pointer 73 */ 74 META_PROPERTY(IBitmap::Ptr, EnvironmentImage) 75 76 /** 77 * @brief Mip lod level for env map sampling, allows to have blurred / gradient background for the scene. 78 * @return property pointer 79 */ 80 META_PROPERTY(float, EnvironmentMapLodLevel) 81 82 /** 83 * @brief Irradiance lighting coefficients. 84 * Values are expected to be prescaled with 1.0 / PI for Lambertian diffuse 85 * @return property pointer 86 */ 87 META_ARRAY_PROPERTY(BASE_NS::Math::Vec3, IrradianceCoefficients) 88 89 /** 90 * @brief IBL environment rotation. 91 * @return property pointer 92 */ 93 META_PROPERTY(BASE_NS::Math::Quat, EnvironmentRotation) 94 95 /** 96 * @brief Additional factor for shader customization. 97 * @return property pointer 98 */ 99 100 // q: how to do? 101 // META_PROPERTY(uint64_t, ShaderHandle) 102 }; 103 104 META_REGISTER_CLASS(Environment, "e839fed0-d4d2-4521-9df9-6aeb5f62161e", META_NS::ObjectCategoryBits::NO_CATEGORY) 105 106 SCENE_END_NAMESPACE() 107 108 META_TYPE(SCENE_NS::EnvBackgroundType) 109 META_INTERFACE_TYPE(SCENE_NS::IEnvironment) 110 111 #endif 112