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_NODE_LIGHT_NODE_H
17 #define SCENE_SRC_NODE_LIGHT_NODE_H
18
19 #include <scene/ext/intf_create_entity.h>
20 #include <scene/interface/intf_light.h>
21
22 #include "node.h"
23
SCENE_BEGIN_NAMESPACE()24 SCENE_BEGIN_NAMESPACE()
25
26 class LightNode : public META_NS::IntroduceInterfaces<Node, ILight, ICreateEntity> {
27 META_OBJECT(LightNode, ClassId::LightNode, IntroduceInterfaces)
28
29 public:
30 META_BEGIN_STATIC_DATA()
31 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, BASE_NS::Color, Color)
32 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, Intensity)
33 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, NearPlane)
34 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, bool, ShadowEnabled)
35 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, ShadowStrength)
36 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, ShadowDepthBias)
37 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, ShadowNormalBias)
38 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, SpotInnerAngle)
39 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, float, SpotOuterAngle)
40 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, LightType, Type)
41 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, BASE_NS::Math::Vec4, AdditionalFactor)
42 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, uint64_t, LightLayerMask)
43 META_STATIC_FORWARDED_PROPERTY_DATA(ILight, uint64_t, ShadowLayerMask)
44 META_END_STATIC_DATA()
45
46 SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Color, Color, "LightComponent")
47 SCENE_USE_COMPONENT_PROPERTY(float, Intensity, "LightComponent")
48 SCENE_USE_COMPONENT_PROPERTY(float, NearPlane, "LightComponent")
49 SCENE_USE_COMPONENT_PROPERTY(bool, ShadowEnabled, "LightComponent")
50 SCENE_USE_COMPONENT_PROPERTY(float, ShadowStrength, "LightComponent")
51 SCENE_USE_COMPONENT_PROPERTY(float, ShadowDepthBias, "LightComponent")
52 SCENE_USE_COMPONENT_PROPERTY(float, ShadowNormalBias, "LightComponent")
53 SCENE_USE_COMPONENT_PROPERTY(float, SpotInnerAngle, "LightComponent")
54 SCENE_USE_COMPONENT_PROPERTY(float, SpotOuterAngle, "LightComponent")
55 SCENE_USE_COMPONENT_PROPERTY(LightType, Type, "LightComponent")
56 SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Math::Vec4, AdditionalFactor, "LightComponent")
57 SCENE_USE_COMPONENT_PROPERTY(uint64_t, LightLayerMask, "LightComponent")
58 SCENE_USE_COMPONENT_PROPERTY(uint64_t, ShadowLayerMask, "LightComponent")
59
60 bool SetEcsObject(const IEcsObject::Ptr&) override;
61
62 public:
63 CORE_NS::Entity CreateEntity(const IInternalScene::Ptr& scene) override;
64 };
65
66 SCENE_END_NAMESPACE()
67
68 #endif