• 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_SRC_NODE_NODE_H
17 #define SCENE_SRC_NODE_NODE_H
18 
19 #include <scene/ext/component_fwd.h>
20 #include <scene/ext/intf_ecs_object_access.h>
21 #include <scene/interface/intf_node.h>
22 #include <scene/interface/intf_node_import.h>
23 #include <scene/interface/intf_scene.h>
24 
25 #include <meta/ext/implementation_macros.h>
26 #include <meta/ext/object.h>
27 
SCENE_BEGIN_NAMESPACE()28 SCENE_BEGIN_NAMESPACE()
29 
30 class Node : public META_NS::IntroduceInterfaces<META_NS::MetaObject, INode, INodeImport, IEcsObjectAccess> {
31     META_OBJECT(Node, SCENE_NS::ClassId::Node, IntroduceInterfaces)
32 
33 public:
34     SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Math::Vec3, Position, "TransformComponent")
35     SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Math::Vec3, Scale, "TransformComponent")
36     SCENE_USE_COMPONENT_PROPERTY(BASE_NS::Math::Quat, Rotation, "TransformComponent")
37     SCENE_USE_COMPONENT_PROPERTY(bool, Enabled, "NodeComponent")
38 
39     Future<BASE_NS::string> GetPath() const override;
40     Future<INode::Ptr> GetParent() const override;
41     Future<BASE_NS::vector<INode::Ptr>> GetChildren() const override;
42     Future<bool> RemoveChild(const INode::Ptr&) override;
43     Future<bool> AddChild(const INode::Ptr& child, size_t index = -1) override;
44     Future<bool> SetName(const BASE_NS::string&) override;
45 
46     Future<INode::Ptr> ImportChild(const INode::ConstPtr& node) override;
47     Future<INode::Ptr> ImportChildScene(const IScene::ConstPtr& scene, const BASE_NS::string& nodeName) override;
48 
49 public:
50     bool Build(const META_NS::IMetadata::Ptr&) override;
51     BASE_NS::string GetName() const override;
52     bool SetEcsObject(const IEcsObject::Ptr&) override;
53     IEcsObject::Ptr GetEcsObject() const override;
54 
55     IScene::Ptr GetScene() const override;
56 
57 protected:
58     IEcsObject::Ptr object_;
59 };
60 
61 SCENE_END_NAMESPACE()
62 
63 #endif