6#ifndef MATF_RG_PROJECT_RESOURCES_CONTROLLER_HPP
7#define MATF_RG_PROJECT_RESOURCES_CONTROLLER_HPP
14#include <unordered_map>
23 std::string_view
name()
const override {
24 return "ResourcesController";
46 const std::filesystem::path &path =
"",
62 const std::filesystem::path &path =
""
70 Shader *
shader(
const std::string &
name,
const std::filesystem::path &path =
"");
101 std::unordered_map<std::string, std::unique_ptr<Model> >
m_models;
105 std::unordered_map<std::string, std::unique_ptr<Texture> >
m_textures;
109 std::unordered_map<std::string, std::unique_ptr<Skybox> >
m_sky_boxes;
113 std::unordered_map<std::string, std::unique_ptr<Shader> >
m_shaders;
Defines the Controller class that serves as the base class for all controllers in the engine.
Defines the Model class that serves as the interface for model rendering.
Defines the Shader class that serves as an abstraction over OpenGL shaders.
Defines the Skybox class that serves as the interface for skybox rendering.
Defines the Texture class that serves as an abstraction over OpenGL textures.
Controllers are a hook into the App main loop execution. By overriding virtual functions of this clas...
Definition Controller.hpp:42
static TController * create_if_absent()
Definition Controller.hpp:179
Represents a model object within the OpenGL context as an array of Mesh objects.
Definition Model.hpp:17
Manages app resources: Model, Texture, Shader, and Skybox.
Definition ResourcesController.hpp:21
std::unordered_map< std::string, std::unique_ptr< Skybox > > m_sky_boxes
A hashmap of all the loaded Skybox.
Definition ResourcesController.hpp:109
void load_skyboxes()
Loads all the skyboxes from the "resources/skyboxes" directory. Called during ResourcesController::in...
Definition ResourcesController.cpp:58
std::unordered_map< std::string, std::unique_ptr< Shader > > m_shaders
A hashmap of all the loaded Shader.
Definition ResourcesController.hpp:113
const std::filesystem::path m_models_path
Definition ResourcesController.hpp:115
Skybox * skybox(const std::string &name, const std::filesystem::path &path="", bool flip_uvs=false)
Retrieves the Skybox with a given name. You are not supposed to call delete on this pointer.
Definition ResourcesController.cpp:152
std::unordered_map< std::string, std::unique_ptr< Texture > > m_textures
A hashmap of all the loaded Texture.
Definition ResourcesController.hpp:105
void load_textures()
Loads all the models from the "resources/textures" directory. Called during ResourcesController::init...
Definition ResourcesController.cpp:48
Shader * shader(const std::string &name, const std::filesystem::path &path="")
Retrieves the Shader with a given name. You are not supposed to call delete on this pointer.
Definition ResourcesController.cpp:165
void initialize() override
Loads all the resources from the "resources/" directory.
Definition ResourcesController.cpp:15
void load_models()
Loads all the models from the "resources/models" directory based on the provided configuration....
Definition ResourcesController.cpp:33
std::string_view name() const override
Definition ResourcesController.hpp:23
const std::filesystem::path m_skyboxes_path
Definition ResourcesController.hpp:118
std::unordered_map< std::string, std::unique_ptr< Model > > m_models
A hashmap of all the loaded Model.
Definition ResourcesController.hpp:101
Texture * texture(const std::string &name, const std::filesystem::path &path="", TextureType texture_type=TextureType::Regular, bool flip_uvs=false)
Retrieves the Texture with a given name. You are not supposed to call delete on this pointer.
Definition ResourcesController.cpp:140
const std::filesystem::path m_shaders_path
Definition ResourcesController.hpp:117
const std::filesystem::path m_textures_path
Definition ResourcesController.hpp:116
Model * model(const std::string &name)
Retrieves the model with a given name. You are not supposed to call delete on this pointer.
Definition ResourcesController.cpp:102
void load_shaders()
Loads and compile all the shaders from the "resources/shaders" directory. Called during ResourcesCont...
Definition ResourcesController.cpp:22
Represents a linked shader program object within the OpenGL context.
Definition Shader.hpp:32
Represents a skybox object within the OpenGL context.
Definition Skybox.hpp:17
Represents a texture object within the OpenGL context.
Definition Texture.hpp:31
Definition GraphicsController.hpp:14
TextureType
Definition Texture.hpp:19