Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
RenderQueue.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_RENDER_QUEUE_H_
34#define DVD_RENDER_QUEUE_H_
35
36#include "RenderBin.h"
39
40namespace Divide {
41
42class SceneNode;
43struct RenderSubPassCmd;
44
47
49class RenderQueue final : public KernelComponent {
50 public:
52
58 bool _filterByBinType = false;
59 };
60
61 public:
62 explicit RenderQueue(Kernel& parent, RenderStage stage);
63
64 void populateRenderQueues(const PopulateQueueParams& params, RenderQueuePackages& queueInOut);
65
66 void postRender(const SceneRenderState& renderState, RenderStagePass stagePass, GFX::CommandBuffer& bufferInOut);
67 void sort(RenderStagePass stagePass, RenderBinType targetBinType = RenderBinType::COUNT, RenderingOrder renderOrder = RenderingOrder::COUNT);
68 void clear(RenderBinType targetBinType = RenderBinType::COUNT) noexcept;
69 void addNodeToQueue(const SceneGraphNode* sgn, RenderStagePass stagePass, F32 minDistToCameraSq, RenderBinType targetBinType = RenderBinType::COUNT);
70
71 [[nodiscard]] const RenderBin& getBin(const RenderBinType rbType) const noexcept { return _renderBins[to_base(rbType)]; }
72 [[nodiscard]] RenderBinArray& getBins() noexcept { return _renderBins; }
73
74 size_t getSortedQueues(const vector<RenderBinType>& binTypes, RenderBin::SortedQueues& queuesOut) const;
75
76 private:
77
78 [[nodiscard]] RenderingOrder getSortOrder(RenderStagePass stagePass, RenderBinType rbType) const;
79
80 [[nodiscard]] FORCE_INLINE RenderBin& getBin(const RenderBinType rbType) noexcept { return _renderBins[to_base(rbType)]; }
81 [[nodiscard]] RenderBinType getBinForNode(const SceneGraphNode* node, Handle<Material> matInstance);
82
83 private:
86};
87
88} // namespace Divide
89
90#endif //DVD_RENDER_QUEUE_H_
#define FWD_DECLARE_MANAGED_CLASS(T)
#define FORCE_INLINE
Kernel & parent() noexcept
The kernel is the main system that connects all of our various systems: windows, gfx,...
Definition: Kernel.h:81
This class contains a list of "RenderBinItem"'s and stores them sorted depending on designation.
Definition: RenderBin.h:112
std::array< SortedQueue, to_base(RenderBinType::COUNT)> SortedQueues
Definition: RenderBin.h:116
This class manages all of the RenderBins and renders them in the correct order.
Definition: RenderQueue.h:49
RenderingOrder getSortOrder(RenderStagePass stagePass, RenderBinType rbType) const
Definition: RenderQueue.cpp:23
RenderBinArray _renderBins
Definition: RenderQueue.h:85
RenderBinType getBinForNode(const SceneGraphNode *node, Handle< Material > matInstance)
Definition: RenderQueue.cpp:61
void populateRenderQueues(const PopulateQueueParams &params, RenderQueuePackages &queueInOut)
void clear(RenderBinType targetBinType=RenderBinType::COUNT) noexcept
const RenderBin & getBin(const RenderBinType rbType) const noexcept
Definition: RenderQueue.h:71
void sort(RenderStagePass stagePass, RenderBinType targetBinType=RenderBinType::COUNT, RenderingOrder renderOrder=RenderingOrder::COUNT)
RenderBinArray & getBins() noexcept
Definition: RenderQueue.h:72
const RenderStage _stage
Definition: RenderQueue.h:84
FORCE_INLINE RenderBin & getBin(const RenderBinType rbType) noexcept
Definition: RenderQueue.h:80
void postRender(const SceneRenderState &renderState, RenderStagePass stagePass, GFX::CommandBuffer &bufferInOut)
std::array< RenderBin, to_base(RenderBinType::COUNT)> RenderBinArray
Definition: RenderQueue.h:51
size_t getSortedQueues(const vector< RenderBinType > &binTypes, RenderBin::SortedQueues &queuesOut) const
void addNodeToQueue(const SceneGraphNode *sgn, RenderStagePass stagePass, F32 minDistToCameraSq, RenderBinType targetBinType=RenderBinType::COUNT)
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
eastl::fixed_vector< RenderQueuePackage, Config::MAX_VISIBLE_NODES, false > RenderQueuePackages
Definition: RenderBin.h:109
RenderBinType
Definition: RenderBin.h:73
eastl::vector< Type > vector
Definition: Vector.h:42
RenderingOrder
Definition: RenderBin.h:63
constexpr auto to_base(const Type value) -> Type