5#include "RenderResources.h"
6#include "RenderSettings.h"
7#include "RenderStates.h"
8#include "EffectCache.h"
9#include "EnginePermutations.h"
10#include "EffectBindings.h"
11#include "EngineBuffers.h"
12#include "EngineBindGroups.h"
13#include "Rendering/IEffects.h"
14#include "../Context.h"
15#include "../ViewContext.h"
16#include "Tasks/RenderTask.h"
45 glm::vec2
getSize()
const override {
return context->getDefaultView()->getSize(); }
64 std::span<IRendererExtension*>
getExtensions()
override {
return extensions; }
80 COGSCORE_DLL_API
class ImguiRenderer* getGuiRenderer()
override;
86 class RenderPipelineManager* getPipelineManager() {
return pipelineManager.get(); }
87 RenderTaskContext & getRenderContext() {
return renderContext; }
92 void updateSettings();
93 void updateEffectFlags();
95 void emitEvent(uint32_t eventId,
const DrawContext* renderingContext);
98 Context* context =
nullptr;
99 IGraphicsDevice* device =
nullptr;
100 RenderSettings settings;
102 EngineBuffers engineBuffers = {};
103 EngineBindGroups engineBindGroups = {};
104 RenderStates renderStates;
105 struct RenderTarget* defaultTarget =
nullptr;
106 EffectCache effectCache;
109 RenderResources resources;
110 EnginePermutations enginePermutations;
111 EffectBindings effectBindings;
112 std::unique_ptr<struct Renderers> renderers;
113 std::unique_ptr<class RenderPipelineManager> pipelineManager;
115 ActiveLights activeLights;
117 unsigned maxLights =
static_cast<unsigned>(kMaxLights);
118 glm::vec4 backgroundColor;
119 std::vector<IRendererExtension*> extensions;
121 RenderTaskContext renderContext;
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Interface to the render resources.
Defines an extension to the renderer, capable of doing custom rendering.
Renderer interface used by the engine to control registered renderer instances.
Contains render resources used by the renderer.
void updatePermutation(EnginePermutation *permutation) override
Updates the EnginePermutation.
ActiveLights & getActiveLights() override
Get the reference to the ActiveLights structure.
float getNearDepth() override
Get adjusted near plane depth.
EngineBuffers & getEngineBuffers() override
Get the reference to the EngineBuffers structure.
void setMode(RenderMode mode) override
Set the rendering mode the renderer should use.
RenderStates & getRenderStates() override
Get the reference to the RenderStates structure.
EffectBindings & getEffectBindings() override
Get the reference to the EffectBindings structure.
IRenderResources * getResources() override
Get the render resources interface.
IGraphicsDevice * getDevice() override
Get the graphics device used by the renderer.
void registerExtension(IRendererExtension *extension) override
Registers the given extension with the renderer. Doesn not take ownership of pointer.
void setBackgroundColor(const glm::vec4 &backgroundColor) override
Set the background color applied to the output surface before rendering.
RenderMode getMode() const override
Get the Rendering mode used by the renderer.
const RenderSettings & getSettings() const override
Get the settings of the renderer.
EffectFlags::EEffectFlags getEffectFlags() const override
Get the EffectFlags.
void renderScreenshot(const ScreenshotSettings &settings, std::vector< uint8_t > &bytes, uint32_t *stride=nullptr) override
Render screenshot.
glm::mat4 getViewFromViewportMatrix(glm::mat4 inverseProjectionMatrix) override
Get an adjusted inverse projection matrix mainly used in post processing.
void emitEvent(uint32_t eventId, const DrawContext *renderingContext)
Emits the given render event to all registered extensions.
void endFrame(uint32_t syncInterval=0, Cogs::PresentFlags presentFlags=PresentFlags::None) override
Signals the end of the current frame.
glm::vec4 getBackgroundColor() const override
Get the reference to the background color.
EnginePermutations & getEnginePermutations() override
Get the reference to the EnginePermutations structure.
EffectCache & getEffectCache() override
Get the reference to the EffectCache structure.
glm::vec2 getSize() const override
Get the output surface size of the renderer.
void unregisterExtension(IRendererExtension *extension) override
Unregister an extension with the renderer.
void cleanup() override
Cleanup the renderer, releasing all resources held.
float getClearDepth() override
Get adjusted clear depth used to render.
std::span< IRendererExtension * > getExtensions() override
Get the list of all extensions.
glm::mat4 getProjectionMatrix(const glm::mat4 projectionMatrix) override
Get an adjusted projection matrix used to render.
unsigned getMaxLights() const override
Get the maximum number of lights.
void render() override
Kick off the actual rendering, allowing the renderer to produce its output.
void beginFrame() override
Signals the beginning of a new frame.
Represents a graphics device used to manage graphics resources and issue drawing commands.
RenderMode
Defines global rendering modes that can be supported by the renderer.
@ Normal
Regular shaded rendering.
Contains all Cogs related functionality.
PresentFlags
Flags controlling presentation.
Render settings variables.
Screenshot render settings.
EEffectFlags
Effect source flags.