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
11#include "../../Components/Core/ClipShapeComponent.h"
12
13namespace Cogs::Core
14{
15 class Renderer;
16 class Context;
17
18 void COGSCORE_DLL_API getTransparencyState(RenderStates & renderStates, const MaterialInstance * materialInstance, RenderItem & renderItem);
19
21 {
22 bool isInUse() const { return stride != 0; }
23
26 uint32_t stride = 0;
27 uint32_t fill = 0;
28 uint32_t cpuCapacity = 0;
29 uint32_t gpuCapacity = 0;
30 };
31
33 {
34 struct Item {
35 std::array<glm::vec4, 6> clipEquations = {};
37 };
38
39 static constexpr size_t maxClipShapes = 8;
40 ComponentModel::ComponentHandle handles[maxClipShapes] = {};
41 Item data[maxClipShapes] = {};
42 size_t count = 1; // First clip shape is reserved for no clip shape
43
44 COGSCORE_DLL_API uint8_t getIndex(Context* context, ComponentModel::ComponentHandle clipShapeHandle);
45 };
46
48 {
49 void initialize(RenderTaskContext*)override;
50 void cleanup(RenderTaskContext*) override;
51 void apply(RenderTaskContext * context) override;
52
53 bool wireframe = false;
54
55 std::vector<std::unique_ptr<Geometry::BoundingBox>> bboxes; // temp bounding boxes for debug items.
56
57 ListObjectBuffer listObjectBuffer;
58
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:28
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