Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Muto::Renderer Class Reference

The main renderer class responsible for managing rendering operations. More...

#include <Renderer.h>

Classes

struct  SceneData
 Scene data structure containing view-projection matrix. More...
 

Static Public Member Functions

static void BeginScene (OrthographicCamera &camera)
 Begins a new scene with the given orthographic camera.
 
static void EndScene ()
 Ends the current scene.
 
static RenderAPI::API GetAPI ()
 Retrieves the current rendering API.
 
static void Init ()
 Initializes the renderer.
 
static void OnWindowResize (uint32_t width, uint32_t height)
 Handles window resize events by resizing the viewport.
 
static void Submit (const Ref< Shader > &shader, const Ref< VertexArray > &vertexArray, const glm::mat4 &transform=glm::mat4(1.0f))
 Submits a draw call with the specified shader, vertex array, and transform.
 

Static Private Attributes

static SceneData * s_SceneData = new Renderer::SceneData
 Pointer to the current scene data.
 

Detailed Description

The main renderer class responsible for managing rendering operations.


Class Documentation

◆ Muto::Renderer::SceneData

struct Muto::Renderer::SceneData

Scene data structure containing view-projection matrix.

Class Members
mat4 ViewProjectionMatrix The combined view-projection matrix for the scene.

Member Function Documentation

◆ BeginScene()

void Muto::Renderer::BeginScene ( OrthographicCamera &  camera)
static

Begins a new scene with the given orthographic camera.

Parameters
cameraThe orthographic camera defining the view and projection for the scene.
Todo:
Support for other camera types.
31 {
33 s_SceneData->ViewProjectionMatrix = camera.GetViewProjectionMatrix();
34 }
#define MU_PROFILE_FUNCTION()
Definition Instrumentor.h:240
static SceneData * s_SceneData
Pointer to the current scene data.
Definition Renderer.h:54
glm::mat4 ViewProjectionMatrix
The combined view-projection matrix for the scene.
Definition Renderer.h:50

References s_SceneData.

◆ EndScene()

void Muto::Renderer::EndScene ( )
static

Ends the current scene.

Note
Currently does nothing as scene closure is automatic, but could be useful for a render interface
37 {
39
40 }

◆ GetAPI()

◆ Init()

void Muto::Renderer::Init ( )
static

Initializes the renderer.

Note
This initializes both the RenderCommand and Renderer2D systems.
17 {
19
22 }
static void Init()
Initializes the rendering API.
Definition RenderCommand.h:17
static void Init()
Initializes the 2D renderer.
Definition Renderer2D.cpp:65

References Muto::RenderCommand::Init(), and Muto::Renderer2D::Init().

Referenced by Muto::Application::Application(), and Muto::Application::Application().

◆ OnWindowResize()

void Muto::Renderer::OnWindowResize ( uint32_t  width,
uint32_t  height 
)
static

Handles window resize events by resizing the viewport.

25 {
28 }
static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Sets the viewport dimensions for the renderer.
Definition RenderCommand.h:23
constexpr Scope< T > CreateScope(Args &&... args)
Creates a Scope (unique_ptr) for the given type and constructor arguments.
Definition Defines_Macros.h:51

References Muto::RenderCommand::SetViewport().

Referenced by Muto::Application::OnWindowResize().

◆ Submit()

void Muto::Renderer::Submit ( const Ref< Shader > &  shader,
const Ref< VertexArray > &  vertexArray,
const glm::mat4 &  transform = glm::mat4(1.0f) 
)
static

Submits a draw call with the specified shader, vertex array, and transform.

Parameters
shaderThe shader to use for rendering.
vertexArrayThe vertex array to draw.
transformThe transformation matrix to apply.
Todo:
Set up a command list to encapsulate this for draw order control
43 {
45 shader->Bind();
46 shader->SetMat4("u_ViewProjection", s_SceneData->ViewProjectionMatrix);
47 shader->SetMat4("u_Transform", transform);
48
49 vertexArray->Bind();
51 }
static void DrawIndexed(const Ref< VertexArray > &vertexArray, uint32_t indexCount=0)
Draws indexed geometry using the specified vertex array and index count.
Definition RenderCommand.h:41

References s_SceneData.

Member Data Documentation

◆ s_SceneData

Renderer::SceneData * Muto::Renderer::s_SceneData = new Renderer::SceneData
staticprivate

Pointer to the current scene data.

Referenced by BeginScene(), and Submit().


The documentation for this class was generated from the following files: