Creating a generic material

// Get a pointer to the RED resource manager.
RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
RED::IResourceManager* iresmgr = resmgr->As< RED::IResourceManager >();

// Create a material.
RED::Object* mat;
RC_TEST( iresmgr->CreateMaterial( mat, iresmgr->GetState() ) );
RED::IMaterial* imat = mat->As< RED::IMaterial >();

// Create the two layer sets for real-time and photorealism.
RED::LayerSet realtime, photo;
realtime.AddLayer( 01234567 );
photo.AddLayer( 76543210 );

RC_TEST( imat->SetupGenericMaterial( true, false,
                                     RED::Color::BLACK, NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0,
                                     RED::Color::GREY, NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0,
                                     RED::Color::GREY, NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0,
                                     RED::Color::BLACK, NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0, 0.0f,
                                     RED::Color::GREY, NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0, 0.0f,
                                     true, false, NULL, RED::Matrix::IDENTITY, 1.0,
                                     RED::Color::WHITE, NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0, 0.0f, 
                                     NULL, RED::Matrix::IDENTITY, RED::MCL_TEX0, RED::MCL_USER0,
                                     &realtime, &photo, resmgr, iresmgr->GetState() ) );

// Get the material controller to later update its properties.
RED::Object* matctrl = iresmgr->GetMaterialController( mat );
RED::IMaterialController* imatctrl = matctrl->As< RED::IMaterialController >();

In this sample code, a simple generic material is created. Its parameters are:

At the end, the material controller can be retrieved from the material to update its properties.