sculpto
textures_load.cpp
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file textures_load.cpp
3 * \brief Assets manager texture load function defintion modulule.
4 *
5 * \author Sabitov Kirill
6 * \date 09 July 2022
7 *********************************************************************/
8
9#include "sclpch.h"
10#include "textures_load.h"
13
14scl::shared<scl::texture_2d> scl::assets_manager::LoadTexture(const std::filesystem::path &TextureImageFilePath)
15{
16 SCL_CORE_INFO("Texture creation from file \"{}\" started.", TextureImageFilePath.string());
17
18 image texture_image(TextureImageFilePath.string());
19 if (texture_image.IsEmpty())
20 {
21 SCL_CORE_ERROR("Texture \"{}\" not found!", TextureImageFilePath.string());
22 return nullptr;
23 }
24
25 if (render_context::GetApi() == render_context_api::OpenGL)
26 texture_image.FlipHorizontaly();
27
28 return texture_2d::Create(texture_image, texture_type::COLOR);
29}
void FlipHorizontaly()
Definition: image.h:180
bool IsEmpty() const
Definition: image.h:41
#define SCL_CORE_INFO(...)
Definition: log.h:41
#define SCL_CORE_ERROR(...)
Definition: log.h:44
shared< texture_2d > LoadTexture(const std::filesystem::path &TextureImageFilePath)
std::shared_ptr< T > shared
Definition: smart_ptr.h:15
Base, abstract, backend render api independent render context class implementation module.
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.
Texture interface definition module.
Assets manager texture load function defintion modulule.