Defining .red File Policy

The streaming policy controls various aspects of the saving (loading) of .red files.

Here is how you inform HOOPS Luminate of a custom geometry channel data binding (this is needed in order for HOOPS Luminate to use the right compression code regarding to the type of the data being processed: for example, the compressor used is not the same for indices or vertices):

RED::StreamingPolicy policy;

// Here is an example of a custom geometry channels binding:
//
// Vertices are stored in RED::MCL_VERTEX, normals in RED::MCL_USER0 and texture coordinates
// in RED::MCL_COLOR and RED::MCL_USER1.
//
// Detailing the custom binding used lets the engine use the appropriate compressor for the
// channel data and leads to better compression ratio.
//
policy.SetChannelBinding( RED::MCL_VERTEX, RED::StreamingPolicy::DAK_VERTICES );
policy.SetChannelBinding( RED::MCL_USER0, RED::StreamingPolicy::DAK_NORMALS );
policy.SetChannelBinding( RED::MCL_COLOR, RED::StreamingPolicy::DAK_TEXCOORD );
policy.SetChannelBinding( RED::MCL_USER1, RED::StreamingPolicy::DAK_TEXCOORD );

The streaming policy can also be used to filter objects from saving:

// Here, two RED objects are added to the policy filter to be sure they are not saved to a file
// when calling a recursive saving method like RED::IREDFile::WriteDAG.

policy.AddToFilter( collision_mesh );
policy.AddToFilter( hidden_camera );

Finally, the policy can define various behaviours:

Force the loaded images to stay in main memory (no transfer to the video memory)

policy.SetLocalImages( true );

Force the hardware compressed images to be decompressed before saving (to allow usage of the texture on machines without graphics hardware support)

policy.SetForceHWImageDecompression( true );

Disable the automatic saving of material controllers along with the materials

policy.SetMaterialControllerAutoSaving( false );