matf-rg-engine 1.0.0
Base for project for the Computer Graphics course at Faculty of Mathematics, University of Belgrade
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
engine::graphics::GraphicsController Class Referencefinal

Implements basic drawing methods that the core::App implementation uses. More...

#include <GraphicsController.hpp>

Inheritance diagram for engine::graphics::GraphicsController:
Inheritance graph
[legend]
Collaboration diagram for engine::graphics::GraphicsController:
Collaboration graph
[legend]

Public Member Functions

std::string_view name () const override
 
void begin_gui ()
 Calls internal methods for the beginning of gui drawing. Should be called in pair with GraphicsController::end_gui.
 
void end_gui ()
 Calls internal method for the ending of gui drawing. Should be called in pair with GraphicsController::begin_gui.
 
void draw_skybox (const resources::Shader *shader, const resources::Skybox *skybox)
 Draws a resources::Skybox with the resources::Shader.
 
Cameracamera ()
 
template<ProjectionType type = Perspective>
glm::mat4 projection_matrix () const
 Compute the projection matrix.
 
glm::mat4 projection_matrix (ProjectionType type=Perspective) const
 Compute the projection matrix.
 
PerspectiveMatrixParamsperspective_params ()
 Use this function to change the perspective projection matrix parameters. Projection matrix is always computed when the GraphicsController::projection_matrix is called.
 
const PerspectiveMatrixParamsperspective_params () const
 Get the current PerspectiveMatrixParams values.
 
OrthographicMatrixParamsorthographic_params ()
 Use this function to change the orthographic projection matrix parameters. Projection matrix is always computed when GraphicsController::projection_matrix is called.
 
const OrthographicMatrixParamsorthographic_params () const
 Get the current OrthographicMatrixParams values.
 
- Public Member Functions inherited from engine::core::Controller
virtual ~Controller ()=default
 
void before (Controller *next)
 
void after (Controller *prev)
 
const std::vector< Controller * > & next () const
 
bool is_enabled () const
 Controller will execute as long this function returns true.
 
void set_enable (bool value)
 Enables or disables the controller based on value. The ControllerManager executes only the enabled controllers, except for the Controller::poll_events function, that's executed always. By default, controllers are enabled when registered.
 

Private Member Functions

void initialize () override
 Initializes OpenGL, ImGUI, and projection matrix params;.
 
void terminate ()
 Terminate the controller. Executes in the core::App::terminate.
 

Private Attributes

PerspectiveMatrixParams m_perspective_params {}
 
OrthographicMatrixParams m_ortho_params {}
 
glm::mat4 m_projection_matrix {}
 
Camera m_camera {}
 
ImGuiContextm_imgui_context {}
 

Additional Inherited Members

- Static Public Member Functions inherited from engine::core::Controller
template<typename TController >
static TControllerget (std::source_location location=std::source_location::current())
 Serves as a single access point for all the Controller types throughout the code base. Make sure to register the controller via App::register_controller before calling this function.
 

Detailed Description

Implements basic drawing methods that the core::App implementation uses.

This class should implement all the complex functions needed for drawing an entity in the scene. For example GraphicsController::draw_skybox.

Member Function Documentation

◆ name()

std::string_view engine::graphics::GraphicsController::name ( ) const
overridevirtual

Returns the controller class name; used for logging.

Returns
Controller name

Reimplemented from engine::core::Controller.

◆ begin_gui()

void engine::graphics::GraphicsController::begin_gui ( )

Calls internal methods for the beginning of gui drawing. Should be called in pair with GraphicsController::end_gui.

Example:

graphics->begin_gui();
ImGui::Begin("Camera info");
const auto &c = ...;
ImGui::Text("Camera position: (%f, %f, %f)", c.Position.x, c.Position.y, c.Position.z);
ImGui::Text("(Yaw, Pitch): (%f, %f)", c.Yaw, c.Pitch);
ImGui::Text("Camera front: (%f, %f, %f)", c.Front.x, c.Front.y, c.Front.z);
ImGui::End();
graphics->end_gui();
static TController * create_if_absent()
Definition Controller.hpp:179

◆ end_gui()

void engine::graphics::GraphicsController::end_gui ( )

Calls internal method for the ending of gui drawing. Should be called in pair with GraphicsController::begin_gui.

◆ draw_skybox()

void engine::graphics::GraphicsController::draw_skybox ( const resources::Shader shader,
const resources::Skybox skybox 
)

◆ camera()

Camera * engine::graphics::GraphicsController::camera ( )
inline

◆ projection_matrix() [1/2]

template<ProjectionType type = Perspective>
glm::mat4 engine::graphics::GraphicsController::projection_matrix ( ) const
inline

Compute the projection matrix.

Returns
Return perspective projection by default.

◆ projection_matrix() [2/2]

glm::mat4 engine::graphics::GraphicsController::projection_matrix ( ProjectionType  type = Perspective) const
inline

Compute the projection matrix.

Returns
Return perspective projection by default.

◆ perspective_params() [1/2]

PerspectiveMatrixParams & engine::graphics::GraphicsController::perspective_params ( )
inline

Use this function to change the perspective projection matrix parameters. Projection matrix is always computed when the GraphicsController::projection_matrix is called.

Returns
PerspectiveMatrixParams

◆ perspective_params() [2/2]

const PerspectiveMatrixParams & engine::graphics::GraphicsController::perspective_params ( ) const
inline

Get the current PerspectiveMatrixParams values.

Returns
PerspectiveMatrixParams

◆ orthographic_params() [1/2]

OrthographicMatrixParams & engine::graphics::GraphicsController::orthographic_params ( )
inline

Use this function to change the orthographic projection matrix parameters. Projection matrix is always computed when GraphicsController::projection_matrix is called.

Returns
PerspectiveMatrixParams

◆ orthographic_params() [2/2]

const OrthographicMatrixParams & engine::graphics::GraphicsController::orthographic_params ( ) const
inline

Get the current OrthographicMatrixParams values.

Returns
PerspectiveMatrixParams

◆ initialize()

void engine::graphics::GraphicsController::initialize ( )
overrideprivatevirtual

Initializes OpenGL, ImGUI, and projection matrix params;.

Reimplemented from engine::core::Controller.

◆ terminate()

void engine::graphics::GraphicsController::terminate ( )
privatevirtual

Terminate the controller. Executes in the core::App::terminate.

Note that the terminate executes in the reverse order from initialize.

Reimplemented from engine::core::Controller.

Member Data Documentation

◆ m_perspective_params

PerspectiveMatrixParams engine::graphics::GraphicsController::m_perspective_params {}
private

◆ m_ortho_params

OrthographicMatrixParams engine::graphics::GraphicsController::m_ortho_params {}
private

◆ m_projection_matrix

glm::mat4 engine::graphics::GraphicsController::m_projection_matrix {}
private

◆ m_camera

Camera engine::graphics::GraphicsController::m_camera {}
private

◆ m_imgui_context

ImGuiContext* engine::graphics::GraphicsController::m_imgui_context {}
private

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