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 API_3D_ECS_SYSTEMS_IRENDER_SYSTEM_H
17 #define API_3D_ECS_SYSTEMS_IRENDER_SYSTEM_H
18 
19 #include <base/containers/string.h>
20 #include <base/containers/string_view.h>
21 #include <core/ecs/intf_system.h>
22 #include <core/namespace.h>
23 #include <render/resource_handle.h>
24 
25 RENDER_BEGIN_NAMESPACE()
26 class IRenderDataStoreManager;
27 RENDER_END_NAMESPACE()
28 
CORE3D_BEGIN_NAMESPACE()29 CORE3D_BEGIN_NAMESPACE()
30 /** @ingroup group_ecs_systems_irender */
31 /** IRender system */
32 class IRenderSystem : public CORE_NS::ISystem {
33 public:
34     static constexpr BASE_NS::Uid UID { "33ebc109-0687-48b4-8002-f129c1d800fc" };
35     /** Rendering related data stores to feed data to renderer.
36      */
37     struct Properties {
38         // NOTE: These all should be DEPRECATED
39 
40         /** Data store for scene */
41         BASE_NS::string dataStoreScene;
42         /** Data store for camera */
43         BASE_NS::string dataStoreCamera;
44         /** Data store for light */
45         BASE_NS::string dataStoreLight;
46         /** Data store for material */
47         BASE_NS::string dataStoreMaterial;
48         /** Data store for morphing (passed to rendering) */
49         BASE_NS::string dataStoreMorph;
50 
51         /** Data store prefix for other data stores in e.g. different plugins */
52         BASE_NS::string dataStorePrefix;
53     };
54 
55     /** Get render node graphs for this ECS render system.
56      * There are render node graphs for scene and active cameras.
57      * Flags needs to be set-up properly to process / create the render node graphs.
58      * @return Array view to all render node graphs.
59      */
60     virtual BASE_NS::array_view<const RENDER_NS::RenderHandleReference> GetRenderNodeGraphs() const = 0;
61 
62 protected:
63     IRenderSystem() = default;
64     ~IRenderSystem() override = default;
65     IRenderSystem(const IRenderSystem&) = delete;
66     IRenderSystem(IRenderSystem&&) = delete;
67     IRenderSystem& operator=(const IRenderSystem&) = delete;
68     IRenderSystem& operator=(IRenderSystem&&) = delete;
69 };
70 
71 /** @ingroup group_ecs_systems_irender */
72 /** Return name of this system
73  */
GetName(const IRenderSystem *)74 inline constexpr BASE_NS::string_view GetName(const IRenderSystem*)
75 {
76     return "RenderSystem";
77 }
78 CORE3D_END_NAMESPACE()
79 
80 #endif // API_3D_ECS_SYSTEMS_IRENDER_SYSTEM_H
81