10 std::lock_guard<std::mutex> lock(threadManager);
11 if (BufferCreationFunc) {
12 std::any result = BufferCreationFunc(Type, Size, Data);
14 if (result.has_value()) {
15 BufferBase* buffer = std::any_cast<BufferBase*>(result);
18 }
catch (
const std::exception& e) {
19 SLEAK_ERROR(
"Failed to cast object to Buffer object: {}", e.what());
22 SLEAK_ERROR(
"No buffer creation function registered!");
28 std::lock_guard<std::mutex> lock(threadManager);
29 if (ShaderCreateFunc) {
30 std::any result = ShaderCreateFunc(ShaderPath);
32 if (result.has_value()) {
33 Shader* shader = std::any_cast<Shader*>(result);
36 }
catch (
const std::exception& e) {
37 SLEAK_ERROR(
"Failed to cast object to Shader object: {}", e.what());
40 SLEAK_ERROR(
"No shader creation function registered!");
46 std::lock_guard<std::mutex> lock(threadManager);
47 if (TextureCreateFunc) {
48 std::any result = TextureCreateFunc(TexturePath);
50 if (result.has_value()) {
51 Texture* texture = std::any_cast<Texture*>(result);
54 }
catch (
const std::exception& e) {
55 SLEAK_ERROR(
"Failed to cast object to Texture object: {}",
59 SLEAK_ERROR(
"No texture creation function registered!");
65 std::lock_guard<std::mutex> lock(threadManager);
66 if (TextureFromMemoryCreateFunc) {
67 std::any result = TextureFromMemoryCreateFunc(data,
width,
height, format, maxMipLevels);
69 if (result.has_value()) {
70 Texture* texture = std::any_cast<Texture*>(result);
73 }
catch (
const std::exception& e) {
74 SLEAK_ERROR(
"Failed to cast object to Texture (from memory) object: {}",
78 SLEAK_ERROR(
"No texture-from-memory creation function registered!");
84 std::lock_guard<std::mutex> lock(threadManager);
85 if (CubemapTextureCreateFunc) {
86 std::any result = CubemapTextureCreateFunc(FacePaths);
88 if (result.has_value()) {
89 Texture* texture = std::any_cast<Texture*>(result);
92 }
catch (
const std::exception& e) {
93 SLEAK_ERROR(
"Failed to cast object to CubemapTexture object: {}",
97 SLEAK_ERROR(
"No cubemap texture creation function registered!");
103 std::lock_guard<std::mutex> lock(threadManager);
104 if (CubemapPanoramaCreateFunc) {
105 std::any result = CubemapPanoramaCreateFunc(PanoramaPath);
107 if (result.has_value()) {
108 Texture* texture = std::any_cast<Texture*>(result);
111 }
catch (
const std::exception& e) {
112 SLEAK_ERROR(
"Failed to cast object to CubemapTexture (panorama) object: {}",
116 SLEAK_ERROR(
"No cubemap panorama creation function registered!");
#define IMPLEMENT_RESOURCE_MANAGER
Backend-agnostic GPU buffer: vertex, index, constant, or resource view target.
static Sleak::Texture * CreateCubemapTextureFromPanorama(const std::string &PanoramaPath)
Loads a cubemap from a single equirectangular panorama via the currently registered backend factory.
static Shader * CreateShader(const std::string &ShaderPath)
Compiles a shader via the currently registered backend factory.
static Sleak::Texture * CreateTexture(const std::string &TexturePath)
Loads a texture via the currently registered backend factory.
static BufferBase * CreateBuffer(BufferType Type, uint32_t Size, void *Data)
Creates a buffer via the currently registered backend factory.
static Sleak::Texture * CreateTextureFromMemory(const void *data, uint32_t width, uint32_t height, TextureFormat format, uint32_t maxMipLevels=0)
Creates a texture from raw pixel data via the currently registered backend factory.
static Sleak::Texture * CreateCubemapTexture(const std::array< std::string, 6 > &FacePaths)
Loads a cubemap from six face image paths via the currently registered backend factory.
Backend-agnostic compiled shader program.
Backend-facing rendering layer shared by the four graphics backends.
BufferType
GPU buffer usage kind, drives backend binding flags and layout.
Root namespace for everything the engine exposes.