Loading a File using the Input-Output API

The external file loading and saving functions are exposed through the RED::IOTools class.

// The array containing context IDs:
RED::Vector< unsigned int > contexts;

// Material options:
//  - Load material as RED generic ones.
//  - Load texture transparency informations in their ALPHA channel.
//  - Convert file units to cm.
//  - Use a layerset for realtime and no layerset for photorealistic.
RED::IO_LOAD_MATERIAL_TYPE materialType = RED::IOLMT_GENERIC;
RED::IO_LOAD_TEXTURE_TRANSPARENCY transparencyData = RED::IOLTT_ALPHA;
RED::IO_SYSTEM_UNIT units = RED::IOSU_CM;
RED::LayerSet rtLayer;
rtLayer.AddLayer( 12345 );

// Naming map used to associate the RED object ID to their loaded names.
RED::Map< unsigned int, RED::String > namingTable;

RC_TEST( RED::IOTools::Load( contexts, "../resources/scene.fbx", RED::IOOT_ALL,
                            materialType, &rtLayer, NULL, transparencyData, units, false, iresmgr->GetState(),
                            0, &namingTable, (RED::ProgressCallback)loadingProgressCallback ) );

Like .RED file loading, RED::IOTools loads file inside a context an add it to the list in parameters.

The optional naming map parameter is filled during the loading and associates the RED object ID to their name in the file.

Finally, an optional progress callback can be given. The function will be called regularly during the loading process. The function looks like this:

void loadingProgressCallback( const RED::String& iMessage,
                            float              iProgress )
{
    // Display the message and a progress bar...
}