Cogs.Core
Extensions
TexAtlas
Source
TexAtlasRenderer.h
1
#pragma once
2
#include "Renderer/IRenderer.h"
3
#include "Resources/MaterialInstance.h"
4
5
namespace
Cogs::Core
{
6
7
struct
TexAtlasSystem;
8
9
struct
TexAtlasRenderer
:
public
IRendererExtension
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;
27
Cogs::VertexBufferHandle
vertices;
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
{
33
Cogs::EffectHandle
effect =
Cogs::EffectHandle::NoHandle
;
34
Cogs::ResourceStatus
effectStatus =
Cogs::ResourceStatus::Pending
;
35
Cogs::InputLayoutHandle
inputLayout =
Cogs::InputLayoutHandle::NoHandle
;
36
Cogs::TextureBindingHandle
srcTexBinding =
Cogs::TextureBindingHandle::NoHandle
;
37
Cogs::SamplerStateBindingHandle
srcSamplerBinding =
Cogs::SamplerStateBindingHandle::NoHandle
;
38
Cogs::ConstantBufferBindingHandle
paramBinding =
Cogs::ConstantBufferBindingHandle::NoHandle
;
39
40
Cogs::BufferHandle
paramBuffer =
Cogs::BufferHandle::NoHandle
;
41
Cogs::SamplerStateHandle
samplerState =
Cogs::SamplerStateHandle::NoHandle
;
42
Cogs::TextureHandle
sourceTexture =
Cogs::TextureHandle::NoHandle
;
43
Cogs::DepthStencilStateHandle
depthStencilState =
Cogs::DepthStencilStateHandle::NoHandle
;
44
Cogs::BlendStateHandle
blendState =
Cogs::BlendStateHandle::NoHandle
;
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
}
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::IRendererExtension
Defines an extension to the renderer, capable of doing custom rendering.
Definition:
IRenderer.h:123
Cogs::IGraphicsDevice
Represents a graphics device used to manage graphics resources and issue drawing commands.
Definition:
IGraphicsDevice.h:196
Cogs::Core
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Definition:
ComponentFunctions.h:10
Cogs::ResourceStatus
ResourceStatus
Status of an asynchronously loaded resource, such as an effect or a pipeline.
Definition:
Common.h:198
Cogs::ResourceStatus::Pending
@ Pending
The resource is still loading.
Cogs::Core::DrawContext
Definition:
RenderStateUpdater.h:21
Cogs::Core::MeshStreamsLayout
Definition:
MeshStreamsLayout.h:12
Cogs::Core::RenderList
Definition:
RenderList.h:301
Cogs::Core::RenderTaskContext
Definition:
RenderTask.h:53
Cogs::Core::ResourceHandle_t< Material >
Cogs::Core::TexAtlasRenderer
Definition:
TexAtlasRenderer.h:10
Cogs::Core::TexAtlasRenderer::handleEvent
void handleEvent(uint32_t eventId, const DrawContext *renderingContext) override
Called when rendering events occur.
Definition:
TexAtlasRenderer.cpp:489
Cogs::Core::TexAtlasRenderer::initialize
void initialize(Context *context, IGraphicsDevice *device) override
Initialize the extension using the given context and device.
Definition:
TexAtlasRenderer.cpp:393
Cogs::Core::TexAtlasSystem
Definition:
TexAtlasSystem.h:203
Cogs::Handle_t< BufferTag, BufferHandle >
Cogs::Handle_t< EffectTag >::NoHandle
static const Handle_t NoHandle
Represents a handle to nothing.
Definition:
Common.h:78
Generated by
1.9.6