Monitoring Jobs and Retrieving Updates

When you launch a job by calling ILBStartJob(), you can interact with the job at any time to track its current progress and status, and to process any updates sent by eRnsT.

The type of activities you will need to carry out typically depend on the type of rendering job you are running:

Retrieving job progress

You can query a standard baking job at any time to determine what phase of the rendering job is currently being executed, and the approximate percentage of that phase that has been completed. To query for progress, call the ILBGetJobProgress() function.

This is typically done in a loop as follows:

  1. Periodically, call ILBJobHasNewProgress() to determine whether or not a new rendering phase has been started, and whether or not the completion percentage has been updated, since the last call to ILBGetJobProgress().
  2. If ILBJobHasNewProgress() indicates that the current activity or completion percentage has been updated since the last call to ILBGetJobProgress(), call ILBGetJobProgress() again to retrieve the new values.

For example:

ILBBool newProgress;
ILBBool newActivity;
ILBJobHasNewProgress(job, &newActivity, &newProgress);
if (newProgress) {
    ILBStringHandle taskName;
    int32 progress;
    ILBGetJobProgress(job, &taskName, &progress);
    // Handle the progress update here
}

Note that you cannot query the progress of a standalone eRnsT job or a live eRnsT job.

Querying current status

You can determine whether or not a rendering job is currently in progress by calling ILBIsJobRunning().

You can determine whether or not a rendering job is done by calling ILBIsJobCompleted().

Waiting for updates

You can call ILBWaitJobDone() at any time to pause the execution flow of a thread until a rendering job has an update.

For simple rendering jobs, the only update is at the end of the job, so this function effectively waits until the job is completed.

For eRnsT and live eRnsT jobs, this function pauses until a new update is available.

Processing eRnsT updates

When you run an eRnsT job in the standalone eRnsT viewer, or a live eRnsT job in your level editor, the rendering job will periodically provide you with updates. Depending on the type of rendering job, these updates will contain different kinds of information and need to be processed in different ways:

For both types of jobs, the general procedure to retrieve the update is the same:

  1. Create a new ILBBool and a new ILBJobUpdateHandle, and pass them in a call to ILBGetJobUpdate(). Your ILBBool is updated to indicate whether or not an update has occurred in the eRnsT interface. If it evaluates to true, the ILBJobUpdateHandle is updated with details about the change.
  2. To find out what kind of change was made, create a new ILBUpdateType and pass it with your ILBJobUpdateHandle in a call to ILBGetJobUpdateType().
  3. The ILBGetJobUpdateType() function updates your ILBUpdateType to an element from the ILBUpdateType enumeration that indicates the kind of change made. Depending on the value assigned to your ILBUpdateType, you will need to make different kinds of changes:

    Standalone eRnsT jobs can produce the following types of updates:

    • ILB_UT_NEW_LIGHTSOURCE, ILB_UT_UPDATE_LIGHTSOURCE or ILB_UT_DELETE_LIGHTSOURCE: The user has added, modified or removed a light source. You can call ILBGetUpdateLightSource() to retrieve a handle on the new, modified or deleted light source. The beastlightsource.h file offers several additional ILBGet...() functions for accessing the properties in this handle so that you can update your level accordingly.
    • ILB_UT_SCENE_INFO: The user has modified a global property of the scene. In this case, you can call ILBGetUpdateLightSource() to retrieve a handle that contains the new settings. The beastscene.h file offers additional ILBGet...() functions for accessing the properties in this handle, so that you can update your level accordingly if necessary.
    • ILB_UT_UPDATE_CAMERA: The user has moved the camera to a different position or rotated it to a different orientation. In this case, you can call ILBGetUpdateCamera() to retrieve a handle that contains the new settings. The beastcamera.h file offers additional ILBGet...() functions for accessing the properties in this handle, so that you can update your level accordingly if necessary.
    • ILB_UT_UPDATE_TARGET: The user has changed the way the lighting information for a shape instance is baked to a texture or vertices. In this case, you can call ILBGetUpdateTargetEntity() to retrieve a handle on the target that contains the new settings. The beasttargetentity.h file offers additional ILBGet...() functions for accessing the properties in this handle, so that you can update the instance properties in your level accordingly.

    Live eRnst jobs can produce the following types of updates:

  4. When you are done handling the update, destroy the update by calling ILBDestroyUpdate(). NOTE: do not destroy the frame buffer handle; destroying the update will release the frame buffer.
  5. As long as the eRnsT job is still running, repeat these steps in a loop. When a call to ILBIsJobRunning() indicates that the eRnsT job has been finished, you can exit the loop.

Evaluating the final job results

After a render job has been completed, you can call ILBGetJobResult() to retrieve an element from the ILBJobStatus enumeration that indicates whether the job was completed successfully, or what type of error occurred during the processing.