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 CORE__RENDER__NODE__RENDER_NODE_DEFAULT_LIGHTS_H
17 #define CORE__RENDER__NODE__RENDER_NODE_DEFAULT_LIGHTS_H
18 
19 #include <base/util/uid.h>
20 #include <core/namespace.h>
21 #include <render/nodecontext/intf_render_node.h>
22 #include <render/resource_handle.h>
23 
24 #include "render/render_node_scene_util.h"
25 
CORE3D_BEGIN_NAMESPACE()26 CORE3D_BEGIN_NAMESPACE()
27 class RenderNodeDefaultLights final : public RENDER_NS::IRenderNode {
28 public:
29     RenderNodeDefaultLights() = default;
30     ~RenderNodeDefaultLights() override = default;
31 
32     void InitNode(RENDER_NS::IRenderNodeContextManager& renderNodeContextMgr) override;
33     void PreExecuteFrame() override;
34     void ExecuteFrame(RENDER_NS::IRenderCommandList& cmdList) override;
35     ExecuteFlags GetExecuteFlags() const override
36     {
37         // expect to have lights or need to reset GPU data
38         return 0U;
39     }
40 
41     // for plugin / factory interface
42     static constexpr BASE_NS::Uid UID { "8757af6a-adde-471f-b475-8f8c0962d8b6" };
43     static constexpr char const* const TYPE_NAME = "RenderNodeDefaultLights";
44     static constexpr IRenderNode::BackendFlags BACKEND_FLAGS = IRenderNode::BackendFlagBits::BACKEND_FLAG_BITS_DEFAULT;
45     static constexpr IRenderNode::ClassType CLASS_TYPE = IRenderNode::ClassType::CLASS_TYPE_NODE;
46     static IRenderNode* Create();
47     static void Destroy(IRenderNode* instance);
48 
49 private:
50     RENDER_NS::IRenderNodeContextManager* renderNodeContextMgr_ { nullptr };
51 
52     SceneRenderDataStores stores_;
53 
54     RENDER_NS::RenderHandleReference lightBufferHandle_;
55     RENDER_NS::RenderHandleReference lightClusterBufferHandle_;
56 };
57 CORE3D_END_NAMESPACE()
58 
59 #endif // CORE__RENDER__NODE__RENDER_NODE_DEFAULT_LIGHTS_H
60