• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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         /** Data store manager */
39         RENDER_NS::IRenderDataStoreManager* dataStoreManager { nullptr };
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 
52     /** Get render node graphs for this ECS render system.
53      * There are render node graphs for scene and active cameras.
54      * Flags needs to be set-up properly to process / create the render node graphs.
55      * @return Array view to all render node graphs.
56      */
57     virtual BASE_NS::array_view<const RENDER_NS::RenderHandleReference> GetRenderNodeGraphs() const = 0;
58 
59 protected:
60     IRenderSystem() = default;
61     ~IRenderSystem() override = default;
62     IRenderSystem(const IRenderSystem&) = delete;
63     IRenderSystem(IRenderSystem&&) = delete;
64     IRenderSystem& operator=(const IRenderSystem&) = delete;
65     IRenderSystem& operator=(IRenderSystem&&) = delete;
66 };
67 
68 /** @ingroup group_ecs_systems_irender */
69 /** Return name of this system
70  */
GetName(const IRenderSystem *)71 inline constexpr BASE_NS::string_view GetName(const IRenderSystem*)
72 {
73     return "RenderSystem";
74 }
75 CORE3D_END_NAMESPACE()
76 
77 #endif // API_3D_ECS_SYSTEMS_IRENDER_SYSTEM_H
78