Class loader_t¶
Defined in File loader.hpp
Nested Relationships¶
Nested Types¶
Inheritance Relationships¶
Derived Type¶
public wt::scene::loader::xml::xml_loader_t
(Class xml_loader_t)
Class Documentation¶
-
class loader_t¶
Handles queueing and synchronizing the loading of scene element. Generic class: overloads are expected to provide the data source.
Subclassed by wt::scene::loader::xml::xml_loader_t
Public Types
Public Functions
-
loader_t(std::string name, const wt_context_t &ctx, std::optional<progress_callback_t> callbacks = {})¶
-
inline virtual ~loader_t()¶
-
void wait_shapes() const¶
Block and wait for loading of all shapes to complete.
-
inline const auto &get_name() const noexcept¶
-
inline bool has_errors() const noexcept¶
Returns TRUE if errors occurred during loading.
-
std::unique_ptr<scene_t> get()¶
Blocks and wait for loader to complete, then constructs the scene. Only thread safe with sensors’, sampler’s and shapes’ waiters and getter. NOT thread safe with wait().
-
void wait() const¶
Blocks and wait for loader to complete. Only thread safe with sensors’, sampler’s and shapes’ waiters and getter. NOT thread safe with get().
-
inline std::optional<const node_t*> get_node_with_id(const std::string &id) const noexcept¶
Get the node with specified id. Nested nodes are ignored.
-
template<std::invocable F>
inline void enqueue_loading_task(const scene_element_t *resource, const std::string&, F &&func)¶ Enqueues an arbitrary auxiliary task as part of scene loading. Scene loading will wait for these auxiliary tasks to complete. These tasks are not scheduled on the threadpool to wait deadlocks on waits.
-
inline void register_resource_dependency(const scene_element_t *resource, const scene_element_t *dependency)¶
Notifies the loader that
resource
depends ondependency
. When complete_loading_tasks_for_resource() is called onresource
, it will also block and wait for any tasks queued bydependency
.
-
inline void complete_loading_tasks_for_resource(const scene_element_t *resource)¶
Waits and completes all auxiliary deferred loading tasks for a particular resource are done. Blocking operation.
Protected Functions
-
void load(node_t *scene_node, const defaults_defines_t &user_defines)¶
Enqueues the loading tasks. Subclasses should call this when ready, passing the root node of the scene data.
scene_node
must remain valid for the lifetime of the loader.
-
inline void set_fail() noexcept¶
Marks that loading has failed.
-
loader_t(std::string name, const wt_context_t &ctx, std::optional<progress_callback_t> callbacks = {})¶