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 "Rendering/IEffects.h"
13#include "../Context.h"
14#include "../ViewContext.h"
15#include "Tasks/RenderTask.h"
44 glm::vec2
getSize()
const override {
return context->getDefaultView()->getSize(); }
63 std::span<IRendererExtension*>
getExtensions()
override {
return extensions; }
78 COGSCORE_DLL_API
class ImguiRenderer* getGuiRenderer()
override;
85 class RenderPipelineManager* getPipelineManager() {
return pipelineManager.get(); }
86 RenderTaskContext & getRenderContext() {
return renderContext; }
91 void updateSettings();
92 void updateEffectFlags();
94 void emitEvent(uint32_t eventId,
const DrawContext* renderingContext);
97 Context* context =
nullptr;
98 IGraphicsDevice* device =
nullptr;
99 RenderSettings settings;
101 EngineBuffers engineBuffers = {};
102 RenderStates renderStates;
103 struct RenderTarget* defaultTarget =
nullptr;
104 EffectCache effectCache;
107 RenderResources resources;
108 EnginePermutations enginePermutations;
109 EffectBindings effectBindings;
110 std::unique_ptr<struct Renderers> renderers;
111 std::unique_ptr<class RenderPipelineManager> pipelineManager;
113 ActiveLights activeLights;
115 unsigned maxLights =
static_cast<unsigned>(kMaxLights);
116 glm::vec4 backgroundColor;
117 std::vector<IRendererExtension*> extensions;
119 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.
void endFrame(uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None) override
Signals the end of the current frame.
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.
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.
Render settings variables.
Screenshot render settings.
EEffectFlags
Effect source flags.