Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Vesper::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 Init ()
 Initializes the renderer.
static void OnWindowResize (uint32_t width, uint32_t height)
 Handles window resize events by resizing the viewport.
static void BeginScene (OrthographicCamera &camera)
 Begins a new scene with the given orthographic camera.
static void EndScene ()
 Ends the current scene.
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 RendererAPI::API GetAPI ()
 Retrieves the current rendering API.

Static Private Attributes

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

Detailed Description

The main renderer class responsible for managing rendering operations.


Class Documentation

◆ Vesper::Renderer::SceneData

struct Vesper::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 Vesper::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.
28 {
30 s_SceneData->ViewProjectionMatrix = camera.GetViewProjectionMatrix();
31 }
#define VZ_PROFILE_FUNCTION()
Definition Instrumentor.h:240
static SceneData * s_SceneData
Pointer to the current scene data.
Definition Renderer.h:50

References s_SceneData.

◆ EndScene()

void Vesper::Renderer::EndScene ( )
static

Ends the current scene.

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

◆ GetAPI()

◆ Init()

void Vesper::Renderer::Init ( )
static

Initializes the renderer.

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

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

Referenced by Vesper::Application::Application().

◆ OnWindowResize()

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

Handles window resize events by resizing the viewport.

22 {
24 RenderCommand::SetViewport(0, 0, width, height);
25 }
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:20

References Vesper::RenderCommand::SetViewport().

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

◆ Submit()

void Vesper::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
40 {
42 shader->Bind();
43 std::dynamic_pointer_cast<OpenGLShader>(shader)->UploadUniformMat4("u_ViewProjection", s_SceneData->ViewProjectionMatrix);
44 std::dynamic_pointer_cast<OpenGLShader>(shader)->UploadUniformMat4("u_Transform", transform);
45
46 vertexArray->Bind();
47 RenderCommand::DrawIndexed(vertexArray);
48 }
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:38

References s_SceneData.

Member Data Documentation

◆ s_SceneData

Renderer::SceneData * Vesper::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: