Unigine::AsyncQueue Class
Header: | #include <UnigineAsyncQueue.h> |
Loading of files/meshes/images/nodes on demand is performed in a separate system thread, in addition to asynchronous content streaming. This class is used to control asynchronous data loading. It is possible to control loading queue by organizing files in groups and setting individual weights inside these groups.
To load files on demand, call the functions in the following order:
- First loadFile() function is called to place the file in the queue for loading and obtain an ID, that will be used to identify a resource in subsequent operations.
- After that, different operations can be performed:
- forceFile() to load the file immediately.
- removeFile() to remove the file from the queue in case there is no need to load it any more of to remove a file from the list of loaded files if it was loaded but no longer needed.
- checkFile() to check if the given file was requested to be loaded via loadFile() or if it has already been loaded.
The same algorithm is true for:
- Meshes - see methods loadMesh(), forceMesh(), getMesh(), takeMesh(), checkMesh(), and removeMesh().
- Images - see methods loadImage(), forceImage(), getImage(), takeImage(), checkImage(), and removeImage().
- Nodes - see methods loadNode(), forceNode(), getNode(), takeNode(), checkNode(), and removeNode().
To get a loaded resource (image, mesh, or node) the following 2 groups of methods can be used:
- Get-methods - these methods return the loaded resource:
- Take-methods - these methods return the loaded resource and remove it from the list of loaded ones:
For example:
// specify relative paths to resources to be loaded to a queue
static const char *meshes[] = {
"meshes/box.mesh",
"meshes/capsule.mesh",
"meshes/cbox.mesh",
};
#define ARRAY_LENGTH(array) static_cast<int>(sizeof(array) / sizeof(array[0]))
struct AsyncLoadRequest
{
String name;
int id;
};
Vector<AsyncLoadRequest> mesh_load_requests;
void AsyncSample::init()
{
// enqueue meshes to load
for (int i = 0; i < ARRAY_LENGTH(meshes); ++i)
{
const char *name = meshes[i];
AsyncLoadRequest request;
request.name = name;
request.id = AsyncQueue::loadMesh(name);
mesh_load_requests.append(request);
}
}
void AsyncSample::update()
{
// check mesh load requests
for (int i = 0; i < mesh_load_requests.size(); ++i)
{
const auto &r = mesh_load_requests[i];
if (!AsyncQueue::checkMesh(r.id))
continue;
// remove the mesh from the list of the loaded meshes and print a message
AsyncQueue::removeMesh(r.id);
Log::message("Loaded mesh \"%s\"\n", r.name.get());
mesh_load_requests.remove(i--);
}
}
Handling Events#
You can add "resource loaded" event handlers for files, images, meshes or nodes and perform certain actions as a resource is loaded. The example below shows how to add a "loaded" event handler for image resource, that reports the name and id of the loaded image.
// specify relative paths to resources to be loaded to a queue
static const char *textures[] = {
"textures/black_d.dds",
"textures/blue_d.dds",
"textures/green_d.dds",
"textures/orange_d.dds",
"textures/red_d.dds",
"textures/white_d.dds",
"textures/yellow_d.dds",
};
#define ARRAY_LENGTH(array) static_cast<int>(sizeof(array) / sizeof(array[0]))
void AsyncSample::init()
{
// enqueue textures to load
for (int i = 0; i < ARRAY_LENGTH(textures); ++i)
AsyncQueue::loadImage(textures[i]);
// subscribing for the ImageLoaded event
AsyncQueue::getEventImageLoaded().connect(this, &AsyncSample::image_loaded);
}
// image loaded event handler function
void AsyncSample::image_loaded(const char *name, int id)
{
AsyncQueue::removeImage(id);
Log::message("Image \"%s\" loaded, ID: %d\n", name, id);
}
See Also#
A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/systems/ folder:
- async_02
- stream_00
AsyncQueue Class
Members
getNumLoadedResources() const#
Return value
CurrentgetNumLoadedNodes() const#
Return value
CurrentgetNumLoadedMeshes() const#
Return value
CurrentgetNumLoadedImages() const#
Return value
CurrentgetNumLoadedFiles() const#
Return value
CurrentgetNumLoadedData() const#
Return value
CurrentgetNumQueuedResources() const#
Return value
CurrentgetNumQueuedNodes() const#
Return value
CurrentgetNumQueuedMeshes() const#
Return value
CurrentgetNumQueuedImages() const#
Return value
CurrentgetNumQueuedFiles() const#
Return value
CurrentgetNumQueuedData() const#
Return value
CurrentgetTotalTime() const#
Return value
CurrentEvent<const char *, int> getEventNodeLoaded() const#
Usage Example
// implement the NodeLoaded event handler
void nodeloaded_event_handler(const char * name, int id)
{
Log::message("\Handling NodeLoaded event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections nodeloaded_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
AsyncQueue::getEventNodeLoaded().connect(nodeloaded_event_connections, nodeloaded_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
AsyncQueue::getEventNodeLoaded().connect(nodeloaded_event_connections, [](const char * name, int id) {
Log::message("\Handling NodeLoaded event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
nodeloaded_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection nodeloaded_event_connection;
// subscribe to the NodeLoaded event with a handler function keeping the connection
AsyncQueue::getEventNodeLoaded().connect(nodeloaded_event_connection, nodeloaded_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
nodeloaded_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
nodeloaded_event_connection.setEnabled(true);
// ...
// remove subscription to the NodeLoaded event via the connection
nodeloaded_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A NodeLoaded event handler implemented as a class member
void event_handler(const char * name, int id)
{
Log::message("\Handling NodeLoaded event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
AsyncQueue::getEventNodeLoaded().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the NodeLoaded event with a handler function
AsyncQueue::getEventNodeLoaded().connect(nodeloaded_event_handler);
// remove subscription to the NodeLoaded event later by the handler function
AsyncQueue::getEventNodeLoaded().disconnect(nodeloaded_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId nodeloaded_handler_id;
// subscribe to the NodeLoaded event with a lambda handler function and keeping connection ID
nodeloaded_handler_id = AsyncQueue::getEventNodeLoaded().connect([](const char * name, int id) {
Log::message("\Handling NodeLoaded event (lambda).\n");
}
);
// remove the subscription later using the ID
AsyncQueue::getEventNodeLoaded().disconnect(nodeloaded_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all NodeLoaded events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
AsyncQueue::getEventNodeLoaded().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
AsyncQueue::getEventNodeLoaded().setEnabled(true);
Return value
Event reference.Event<const char *, int> getEventMeshLoaded() const#
Usage Example
// implement the MeshLoaded event handler
void meshloaded_event_handler(const char * name, int id)
{
Log::message("\Handling MeshLoaded event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections meshloaded_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
AsyncQueue::getEventMeshLoaded().connect(meshloaded_event_connections, meshloaded_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
AsyncQueue::getEventMeshLoaded().connect(meshloaded_event_connections, [](const char * name, int id) {
Log::message("\Handling MeshLoaded event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
meshloaded_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection meshloaded_event_connection;
// subscribe to the MeshLoaded event with a handler function keeping the connection
AsyncQueue::getEventMeshLoaded().connect(meshloaded_event_connection, meshloaded_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
meshloaded_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
meshloaded_event_connection.setEnabled(true);
// ...
// remove subscription to the MeshLoaded event via the connection
meshloaded_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A MeshLoaded event handler implemented as a class member
void event_handler(const char * name, int id)
{
Log::message("\Handling MeshLoaded event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
AsyncQueue::getEventMeshLoaded().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MeshLoaded event with a handler function
AsyncQueue::getEventMeshLoaded().connect(meshloaded_event_handler);
// remove subscription to the MeshLoaded event later by the handler function
AsyncQueue::getEventMeshLoaded().disconnect(meshloaded_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId meshloaded_handler_id;
// subscribe to the MeshLoaded event with a lambda handler function and keeping connection ID
meshloaded_handler_id = AsyncQueue::getEventMeshLoaded().connect([](const char * name, int id) {
Log::message("\Handling MeshLoaded event (lambda).\n");
}
);
// remove the subscription later using the ID
AsyncQueue::getEventMeshLoaded().disconnect(meshloaded_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all MeshLoaded events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
AsyncQueue::getEventMeshLoaded().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
AsyncQueue::getEventMeshLoaded().setEnabled(true);
Return value
Event reference.Event<const char *, int> getEventImageLoaded() const#
Usage Example
// implement the ImageLoaded event handler
void imageloaded_event_handler(const char * name, int id)
{
Log::message("\Handling ImageLoaded event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections imageloaded_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
AsyncQueue::getEventImageLoaded().connect(imageloaded_event_connections, imageloaded_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
AsyncQueue::getEventImageLoaded().connect(imageloaded_event_connections, [](const char * name, int id) {
Log::message("\Handling ImageLoaded event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
imageloaded_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection imageloaded_event_connection;
// subscribe to the ImageLoaded event with a handler function keeping the connection
AsyncQueue::getEventImageLoaded().connect(imageloaded_event_connection, imageloaded_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
imageloaded_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
imageloaded_event_connection.setEnabled(true);
// ...
// remove subscription to the ImageLoaded event via the connection
imageloaded_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A ImageLoaded event handler implemented as a class member
void event_handler(const char * name, int id)
{
Log::message("\Handling ImageLoaded event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
AsyncQueue::getEventImageLoaded().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the ImageLoaded event with a handler function
AsyncQueue::getEventImageLoaded().connect(imageloaded_event_handler);
// remove subscription to the ImageLoaded event later by the handler function
AsyncQueue::getEventImageLoaded().disconnect(imageloaded_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId imageloaded_handler_id;
// subscribe to the ImageLoaded event with a lambda handler function and keeping connection ID
imageloaded_handler_id = AsyncQueue::getEventImageLoaded().connect([](const char * name, int id) {
Log::message("\Handling ImageLoaded event (lambda).\n");
}
);
// remove the subscription later using the ID
AsyncQueue::getEventImageLoaded().disconnect(imageloaded_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all ImageLoaded events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
AsyncQueue::getEventImageLoaded().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
AsyncQueue::getEventImageLoaded().setEnabled(true);
Return value
Event reference.Event<const char *, int> getEventFileLoaded() const#
Usage Example
// implement the FileLoaded event handler
void fileloaded_event_handler(const char * name, int id)
{
Log::message("\Handling FileLoaded event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections fileloaded_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
AsyncQueue::getEventFileLoaded().connect(fileloaded_event_connections, fileloaded_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
AsyncQueue::getEventFileLoaded().connect(fileloaded_event_connections, [](const char * name, int id) {
Log::message("\Handling FileLoaded event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
fileloaded_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection fileloaded_event_connection;
// subscribe to the FileLoaded event with a handler function keeping the connection
AsyncQueue::getEventFileLoaded().connect(fileloaded_event_connection, fileloaded_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
fileloaded_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
fileloaded_event_connection.setEnabled(true);
// ...
// remove subscription to the FileLoaded event via the connection
fileloaded_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FileLoaded event handler implemented as a class member
void event_handler(const char * name, int id)
{
Log::message("\Handling FileLoaded event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
AsyncQueue::getEventFileLoaded().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FileLoaded event with a handler function
AsyncQueue::getEventFileLoaded().connect(fileloaded_event_handler);
// remove subscription to the FileLoaded event later by the handler function
AsyncQueue::getEventFileLoaded().disconnect(fileloaded_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId fileloaded_handler_id;
// subscribe to the FileLoaded event with a lambda handler function and keeping connection ID
fileloaded_handler_id = AsyncQueue::getEventFileLoaded().connect([](const char * name, int id) {
Log::message("\Handling FileLoaded event (lambda).\n");
}
);
// remove the subscription later using the ID
AsyncQueue::getEventFileLoaded().disconnect(fileloaded_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FileLoaded events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
AsyncQueue::getEventFileLoaded().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
AsyncQueue::getEventFileLoaded().setEnabled(true);
Return value
Event reference.Ptr<Image> getImage ( int id ) #
Returns the image loaded by the specified operation.Arguments
- int id - Loading operation identifier (see the loadImage() method).
Return value
Image smart pointer.Ptr<Mesh> getMesh ( int id ) #
Returns the mesh loaded by the specified operation.Arguments
- int id - Loading operation identifier (see the loadMesh() method).
Return value
Mesh smart pointer.Ptr<Node> getNode ( int id ) #
Returns the node loaded by the specified operation. If the node loaded by the specified operation consists of multiple objects, a new dummy object to combine them is created and its smart pointer is returned.Arguments
- int id - Loading operation identifier (see the loadNode() method).
Return value
Node smart pointer.int getNodes ( int id, Vector<Ptr<Node>> & OUT_nodes ) const#
Puts the nodes loaded by the specified operation to the specified array. If the node loaded by the specified operation consists of multiple objects, they are put into the array.Arguments
- int id - Loading operation identifier.
- Vector<Ptr<Node>> & OUT_nodes - Array of loaded nodes' smart pointers.This output buffer is to be filled by the Engine as a result of executing the method.
Return value
1 if the operation is successful; otherwise, 0.int getNumLoadedData ( ) const#
Returns the total number of loaded data segments.Return value
Total number of loaded data segments.int getNumLoadedFiles ( ) const#
Returns the total number of loaded files.Return value
Total number of loaded files.int getNumLoadedImages ( ) const#
Returns the total number of queued loaded.Return value
Total number of queued loaded.int getNumLoadedMeshes ( ) const#
Returns the total number of loaded meshes.Return value
Total number of loaded meshes.int getNumLoadedNodes ( ) const#
Returns the total number of loaded nodes.Return value
Total number of loaded nodes including currently processed ones.int getNumLoadedResources ( ) const#
Returns the total number of currently loaded resources. The return value represents the sum of currently loaded data, files, images and meshes.Return value
Total number of loaded resources.int getNumQueuedData ( ) const#
Returns the total number of queued data segments waiting for the background loading. The return value also includes currently processed ones.Return value
Total number of queued data segments including currently processed ones.int getNumQueuedFiles ( ) const#
Returns the total number of queued files waiting for the background loading. The return value also includes currently processed ones.Return value
Total number of queued files including currently processed ones.int getNumQueuedImages ( ) const#
Returns the total number of queued images waiting for the background loading. The return value also includes currently processed ones.Return value
Total number of queued images including currently processed ones.int getNumQueuedMeshes ( ) const#
Returns the total number of queued meshes waiting for the background loading. The return value also includes currently processed ones.Return value
Total number of queued meshes including currently processed ones.int getNumQueuedNodes ( ) const#
Returns the total number of queued nodes waiting for the background loading. The return value also includes currently processed ones.Return value
Total number of queued nodes including currently processed ones.int getNumQueuedResources ( ) const#
Returns the total number of queued resources waiting for background loading. The return value represents the sum of queued and currently processed data, files, images and meshes.Return value
Total number of queued resources including currently processed ones.float getTotalTime ( ) const#
Returns the total time it took to process the loading queue.Return value
Total processing time, in milliseconds.int checkFile ( int id ) #
Returns a value indicating if the file is in the loading queue or already loaded.Arguments
- int id - Loading operation identifier (see the loadFile() method).
Return value
1 if the file is in the loading queue or already loaded; otherwise, 0.int checkImage ( int id ) #
Returns a value indicating if the image is in the loading queue or already loaded.Arguments
- int id - Loading operation identifier (see the loadImage() method).
Return value
1 if the image is in the loading queue or already loaded; otherwise, 0.int checkMesh ( int id ) #
Returns a value indicating if the mesh is in the loading queue or already loaded.Arguments
- int id - Loading operation identifier (see the loadMesh() method).
Return value
1 if the mesh is in the loading queue or already loaded; otherwise, 0.int checkNode ( int id ) #
Returns a value indicating if the node is in the loading queue or already loaded.Arguments
- int id - Loading operation identifier (see the loadNode() method).
Return value
1 if the node is in the loading queue or already loaded; otherwise, 0.int forceFile ( int id ) #
Forces loading of the file. The specified file will be loaded right after the currently loading file (if any) is processed. All other file system operations are suspended until the forced file is loaded.Arguments
- int id - Loading operation identifier (see the loadFile() method).
Return value
1 if the file is loaded successfully; otherwise, 0.int forceImage ( int id ) #
Forces loading of the image. The specified image will be loaded right after the currently loading image (if any) is processed. All other file system operations are suspended until the forced image is loaded.Arguments
- int id - Loading operation identifier (see the loadImage() method).
Return value
1 if the image is loaded successfully; otherwise, 0.int forceMesh ( int id ) #
Forces loading of the mesh. The specified mesf will be loaded right after the currently loading mesh (if any) is processed. All other file system operations are suspended until the forced mesh is loaded.Arguments
- int id - Loading operation identifier (see the loadMesh() method).
Return value
1 if the mesh is loaded successfully; otherwise, 0.int forceNode ( int id ) #
Forces loading of the node. The specified node will be loaded right after the currently loading node (if any) is processed. All other file system operations are suspended until the forced node is loaded.Arguments
- int id - Loading operation identifier (see the loadNode() method).
Return value
1 if the node is loaded successfully; otherwise, 0.int loadFile ( const char * name, int group = 0, float weight = 0.0f ) #
Loads a given file with the specified group and priority to the thread.Arguments
- const char * name - Absolute or relative path to the file (including its name).
- int group - Priority group. Greater priority means faster loading. The default value is 0.
- float weight - Weight of the priority inside the group. Greater weight means faster loading inside the same priority group. The default value is 0.0f.
Return value
Loading operation identifier.int loadImage ( const char * name, int group = 0, float weight = 0.0f ) #
Loads a given image file with the specified group and priority to the thread.Arguments
- const char * name - Absolute or relative path to the image file (including its name).
- int group - Priority group. Greater priority means faster loading. The default value is 0.
- float weight - Weight of the priority inside the group. Greater weight means faster loading inside the same priority group. The default value is 0.0f.
Return value
Loading operation identifier.int loadMesh ( const char * name, int group = 0, float weight = 0.0f ) #
Loads a given mesh-file with the specified group and priority to the thread.Arguments
- const char * name - Absolute or relative path to the *.mesh file (including its name).
- int group - Priority group. Greater priority means faster loading. The default value is 0.
- float weight - Weight of the priority inside the group. Greater weight means faster loading inside the same priority group. The default value is 0.0f.
Return value
Loading operation identifier.int loadNode ( const char * name, int group = 0, float weight = 0.0f ) #
Loads a given node-file with the specified group and priority to the thread.Arguments
- const char * name - Absolute or relative path to the *.node file (including its name).
- int group - Priority group. Greater priority means faster loading. The default value is 0.
- float weight - Weight of the priority inside the group. Greater weight means faster loading inside the same priority group. The default value is 0.0f.
Return value
Loading operation identifier.int removeFile ( int id ) #
Removes the given file from the loading queue or from the list of loaded files, if it was already loaded.Arguments
- int id - Loading operation identifier (see the loadFile() method).
Return value
1 if the file is successfully removed; otherwise, 0.int removeImage ( int id ) #
Removes the given image from the loading queue or from the list of loaded images, if it was already loaded.Arguments
- int id - Loading operation identifier (see the loadImage() method).
Return value
1 if the image is successfully removed; otherwise, 0.int removeMesh ( int id ) #
Removes the given mesh from the loading queue or from the list of loaded meshes, if it was already loaded.Arguments
- int id - Loading operation identifier (see the loadMesh() method).
Return value
1 if the mesh is successfully removed; otherwise, 0.int removeNode ( int id ) #
Removes the given node from the loading queue or from the list of loaded nodes, if it was already loaded.Arguments
- int id - Loading operation identifier (see the loadNode() method).
Return value
1 if the node is removed successfully; otherwise, 0.Ptr<Image> takeImage ( int id ) #
Returns the image loaded by the specified operation and removes it from the list of loaded images.Arguments
- int id - Loading operation identifier (see the loadImage() method).
Return value
Image smart pointer.Ptr<Mesh> takeMesh ( int id ) #
Returns the mesh loaded by the specified operation and removes it from the list of loaded meshes.Arguments
- int id - Loading operation identifier (see the loadMesh() method).
Return value
Mesh smart pointer.Ptr<Node> takeNode ( int id ) #
Returns the node loaded by the specified operation and removes it from the list of loaded nodes.Arguments
- int id - Loading operation identifier (see the loadNode() method).
Return value
Node smart pointer.int takeNodes ( int id, Vector<Ptr<Node>> & OUT_nodes ) const#
Puts the nodes loaded by the specified operation to the specified array and removes them from the list of loaded nodes. If the node loaded by the specified operation consists of multiple objects, they are put into the array.Arguments
- int id - Loading operation identifier.
- Vector<Ptr<Node>> & OUT_nodes - Array of loaded nodes' smart pointers.This output buffer is to be filled by the Engine as a result of executing the method.
Return value
1 if the operation is successful; otherwise, 0.int loadImageInfo ( const char * name, int group = 0, float weight = 0.0f ) #
Loads file info (size format, etc.) for the specified image, group and priority to the thread.Arguments
- const char * name - Absolute or relative path to the image file (including its name).
- int group - Priority group. Greater priority means faster loading. The default value is 0.
- float weight - Weight of the priority inside the group. Greater weight means faster loading inside the same priority group. The default value is 0.0f.