18#ifndef FOOLSENGINE_RENDERSYSTEM_H
19#define FOOLSENGINE_RENDERSYSTEM_H
37 using RenderSetID = uint32_t;
82 void setRenderProperties(glm::u16vec2 renderDimensions, glm::u16vec2 targetDimensions,
const SDL_Rect& viewportDimensions,
RenderType renderType);
284 class LightQueue:
public System<LightQueue, std::tuple<>, std::tuple<Transform, LightEmissionData>>{
327 class OpaqueQueue:
public System<OpaqueQueue, std::tuple<>, std::tuple<Transform, std::shared_ptr<StaticModel>>> {
359 void execute(
float simulationProgress);
379 void setSkybox(std::shared_ptr<Texture> skyboxTexture);
398 glm::u16vec2 renderDimensions,
399 glm::u16vec2 targetDimensions,
400 const SDL_Rect& viewportDimensions,
Contains headers for the system and structs used by the engine's camera system.
Represents a single render stage or a render step that applies to the default (window) framebuffer.
Definition render_stage.hpp:175
std::shared_ptr< StaticMesh > mSphereMesh
The light volume associated with each light object, scaled up or down according to its computed radiu...
Definition render_system.hpp:320
void enqueueTo(BaseRenderStage &renderStage, float simulationProgress)
Adds a light unit to be rendered by this render stage at the next render step.
Definition render_system.cpp:326
LightQueue(std::weak_ptr< ECSWorld > world)
Constructs a new LightQueue System.
Definition render_system.hpp:291
void onInitialize() override
Initializes objects related to this queue.
Definition render_system.cpp:25
static std::string getSystemTypeName()
Gets the system type string associated with this system.
Definition render_system.hpp:308
OpaqueQueue(std::weak_ptr< ECSWorld > world)
Constructs a new OpaqueQueue System.
Definition render_system.hpp:334
static std::string getSystemTypeName()
Gets the system type string associated with this System.
Definition render_system.hpp:351
void enqueueTo(BaseRenderStage &renderStage, float simulationProgress)
Adds opaque render units to a render stage to be rendered this frame.
Definition render_system.cpp:309
void copyAndResize()
Command which invokes the ResizeRenderStage of the currently active RenderSet's current screen textur...
Definition render_system.cpp:299
std::set< RenderSetID > mDeletedRenderSetIDs
IDs of render sets which existed before, which may be used again to name new RenderSets.
Definition render_system.hpp:530
void addOrAssignRenderSource(const std::string &name, std::shared_ptr< Texture > renderSource)
Adds a "render source" to the currently bound RenderSet.
Definition render_system.cpp:379
void setExposure(float exposure)
Sets the exposure value for the currently active render set.
Definition render_system.cpp:427
void setGamma(float gamma)
Sets the gamma value for the active RenderSet.
Definition render_system.cpp:404
void renderToScreen()
Renders the currently active screen texture (RenderSet::mCurrentScreenTexture) to the (global) screen...
Definition render_system.cpp:293
void deleteRenderSet(RenderSetID renderSet)
Deletes, removes resources of a render set created in this ECSWorld.
Definition render_system.cpp:267
std::map< RenderSetID, RenderSet > mRenderSets
A list of render sets that were created for this render system.
Definition render_system.hpp:519
float getExposure()
Gets the exposure value for the currently active render set.
Definition render_system.cpp:442
static std::string getSystemTypeName()
Gets the system type string associated with the RenderSystem.
Definition render_system.hpp:278
RenderSetID mActiveRenderSetID
The ID of the presently active RenderSet.
Definition render_system.hpp:525
std::shared_ptr< Texture > getCurrentScreenTexture()
Gets a handle to the currently active RenderSet's active screen texture.
Definition render_system.cpp:281
RenderSetID createRenderSet(glm::u16vec2 renderDimensions, glm::u16vec2 targetDimensions, const SDL_Rect &viewportDimensions, RenderSet::RenderType renderType=RenderSet::RenderType::BASIC_3D)
Creates a RenderSet based on parameters provided by its caller.
Definition render_system.cpp:149
GLuint mMatrixUniformBufferIndex
The ID for this system's uniform buffer object storing camera related matrices.
Definition render_system.hpp:544
void onInitialize() override
Initializes this render system.
Definition render_system.cpp:41
std::shared_ptr< Texture > mSkyboxTexture
Returns a handle to the background texture for the geometry in this scene.
Definition render_system.hpp:513
void updateCameraMatrices(float simulationProgress)
Uploads camera matrices to the GPU per the camera's current stage.
Definition render_system.cpp:125
void useRenderSet(RenderSetID renderSet)
Marks a particular RenderSet as active, i.e., its resources (cameras, textures) are used to render so...
Definition render_system.cpp:192
RenderSetID mNextRenderSetID
The highest number of RenderSets which were active at once during the running of this program.
Definition render_system.hpp:538
void setRenderProperties(glm::u16vec2 renderDimensions, glm::u16vec2 targetDimensions, const SDL_Rect &viewportDimensions, RenderSet::RenderType renderType)
Sets the render properties of the currently active RenderSet.
Definition render_system.cpp:197
GLuint mMatrixUniformBufferBinding
The ID for this system's uniform buffer binding point, where shader programs expect to find camera ma...
Definition render_system.hpp:550
void removeRenderSource(const std::string &name)
Removes a render source from this render set.
Definition render_system.cpp:388
void execute(float simulationProgress)
Runs through all the render stages in the render pipeline for this frame.
Definition render_system.cpp:69
std::shared_ptr< Texture > getSkybox() const
Gets a handle to the skybox texture used in this RenderSystem's ECSWorld.
Definition render_system.hpp:386
void setCamera(EntityID cameraEntity)
Sets a camera with a particular ID as the active camera for the currently active RenderSet.
Definition render_system.cpp:396
void renderNextTexture()
(Used in debug) Sets the next texture in the currently active RenderSet's screen texture list as that...
Definition render_system.cpp:273
void setSkybox(std::shared_ptr< Texture > skyboxTexture)
Sets (or nulls) the skybox texture currently being used as the background to this scene's geometry.
Definition render_system.cpp:346
RenderSystem(std::weak_ptr< ECSWorld > world)
Constructs a new RenderSystem belonging to a single ECSWorld.
Definition render_system.hpp:269
float getGamma()
Gets the gamma value associated with the current render set.
Definition render_system.cpp:419
This engine's representation of a single unrigged 3D model.
Definition model.hpp:54
A system template that disables systems with this form of declaration.
Definition ecs_world.hpp:1062
ToyMaker Engine's implementation of an ECS system.
std::uint64_t EntityID
A single unsigned integer used as a name for an entity managed by an ECS system.
Definition ecs_world.hpp:68
const RenderSetID kMaxRenderSetIDs
The total number of RenderSets, per ECSWorld, that can be created.
Definition render_system.hpp:44
Functions related to rendering materials.
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
A file containing render stage related classes, this engine's representation of a single "step" in a ...
Contains classes used to construct some common procedurally generated meshes and models.
Struct that encapsulates properties which define the (geometric) aspects of a scene camera.
Definition camera_system.hpp:51
A struct, used as a component, describing the emissive properties of the light it represents per the ...
Definition light.hpp:65
A collection of shaders, render configurations, cameras, and related framebuffers used by a viewport ...
Definition render_system.hpp:53
void setGamma(float gamma)
Sets the gamma value used for gamma correction in the tonemapping stage of the pipeline.
Definition render_system.cpp:408
void copyAndResize()
Uses the resize-stage to scale the rendered image up or down.
Definition render_system.cpp:303
std::shared_ptr< GeometryRenderStage > mGeometryRenderStage
Handle to this set's geometry render stage.
Definition render_system.hpp:182
void addOrAssignRenderSource(const std::string &name, std::shared_ptr< Texture > renderSource)
Adds a named render source, presumably intended for use by a render stage in this pipeline.
Definition render_system.cpp:383
void setExposure(float exposure)
Sets the exposure value responsible for determining the behaviour of tonemapping in the tonemapping-s...
Definition render_system.cpp:431
std::shared_ptr< ScreenRenderStage > mScreenRenderStage
Handle to this set's screen render stage.
Definition render_system.hpp:218
std::shared_ptr< ResizeRenderStage > mResizeRenderStage
Handle to this set's resize render stage.
Definition render_system.hpp:212
EntityID mActiveCamera
The ID of the entity treated as this render set's active camera.
Definition render_system.hpp:170
std::size_t mCurrentScreenTexture
The index of the current texture being treated as this object's texture target.
Definition render_system.hpp:158
float getGamma()
Gets the gamma value used in this set's tonemapping-stage.
Definition render_system.cpp:423
std::shared_ptr< BlurRenderStage > mBlurRenderStage
Handle to this set's blur render stage (used for bloom).
Definition render_system.hpp:194
std::vector< std::shared_ptr< Texture > > mScreenTextures
All the debug/screen textures produced by this target.
Definition render_system.hpp:164
float mExposure
This sets presently configured exposure value.
Definition render_system.hpp:248
RenderType
Enum listing the different rendering pipelines available.
Definition render_system.hpp:59
std::shared_ptr< Texture > getCurrentScreenTexture()
Returns the currently active debug render texture.
Definition render_system.cpp:285
void setRenderProperties(glm::u16vec2 renderDimensions, glm::u16vec2 targetDimensions, const SDL_Rect &viewportDimensions, RenderType renderType)
Sets the render properties for this render set.
Definition render_system.cpp:204
std::shared_ptr< LightingRenderStage > mLightingRenderStage
Handle to this set's lighting render stage.
Definition render_system.hpp:188
void setSkybox(std::shared_ptr< Texture > skyboxTexture)
Sets the texture of the skybox painted to the background of the current scene in the 3D pipeline.
std::shared_ptr< TonemappingRenderStage > mTonemappingRenderStage
Handle to this set's tonemapping and gamma render stage.
Definition render_system.hpp:200
void renderNextTexture()
Renders the next debug texture to the render system's final render target.
Definition render_system.cpp:276
RenderType mRenderType
An ID representing the type of pipeline used in this set.
Definition render_system.hpp:236
void removeRenderSource(const std::string &name)
Removes a named render source.
Definition render_system.cpp:392
float mGamma
This sets presently configured gamma correction value.
Definition render_system.hpp:242
std::shared_ptr< Material > mLightMaterialHandle
Storage for light-related settings.
Definition render_system.hpp:176
std::map< std::string, std::shared_ptr< Texture > > mRenderSources
Textures designated as sources for this render set.
Definition render_system.hpp:230
void setCamera(EntityID cameraEntity)
Sets the entity to be treated as this render set's active camera.
Definition render_system.cpp:400
std::shared_ptr< AdditionRenderStage > mAdditionRenderStage
Handle to this set's addition render stage.
Definition render_system.hpp:224
float getExposure()
Returns the value of exposure set on this render set.
Definition render_system.cpp:446
std::shared_ptr< SkyboxRenderStage > mSkyboxRenderStage
Handle to this set's skybox render stage.
Definition render_system.hpp:206
bool mRerendered
A marker for when the 3D pipeline or the addition pipeline has been rerendered, and a corresponding s...
Definition render_system.hpp:254