Cogs.Core
TexAtlasRenderer.h
1#pragma once
2#include "Renderer/IRenderer.h"
3#include "Resources/MaterialInstance.h"
4
5namespace Cogs::Core {
6
7 struct TexAtlasSystem;
8
10 {
11 explicit TexAtlasRenderer(TexAtlasSystem* texAtlasSystem) : texAtlasSystem(texAtlasSystem) {}
12 ~TexAtlasRenderer() override;
13
14 void initialize(Context* context, IGraphicsDevice* device) override;
15 void handleEvent(uint32_t eventId, const DrawContext* renderingContext) override;
16 void generateCommands(const RenderTaskContext* renderingContext, RenderList* renderList) override;
17
18 // Polls atlasBlit effect readiness, lazily performing reflection-dependent binding setup
19 // on the Pending/Error -> Ready transition. Returns true once the effect (if any is used
20 // on this device type) is ready to be used for drawing.
21 bool isReady();
22
23 TexAtlasSystem* texAtlasSystem = nullptr;
24
25 struct {
26 MeshStreamsLayout streamsLayout;
28 Cogs::BufferHandle paramBuffer;
29 } fullScreenTriangle;
30
31 // WebGL on VR headsets have an issue with copy/blits from texture arrays, so we use shader instead
32 struct {
39
45 } atlasBlit;
46
47
48 glm::vec4 frustumCorners[8];
49 bool renderFrustum = false;
50
51 MeshStreamsLayout wireStreamsLayout;
52 MaterialHandle debugMaterial;
53 MaterialInstanceHandle debugMaterialNoneInstance;
54 MaterialInstanceHandle debugMaterialEvalInstance;
55
56 Cogs::IGraphicsDevice* device = nullptr;
57 Cogs::VertexBufferHandle wireBoxVertices;
58 Cogs::IndexBufferHandle wireBoxIndices;
59 Cogs::BufferHandle wireBoxConstants;
60 uint32_t wireBoxIndexStride = 0;
61 uint32_t wireBoxIndexCount = 0;
62
63 };
64
65}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Defines an extension to the renderer, capable of doing custom rendering.
Definition: IRenderer.h:123
Represents a graphics device used to manage graphics resources and issue drawing commands.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
ResourceStatus
Status of an asynchronously loaded resource, such as an effect or a pipeline.
Definition: Common.h:198
@ Pending
The resource is still loading.
void handleEvent(uint32_t eventId, const DrawContext *renderingContext) override
Called when rendering events occur.
void initialize(Context *context, IGraphicsDevice *device) override
Initialize the extension using the given context and device.
static const Handle_t NoHandle
Represents a handle to nothing.
Definition: Common.h:78