sculpto
Main Page
Namespaces
Classes
Files
File List
File Members
utilities
assets_manager
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
"
11
#include "
core/render/render_context.h
"
12
#include "
core/render/primitives/texture.h
"
13
14
scl::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
}
scl::image
Definition:
image.h:19
scl::image::FlipHorizontaly
void FlipHorizontaly()
Definition:
image.h:180
scl::image::IsEmpty
bool IsEmpty() const
Definition:
image.h:41
SCL_CORE_INFO
#define SCL_CORE_INFO(...)
Definition:
log.h:41
SCL_CORE_ERROR
#define SCL_CORE_ERROR(...)
Definition:
log.h:44
scl::assets_manager::LoadTexture
shared< texture_2d > LoadTexture(const std::filesystem::path &TextureImageFilePath)
Definition:
textures_load.cpp:14
scl::shared
std::shared_ptr< T > shared
Definition:
smart_ptr.h:15
render_context.h
Base, abstract, backend render api independent render context class implementation module.
sclpch.h
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.
texture.h
Texture interface definition module.
textures_load.h
Assets manager texture load function defintion modulule.
Generated by
1.9.4