NWengine 0.9
Loading...
Searching...
No Matches
Renderer.h
1#pragma once
2#include "GameObject.h"
3#include "Script.h"
4#include "Maths.h"
5#include "Camera.h"
6
10class Renderer {
11public:
15 Renderer() = default;
16
21 Renderer(const std::string& shaderPath);
22
26 ~Renderer();
27
32
36 Camera* target = nullptr;
37
41 fVec2 stretchCoeff = fVec2(1.0f, 1.0f);
42
49 Renderer* operator()(Renderer* renderer, bool captureOnDefaultFrame = 0);
50
56 Renderer* operator()(bool captureOnDefaultFrame = 0);
57
61 void DrawOnDefaultFrame();
62
66 void CaptureOnCamFrame();
67
71 void Use();
72
77 void Unuse();
78
83 void SetShader(const std::string& shaderPath);
84
88 void SetUp();
89
93 static void Init();
94
98 static void Destroy();
99
104
109
114 inline static std::string GetType() { return "Renderer"; }
115};
Defines the GameObject class and its related components.
The Camera class represents a camera in the game world.
Definition Camera.h:9
Class representing a game object.
Definition GameObject.h:68
The Renderer class is responsible for rendering GameObjects using a specified shader.
Definition Renderer.h:10
void Unuse()
Sets the default renderer as the current renderer. The default renderer is managed by the Core fronte...
Definition Renderer.cpp:28
static void Destroy()
Destroys the default renderer.
Definition Renderer.cpp:130
void DrawOnDefaultFrame()
Draws on the default framebuffer.
Definition Renderer.cpp:32
void SetShader(const std::string &shaderPath)
Sets the shader for this renderer.
Definition Renderer.cpp:20
void CaptureOnCamFrame()
Captures on the camera framebuffer.
Definition Renderer.cpp:63
Renderer()=default
Default constructor for the Renderer class.
Camera * target
The target camera for rendering.
Definition Renderer.h:36
void Use()
Sets this renderer as the current renderer.
Definition Renderer.cpp:24
Renderer * operator()(Renderer *renderer, bool captureOnDefaultFrame=0)
Operator overload for adding a renderer as a decorator.
Definition Renderer.cpp:102
static Renderer * currentRenderer
The current renderer.
Definition Renderer.h:108
static void Init()
Initializes the default renderer.
Definition Renderer.cpp:124
Renderer(const std::string &shaderPath)
Constructor for the Renderer class that takes a shader path as input.
void SetUp()
Adds components to the componentContainer.
Definition Renderer.cpp:12
static Renderer * defaultRenderer
The default renderer.
Definition Renderer.h:103
static std::string GetType()
Gets the type of the Renderer class.
Definition Renderer.h:114
GameObject componentContainer
The container for the GameObject components.
Definition Renderer.h:31
fVec2 stretchCoeff
The stretch coefficients for rendering.
Definition Renderer.h:41
~Renderer()
Destructor for the Renderer class.
Definition Renderer.cpp:97