CubeCreator creates one material that will be applied to each face of the cube. This material is shared by all the cubes in the scene.
We’ll use a Phong shader for the material.
KFbxSurfacePhong* gMaterial = NULL; ...
// Create global material for cube.
void CreateMaterial(KFbxSdkManager* pSdkManager)
{
KString lMaterialName = "material";
KString lShadingName = "Phong";
fbxDouble3 lBlack(0.0, 0.0, 0.0);
fbxDouble3 lRed(1.0, 0.0, 0.0);
fbxDouble3 lDiffuseColor(0.75, 0.75, 0.0);
gMaterial = KFbxSurfacePhong::Create(pSdkManager, lMaterialName.Buffer());
The following properties are used by the Phong shader to calculate the color for each pixel in the material:
// Generate primary and secondary colors. gMaterial->GetEmissiveColor() .Set(lBlack); gMaterial->GetAmbientColor() .Set(lRed); gMaterial->GetDiffuseColor() .Set(lDiffuseColor); gMaterial->GetTransparencyFactor() .Set(40.5); gMaterial->GetShadingModel() .Set(lShadingName); gMaterial->GetShininess() .Set(0.5); }