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_RESOURCE_ENVIRONMENT_H
17 #define SCENE_SRC_RESOURCE_ENVIRONMENT_H
18
19 #include <scene/ext/intf_create_entity.h>
20 #include <scene/interface/intf_environment.h>
21 #include <scene/interface/resource/types.h>
22 #include <shared_mutex>
23
24 #include <meta/api/make_callback.h>
25 #include <meta/api/resource/derived_from_resource.h>
26 #include <meta/ext/implementation_macros.h>
27 #include <meta/ext/resource/resource.h>
28 #include <meta/interface/resource/intf_resource.h>
29
30 #include "component/environment_component.h"
31
SCENE_BEGIN_NAMESPACE()32 SCENE_BEGIN_NAMESPACE()
33
34 class Environment : public META_NS::IntroduceInterfaces<META_NS::DerivedFromResource, EnvironmentComponent,
35 META_NS::INamed, ICreateEntity, META_NS::Resource> {
36 META_OBJECT(Environment, SCENE_NS::ClassId::Environment, IntroduceInterfaces)
37 public:
38 Environment() : Super(ClassId::EnvironmentResourceTemplate) {}
39
40 META_BEGIN_STATIC_DATA()
41 META_STATIC_PROPERTY_DATA(META_NS::INamed, BASE_NS::string, Name)
42 META_END_STATIC_DATA()
43
44 META_IMPLEMENT_PROPERTY(BASE_NS::string, Name)
45
46 CORE_NS::Entity CreateEntity(const IInternalScene::Ptr& scene) override;
47
48 bool SetEcsObject(const IEcsObject::Ptr& obj) override;
49 BASE_NS::string GetName() const override;
50
51 CORE_NS::ResourceType GetResourceType() const override
52 {
53 return ClassId::EnvironmentResource.Id().ToUid();
54 }
55 };
56
57 SCENE_END_NAMESPACE()
58
59 #endif