Manages app resources: Model, Texture, Shader, and Skybox.
More...
#include <ResourcesController.hpp>
Manages app resources: Model, Texture, Shader, and Skybox.
◆ name()
std::string_view engine::resources::ResourcesController::name |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the controller class name; used for logging.
- Returns
- Controller name
Reimplemented from engine::core::Controller.
◆ model()
Model * engine::resources::ResourcesController::model |
( |
const std::string & |
name | ) |
|
Retrieves the model with a given name. You are not supposed to call delete
on this pointer.
- Parameters
-
name | of the model in the configuration file. |
- Returns
- The pointer to the Model associated with the
name
.
◆ texture()
Retrieves the Texture with a given name. You are not supposed to call delete
on this pointer.
Other params, except name, are optional. If not provided the function will search for a texture in the: "resources/textures".
- Parameters
-
name | of the texture without the extension. |
path | form which to load the texture. |
texture_type | |
flip_uvs | flip the uvs on load if set to true |
- Returns
- The pointer to the Texture associated with the
name
.
◆ skybox()
Skybox * engine::resources::ResourcesController::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.
Other params, except name, are optional. If not provided the function will search for a skybox in the: "resources/skyboxes". Images for the sides of the skybox cube should be named: left.jpg, right.jpg, top.jpg, bottom.jpg, front.jpg, back.jpg (any supported image extension).
- Parameters
-
name | of the skybox directory that contains 6 images for each side of the cube. |
path | form which to load the texture. |
flip_uvs | flip the uvs on load if set to true |
- Returns
- The pointer to the Skybox associated with the
name
.
◆ shader()
Shader * engine::resources::ResourcesController::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.
- Parameters
-
path | to the shader.glsl file that contains shader source code. |
- Returns
- The pointer to the Shader associated with the
name
.
◆ initialize()
void engine::resources::ResourcesController::initialize |
( |
| ) |
|
|
overrideprivatevirtual |
◆ load_models()
void engine::resources::ResourcesController::load_models |
( |
| ) |
|
|
private |
◆ load_textures()
void engine::resources::ResourcesController::load_textures |
( |
| ) |
|
|
private |
◆ load_skyboxes()
void engine::resources::ResourcesController::load_skyboxes |
( |
| ) |
|
|
private |
◆ load_shaders()
void engine::resources::ResourcesController::load_shaders |
( |
| ) |
|
|
private |
◆ m_models
std::unordered_map<std::string, std::unique_ptr<Model> > engine::resources::ResourcesController::m_models |
|
private |
A hashmap of all the loaded Model.
◆ m_textures
std::unordered_map<std::string, std::unique_ptr<Texture> > engine::resources::ResourcesController::m_textures |
|
private |
A hashmap of all the loaded Texture.
◆ m_sky_boxes
std::unordered_map<std::string, std::unique_ptr<Skybox> > engine::resources::ResourcesController::m_sky_boxes |
|
private |
A hashmap of all the loaded Skybox.
◆ m_shaders
std::unordered_map<std::string, std::unique_ptr<Shader> > engine::resources::ResourcesController::m_shaders |
|
private |
A hashmap of all the loaded Shader.
◆ m_models_path
const std::filesystem::path engine::resources::ResourcesController::m_models_path = "resources/models" |
|
private |
◆ m_textures_path
const std::filesystem::path engine::resources::ResourcesController::m_textures_path = "resources/textures" |
|
private |
◆ m_shaders_path
const std::filesystem::path engine::resources::ResourcesController::m_shaders_path = "resources/shaders" |
|
private |
◆ m_skyboxes_path
const std::filesystem::path engine::resources::ResourcesController::m_skyboxes_path = "resources/skyboxes" |
|
private |
The documentation for this class was generated from the following files: