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;
84 class RenderPipelineManager* getPipelineManager() {
return pipelineManager.get(); }
85 RenderTaskContext & getRenderContext() {
return renderContext; }
90 void updateSettings();
91 void updateEffectFlags();
93 void emitEvent(uint32_t eventId,
const DrawContext* renderingContext);
96 Context* context =
nullptr;
97 IGraphicsDevice* device =
nullptr;
98 RenderSettings settings;
100 EngineBuffers engineBuffers = {};
101 RenderStates renderStates;
102 struct RenderTarget* defaultTarget =
nullptr;
103 EffectCache effectCache;
106 RenderResources resources;
107 EnginePermutations enginePermutations;
108 EffectBindings effectBindings;
109 std::unique_ptr<struct Renderers> renderers;
110 std::unique_ptr<class RenderPipelineManager> pipelineManager;
112 ActiveLights activeLights;
114 unsigned maxLights =
static_cast<unsigned>(kMaxLights);
115 glm::vec4 backgroundColor;
116 std::vector<IRendererExtension*> extensions;
118 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.