Panda3D
|
A convenient class for loading models from disk, in bam or egg format (or any of a number of other formats implemented by a LoaderFileType, such as ptloader). More...
#include "loader.h"
Classes | |
class | ConsiderFile |
class | Results |
Public Member Functions | |
Loader (const string &name="loader") | |
virtual TypeHandle | force_init_type () |
const string & | get_task_chain () const |
Returns the task chain that is used for asynchronous loads. | |
AsyncTaskManager * | get_task_manager () const |
Returns the task manager that is used for asynchronous loads. | |
virtual TypeHandle | get_type () const |
void | load_async (AsyncTask *request) |
Begins an asynchronous load request. | |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
PT (PandaNode) load_sync(const Filename &filename | |
PT (AsyncTask) make_async_request(const Filename &filename | |
PT (PandaNode) load_bam_stream(istream &in) | |
bool | remove (AsyncTask *task) |
Removes a pending asynchronous load request. | |
void | set_task_chain (const string &task_chain) |
Specifies the task chain that is used for asynchronous loads. | |
void | set_task_manager (AsyncTaskManager *task_manager) |
Specifies the task manager that is used for asynchronous loads. | |
void | stop_threads () |
Stop any threads used for asynchronous loads. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static Loader * | get_global_ptr () |
Returns a pointer to the global Loader. | |
static void | init_type () |
Public Attributes | |
const LoaderOptions & | options = LoaderOptions()) const |
Friends | |
class | ModelLoadRequest |
A convenient class for loading models from disk, in bam or egg format (or any of a number of other formats implemented by a LoaderFileType, such as ptloader).
This class supports synchronous as well as asynchronous loading. In asynchronous loading, the model is loaded in the background by a thread, and an event will be generated when the model is available. If threading is not available, the asynchronous loading interface may be used, but it loads synchronously.
Loader * Loader::get_global_ptr | ( | ) | [inline, static] |
Returns a pointer to the global Loader.
This is the Loader that most code should use for loading models.
Definition at line 228 of file loader.I.
Referenced by SpeedTreeNode::add_from_stf(), and SpeedTreeNode::InstanceList::fillin().
const string & Loader::get_task_chain | ( | ) | const [inline] |
AsyncTaskManager * Loader::get_task_manager | ( | ) | const [inline] |
void Loader::load_async | ( | AsyncTask * | request | ) | [inline] |
Begins an asynchronous load request.
To use this call, first create a new ModelLoadRequest object with the filename you wish to load, and then add that object to the Loader with load_async. This function will return immediately, and the model will be loaded in the background.
To determine when the model has completely loaded, you may poll request->is_ready() from time to time, or set the done_event on the request object and listen for that event. When the model is ready, you may retrieve it via request->get_model().
Definition at line 216 of file loader.I.
References AsyncTask::set_task_chain().
void Loader::output | ( | ostream & | out | ) | const [virtual] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented from Namable.
Definition at line 109 of file loader.cxx.
bool Loader::remove | ( | AsyncTask * | task | ) | [inline] |
void Loader::set_task_chain | ( | const string & | task_chain | ) | [inline] |
void Loader::set_task_manager | ( | AsyncTaskManager * | task_manager | ) | [inline] |
void Loader::stop_threads | ( | ) | [inline] |