Unravel Engine C++ Reference
Loading...
Searching...
No Matches
thumbnail_manager.h
Go to the documentation of this file.
1#pragma once
2
3#include <base/basetypes.hpp>
4#include <context/context.hpp>
6#include <graphics/shader.h>
7#include <graphics/texture.h>
8
10#include <engine/ecs/scene.h>
11
12
13namespace gfx
14{
15struct texture;
16struct shader;
17} // namespace gfx
18
19namespace unravel
20{
21class mesh;
22class material;
23struct prefab;
24struct scene_prefab;
25struct animation_clip;
26struct physics_material;
27struct audio_clip;
28struct script;
29struct font;
30struct ui_tree;
31struct style_sheet;
32} // namespace unravel
33
34
35namespace unravel
36{
37
38
40{
49
50 struct generator
51 {
52 std::map<hpp::uuid, generated_thumbnail> thumbnails;
53
54 auto get_scene() -> scene&;
55
56 void reset();
57
58 void reset_wait();
59
60 int remaining{0};
61
62 std::array<scene, 3> scenes{scene{"thumbnail"}, scene{"thumbnail"}, scene{"thumbnail"}};
63
65 };
66
67 auto init(rtti::context& ctx) -> bool;
68 auto deinit(rtti::context& ctx) -> bool;
70
71 template<typename T>
73 {
74 return thumbnails_.file.get();
75 }
76
77
78
79 auto get_thumbnail(const fs::path& path) -> gfx::texture::ptr;
80
81 auto get_gizmo_icon(entt::handle e) -> gfx::texture::ptr;
82
83
84 void regenerate_thumbnail(const hpp::uuid& uid);
85 void remove_thumbnail(const hpp::uuid& uid);
86 void clear_thumbnails();
87
88private:
89 struct thumbnail_cache
90 {
93 asset_handle<gfx::texture> folder_empty;
108
109 } thumbnails_;
110
111
112 struct gizmo_cache
113 {
116 asset_handle<gfx::texture> directional_light;
117 asset_handle<gfx::texture> point_light;
119 asset_handle<gfx::texture> audio_source;
120 asset_handle<gfx::texture> reflection_probe;
121 asset_handle<gfx::texture> particle_emitter;
122
123 } gimzmo_icons_;
124
125
126 generator gen_;
127
128 std::map<std::string, asset_handle<gfx::texture>> icons_;
129 std::map<std::string, asset_handle<gfx::texture>> gizmo_icons_;
130
131 std::shared_ptr<int> sentinel_ = std::make_shared<int>(0);
132};
133
134
135#define DECLARE_THUMBNAIL_SPEC(T) template<>\
136auto thumbnail_manager::get_thumbnail<T>(const asset_handle<T>& asset) -> gfx::texture::ptr;
137
151} // namespace unravel
Base class for materials used in rendering.
Definition material.h:32
Main class representing a 3D mesh with support for different LODs, submeshes, and skinning.
Definition mesh.h:310
std::chrono::duration< float > delta_t
ImGui::Font::Enum font
Definition hub.cpp:24
Represents a handle to an asset, providing access and management functions.
auto get(bool wait=true) const -> std::shared_ptr< T >
Gets the shared pointer to the asset.
Struct representing an animation.
Definition animation.h:99
Struct representing an audio clip.
Definition audio_clip.h:16
Represents the physical properties of a material.
Represents a generic prefab with a buffer for serialized data.
Definition prefab.h:18
Represents a scene-specific prefab. Inherits from the generic prefab structure.
Definition prefab.h:31
Represents a scene in the ACE framework, managing entities and their relationships.
Definition scene.h:21
Represents a UI style sheet asset (CSS/RCSS document).
Definition style_sheet.h:26
std::map< hpp::uuid, generated_thumbnail > thumbnails
auto init(rtti::context &ctx) -> bool
auto get_thumbnail(const asset_handle< T > &asset) -> gfx::texture::ptr
auto deinit(rtti::context &ctx) -> bool
auto get_gizmo_icon(entt::handle e) -> gfx::texture::ptr
void on_frame_update(rtti::context &ctx, delta_t)
void remove_thumbnail(const hpp::uuid &uid)
void regenerate_thumbnail(const hpp::uuid &uid)
Represents a UI visual tree asset (HTML/RML document).
Definition ui_tree.h:25
#define DECLARE_THUMBNAIL_SPEC(T)