Skip to content

Commit

Permalink
fix(engine): move Viewport struct into BaseRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenatlas committed Sep 26, 2023
1 parent 376ba1d commit f43f4fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions engine/include/cubos/engine/renderer/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ namespace cubos::engine
/// @ingroup renderer-plugin
using Renderer = std::shared_ptr<BaseRenderer>;

/// @brief Struct which holds the viewport information for a camera, to be used for drawing.
/// @ingroup renderer-plugin
struct Viewport
{
glm::ivec2 position;
glm::ivec2 size;
};

/// @brief Interface which abstracts different rendering methods.
///
/// This abstraction allows us to, for example, switch between a raytracing and a deferred
Expand All @@ -61,6 +53,13 @@ namespace cubos::engine
class BaseRenderer
{
public:
/// @brief Struct which holds the viewport information for a camera, to be used for drawing.
struct Viewport
{
glm::ivec2 position;
glm::ivec2 size;
};

virtual ~BaseRenderer() = default;

/// @brief Constructs.
Expand Down
4 changes: 2 additions & 2 deletions engine/src/cubos/engine/renderer/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static void frameEnvironment(Write<RendererFrame> frame, Read<RendererEnvironmen
/// @param size Viewport size.
/// @param count How many cameras need to be fitted in to the given viewport.
/// @param viewport Output array where the viewports will be set.
static void splitViewport(glm::ivec2 position, glm::ivec2 size, int count, Viewport* viewports)
static void splitViewport(glm::ivec2 position, glm::ivec2 size, int count, BaseRenderer::Viewport* viewports)
{
if (count == 1)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ static void draw(Write<Renderer> renderer, Read<ActiveCameras> activeCameras, Wr
{
Camera cameras[4]{};
glm::mat4 views[4]{};
Viewport viewports[4]{};
BaseRenderer::Viewport viewports[4]{};

int cameraCount = 0;

Expand Down

0 comments on commit f43f4fc

Please sign in to comment.