47 "Falling back to raw asset.",
61auto validate(
const std::string& key,
const std::string& compiled_ext, std::string& out) ->
bool
72 if(!fs::exists(compiled_absolute_path, err))
79 if(!fs::exists(compiled_absolute_path, err))
85 out = compiled_absolute_path;
93 std::string compiled_absolute_path{};
95 if(!
validate(key, {}, compiled_absolute_path))
100 auto create_resource_func = [compiled_absolute_path]()
102 return std::make_shared<gfx::texture>(compiled_absolute_path.c_str());
107 output.set_internal_job(job);
116 std::string compiled_absolute_path{};
123 auto create_resource_func = [compiled_absolute_path, key]()
125 auto stream = std::ifstream{compiled_absolute_path, std::ios::binary};
130 auto shader = std::make_shared<gfx::shader>(mem);
132 gfx::set_name(shader->native_handle(), key.c_str(),
static_cast<int32_t
>(key.size()));
138 output.set_internal_job(job);
146 std::string compiled_absolute_path{};
148 if(!
validate(key, {}, compiled_absolute_path))
153 auto create_resource_func = [compiled_absolute_path]()
155 std::shared_ptr<unravel::material>
material;
161 output.set_internal_job(job);
169 std::string compiled_absolute_path{};
171 if(!
validate(key, {}, compiled_absolute_path))
176 auto create_resource_func = [compiled_absolute_path]()
181 auto mesh = std::make_shared<unravel::mesh>();
187 output.set_internal_job(job);
196 std::string compiled_absolute_path{};
198 if(!
validate(key, {}, compiled_absolute_path))
203 auto create_resource_func = [compiled_absolute_path]()
205 auto anim = std::make_shared<animation_clip>();
212 output.set_internal_job(job);
220 std::string compiled_absolute_path{};
222 if(!
validate(key, {}, compiled_absolute_path))
227 auto create_resource_func = [compiled_absolute_path]()
229 auto pfb = std::make_shared<prefab>();
231 auto stream = std::ifstream{compiled_absolute_path};
237 output.set_internal_job(job);
246 std::string compiled_absolute_path{};
248 if(!
validate(key, {}, compiled_absolute_path))
253 auto create_resource_func = [compiled_absolute_path]()
255 auto pfb = std::make_shared<scene_prefab>();
257 auto stream = std::ifstream{compiled_absolute_path};
263 output.set_internal_job(job);
271 const std::string& key) ->
bool
273 std::string compiled_absolute_path{};
275 if(!
validate(key, {}, compiled_absolute_path))
280 auto create_resource_func = [compiled_absolute_path]()
282 auto material = std::make_shared<physics_material>();
288 output.set_internal_job(job);
297 std::string compiled_absolute_path{};
299 if(!
validate(key, {}, compiled_absolute_path))
304 auto create_load_func = [compiled_absolute_path]()
306 auto data = std::make_shared<audio::sound_data>();
311 auto create_resource_func = [compiled_absolute_path]()
313 audio::sound_data data;
316 auto create_job = tpp::async(tpp::main_thread::get_id(),
317 [data = std::move(data)]()
mutable
319 auto clip = std::make_shared<audio_clip>(std::move(data),
false);
323 return create_job.get();
328 output.set_internal_job(job);
337 std::string compiled_absolute_path{};
339 if(!
validate(key, {}, compiled_absolute_path))
344 auto create_resource_func = [compiled_absolute_path]()
346 auto create_job = tpp::async(tpp::main_thread::get_id(),
347 [compiled_absolute_path]()
mutable
353 return create_job.get();
358 output.set_internal_job(job);
367 std::string compiled_absolute_path{};
369 if(!
validate(key, {}, compiled_absolute_path))
374 auto create_resource_func = [compiled_absolute_path]()
376 auto scr = std::make_shared<script>();
382 output.set_internal_job(job);
391 std::string compiled_absolute_path{};
393 if(!
validate(key, {}, compiled_absolute_path))
398 auto create_resource_func = [compiled_absolute_path]()
400 auto tree = std::make_shared<ui_tree>();
406 output.set_internal_job(job);
415 std::string compiled_absolute_path{};
417 if(!
validate(key, {}, compiled_absolute_path))
422 auto create_resource_func = [compiled_absolute_path]()
424 auto sheet = std::make_shared<style_sheet>();
430 output.set_internal_job(job);
Base class for materials used in rendering.
Main class representing a 3D mesh with support for different LODs, submeshes, and skinning.
auto load_mesh(load_data &&data) -> bool
#define FONT_TYPE_DISTANCE_OUTLINE_DROP_SHADOW_IMAGE
#define APPLOG_WARNING(...)
#define APPLOG_ERROR(...)
auto get_data_directory(const std::string &prefix={}) -> std::string
auto get_compiled_directory(const std::string &prefix={}) -> std::string
byte_array_t read_stream(std::istream &stream)
Load a byte_array_t with the contents of the specified file, be that file in a package or in the main...
path resolve_protocol(const path &_path)
Given the specified path/filename, resolve the final full filename. This will be based on either the ...
bool has_known_protocol(const path &_path)
Checks whether the path has a known protocol.
stream_buffer< byte_array_t > read_stream_buffer(std::istream &stream)
void set_name(shader_handle _handle, const char *_name, int32_t _len)
const memory_view * copy(const void *_data, uint32_t _size)
auto get_current_renderer_filename_extension() -> const std::string &
auto replace(const std::string &str, const std::string &search, const std::string &replace) -> std::string
auto load_from_file(tpp::thread_pool &pool, asset_handle< T > &output, const std::string &key) -> bool
auto resolve_path(const std::string &key) -> fs::path
auto load_from_file< font >(tpp::thread_pool &pool, asset_handle< font > &output, const std::string &key) -> bool
void log_unknown_protocol_for_key(const std::string &key)
void log_missing_compiled_asset_for_key(const std::string &key)
auto load_from_file< gfx::texture >(tpp::thread_pool &pool, asset_handle< gfx::texture > &output, const std::string &key) -> bool
auto load_from_file< scene_prefab >(tpp::thread_pool &pool, asset_handle< scene_prefab > &output, const std::string &key) -> bool
auto load_from_file< style_sheet >(tpp::thread_pool &pool, asset_handle< style_sheet > &output, const std::string &key) -> bool
auto load_from_file< mesh >(tpp::thread_pool &pool, asset_handle< mesh > &output, const std::string &key) -> bool
auto resolve_compiled_path(const std::string &key) -> fs::path
auto validate(const std::string &key, const std::string &compiled_ext, std::string &out) -> bool
auto load_from_file< material >(tpp::thread_pool &pool, asset_handle< material > &output, const std::string &key) -> bool
auto load_from_file< gfx::shader >(tpp::thread_pool &pool, asset_handle< gfx::shader > &output, const std::string &key) -> bool
auto load_from_file< physics_material >(tpp::thread_pool &pool, asset_handle< physics_material > &output, const std::string &key) -> bool
auto load_from_file< ui_tree >(tpp::thread_pool &pool, asset_handle< ui_tree > &output, const std::string &key) -> bool
auto resolve_compiled_key(const std::string &key) -> std::string
void log_missing_raw_asset_for_key(const std::string &key)
auto load_from_file< prefab >(tpp::thread_pool &pool, asset_handle< prefab > &output, const std::string &key) -> bool
auto load_from_file< script >(tpp::thread_pool &pool, asset_handle< script > &output, const std::string &key) -> bool
auto load_from_file< audio_clip >(tpp::thread_pool &pool, asset_handle< audio_clip > &output, const std::string &key) -> bool
auto load_from_file< animation_clip >(tpp::thread_pool &pool, asset_handle< animation_clip > &output, const std::string &key) -> bool
auto get_job_name() -> std::string
void load_from_file_bin(const std::string &absolute_path, animation_clip &obj)
Represents a handle to an asset, providing access and management functions.
Struct used for mesh construction.