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_LIGHT_H 16 #define SCENEPLUGIN_INTF_LIGHT_H 17 18 #include <scene_plugin/interface/intf_node.h> 19 20 #include <meta/base/types.h> 21 22 #include <scene_plugin/interface/compatibility.h> 23 24 25 SCENE_BEGIN_NAMESPACE() 26 27 // Implemented by SCENE_NS::ClassId::Light 28 REGISTER_INTERFACE(ILight, "63db8e75-3faa-4439-b346-23db8818370a") 29 class ILight : public CORE_NS::IInterface { 30 META_INTERFACE(CORE_NS::IInterface, ILight, InterfaceId::ILight) 31 public: 32 /** 33 * @brief SceneLightType enum defines the light type. Different types of lights use 34 * different properties 35 */ 36 enum SceneLightType { SCENE_LIGHT_DIRECTIONAL = 0, SCENE_LIGHT_POINT = 1, SCENE_LIGHT_SPOT = 2 }; 37 /** 38 * @brief Diffuse color of the light. Values from 0.0 to 1.0. 39 * @return property pointer 40 */ 41 META_PROPERTY(SCENE_NS::Color, Color) 42 43 /** 44 * @brief Intensity of the light. 45 * @return property pointer 46 */ 47 META_PROPERTY(float, Intensity) 48 49 /** 50 * @brief Near plane distance from the light source. 51 * @return property pointer 52 */ 53 META_PROPERTY(float, NearPlane) 54 55 /** 56 * @brief Shadow enabled. 57 * @return property pointer 58 */ 59 META_PROPERTY(bool, ShadowEnabled) 60 61 /** 62 * @brief Shadow strength. 63 * @return property pointer 64 */ 65 META_PROPERTY(float, ShadowStrength) 66 67 /** 68 * @brief Shadow depth bias. 69 * @return property pointer 70 */ 71 META_PROPERTY(float, ShadowDepthBias) 72 73 /** 74 * @brief Shadow normal bias. 75 * @return property pointer 76 */ 77 META_PROPERTY(float, ShadowNormalBias) 78 79 /** 80 * @brief Spotlight inner angle. 81 * @return property pointer 82 */ 83 META_PROPERTY(float, SpotInnerAngle) 84 85 /** 86 * @brief Spotlight outer angle. 87 * @return property pointer 88 */ 89 META_PROPERTY(float, SpotOuterAngle) 90 91 /** 92 * @brief Type of the light. Defaults to SCENE_LIGHT_DIRECTIONAL. 93 * @return 94 */ 95 META_PROPERTY(uint8_t, Type) 96 97 /** 98 * @brief Additional factor for e.g. shader customization. 99 * @return property pointer 100 */ 101 META_PROPERTY(BASE_NS::Math::Vec4, AdditionalFactor) 102 103 /** 104 * @brief Defines a layer mask which affects lighting of layer objects. Default is all layer mask, and then the 105 * light affects objects on all layers. 106 * @return 107 */ 108 META_PROPERTY(uint64_t, LightLayerMask) 109 110 /** 111 * @brief Defines a layer mask which affects lighting of layer objects. Default is all layer mask, and then the 112 * light affects objects on all layers. 113 * @return 114 */ 115 META_PROPERTY(uint64_t, ShadowLayerMask) 116 }; 117 SCENE_END_NAMESPACE() 118 119 META_TYPE(SCENE_NS::ILight::WeakPtr); 120 META_TYPE(SCENE_NS::ILight::Ptr); 121 122 #endif // SCENEPLUGIN_INTF_LIGHT_H 123