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 #define DECLARE_THUMBNAIL_SPEC(T)\
78 template<>\
79 auto get_thumbnail<T>(const asset_handle<T>& asset) -> gfx::texture::ptr;
80
94
95
96 auto get_thumbnail(const fs::path& path) -> gfx::texture::ptr;
97
98 auto get_gizmo_icon(entt::handle e) -> gfx::texture::ptr;
99
100
101 void regenerate_thumbnail(const hpp::uuid& uid);
102 void remove_thumbnail(const hpp::uuid& uid);
103 void clear_thumbnails();
104
105private:
106 struct thumbnail_cache
107 {
108 asset_handle<gfx::texture> transparent;
110 asset_handle<gfx::texture> folder_empty;
125
126 } thumbnails_;
127
128
129 struct gizmo_cache
130 {
133 asset_handle<gfx::texture> directional_light;
134 asset_handle<gfx::texture> point_light;
136 asset_handle<gfx::texture> audio_source;
138
139 } gimzmo_icons_;
140
141
142 generator gen_;
143
144 std::map<std::string, asset_handle<gfx::texture>> icons_;
145 std::map<std::string, asset_handle<gfx::texture>> gizmo_icons_;
146
147 std::shared_ptr<int> sentinel_ = std::make_shared<int>(0);
148};
149} // namespace unravel
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:35
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
Structure representing a reflection probe.
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
DECLARE_THUMBNAIL_SPEC(audio_clip)
auto init(rtti::context &ctx) -> bool
auto get_thumbnail(const asset_handle< T > &asset) -> gfx::texture::ptr
auto deinit(rtti::context &ctx) -> bool
DECLARE_THUMBNAIL_SPEC(gfx::shader)
DECLARE_THUMBNAIL_SPEC(gfx::texture)
auto get_gizmo_icon(entt::handle e) -> gfx::texture::ptr
DECLARE_THUMBNAIL_SPEC(physics_material)
void on_frame_update(rtti::context &ctx, delta_t)
DECLARE_THUMBNAIL_SPEC(animation_clip)
void remove_thumbnail(const hpp::uuid &uid)
void regenerate_thumbnail(const hpp::uuid &uid)
DECLARE_THUMBNAIL_SPEC(scene_prefab)
DECLARE_THUMBNAIL_SPEC(style_sheet)
Represents a UI visual tree asset (HTML/RML document).
Definition ui_tree.h:25