Cogs.Core
GenerateListTask.h
1#pragma once
2#include <array>
3
4#include "Foundation/Memory/MemoryBuffer.h"
5#include "Rendering/Base.h"
6
7#include "RenderTask.h"
8
9#include "Renderer/RenderList.h"
10#include "Renderer/ParameterBuffers.h"
11
12#include "../../Components/Core/ClipShapeComponent.h"
13
14namespace Cogs::Core
15{
16 class Renderer;
17 class Context;
18
19 void COGSCORE_DLL_API getTransparencyState(RenderStates & renderStates, const MaterialInstance * materialInstance, RenderItem & renderItem);
20
22 {
23 bool isInUse() const { return stride != 0; }
24
27 uint32_t stride = 0;
28 uint32_t fill = 0;
29 uint32_t cpuCapacity = 0;
30 uint32_t gpuCapacity = 0;
31 };
32
34 {
35 struct Item {
36 std::array<glm::vec4, 6> clipEquations = {};
38 };
39
40 static constexpr size_t maxClipShapes = 8;
41 ComponentModel::ComponentHandle handles[maxClipShapes] = {};
42 Item data[maxClipShapes] = {};
43 size_t count = 1; // First clip shape is reserved for no clip shape
44
45 COGSCORE_DLL_API uint8_t getIndex(Context* context, ComponentModel::ComponentHandle clipShapeHandle);
46 };
47
49 {
50 void initialize(RenderTaskContext*)override;
51 void cleanup(RenderTaskContext*) override;
52 void apply(RenderTaskContext * context) override;
53
54 bool wireframe = false;
55
56 std::vector<std::unique_ptr<Geometry::BoundingBox>> bboxes; // temp bounding boxes for debug items.
57
58 ListObjectBuffer listObjectBuffer;
59 ClipShapeCache clipShapeCache;
60
61 private:
62
63 size_t generateItems(Context* context, RenderBatch& batch, Renderer* renderer, class RenderSystem* renderSystem, class MeshSystem* /*meshSystem*/);
64
65 struct RenderItem& createRenderItem(Context* context, struct RenderBatch& batch, const glm::mat4* localToWorld, const class RenderComponent* renderComponent);
66
67 };
68}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base component for all rendering content.
The mesh render system handles MeshRenderComponents.
Definition: RenderSystem.h:75
Core renderer system.
Definition: Renderer.h:29
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
ClipShapeType
Specifices what kind of shape a clip shape has.
@ None
No clipping at all.
Handle to a Component instance.
Definition: Component.h:67