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 using Super = IntroduceInterfaces;
28 META_IMPLEMENT_OBJECT_TYPE_INTERFACE(ClassId::LightNode)
29 META_DEFINE_OBJECT_TYPE_INFO(LightNode, ClassId::LightNode)
30
31 public:
32 SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Color, Color, "LightComponent")
33 SCENE_USE_COMPONENT_PROPERTY(float, Intensity, "LightComponent")
34 SCENE_USE_COMPONENT_PROPERTY(float, NearPlane, "LightComponent")
35 SCENE_USE_COMPONENT_PROPERTY(bool, ShadowEnabled, "LightComponent")
36 SCENE_USE_COMPONENT_PROPERTY(float, ShadowStrength, "LightComponent")
37 SCENE_USE_COMPONENT_PROPERTY(float, ShadowDepthBias, "LightComponent")
38 SCENE_USE_COMPONENT_PROPERTY(float, ShadowNormalBias, "LightComponent")
39 SCENE_USE_COMPONENT_PROPERTY(float, SpotInnerAngle, "LightComponent")
40 SCENE_USE_COMPONENT_PROPERTY(float, SpotOuterAngle, "LightComponent")
41 SCENE_USE_COMPONENT_PROPERTY(LightType, Type, "LightComponent")
42 SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Math::Vec4, AdditionalFactor, "LightComponent")
43 SCENE_USE_COMPONENT_PROPERTY(uint64_t, LightLayerMask, "LightComponent")
44 SCENE_USE_COMPONENT_PROPERTY(uint64_t, ShadowLayerMask, "LightComponent")
45
46 bool SetEcsObject(const IEcsObject::Ptr&) override;
47
48 public:
49 CORE_NS::Entity CreateEntity(const IInternalScene::Ptr& scene) override;
50 };
51
52 SCENE_END_NAMESPACE()
53
54 #endif