void SgMaterialsWinGL::FixPointers( BaArchive *pArchive, BtU8* pMemory ) { // Mark up the material file data m_pMaterialsFileData = (BaMaterialsFileData*) pMemory; // Advance past the number of materials pMemory += sizeof( BaMaterialsFileData ); // Mark up the material blocks m_pMaterialBlocks = (BaMaterialBlockFileData*) pMemory; // Cache the number of materials BtU32 nMaterials = NumMaterials(); // Loop through each of the materials for( BtU32 iMaterialBlock=0; iMaterialBlock<nMaterials; iMaterialBlock++ ) { // Cache each material block BaMaterialBlockFileData& materialBlock = m_pMaterialBlocks[iMaterialBlock]; if( m_pNode->IsDuplicate() == BtFalse ) { // Find the material RsMaterialWinGL* pMaterial = (RsMaterialWinGL*)pArchive->GetResource( materialBlock.m_nMaterial ); // Set the material block materialBlock.m_pMaterial = pMaterial; } else { // Duplicate the material block //materialBlock.m_pMaterial = (RsMaterialWin32*)materialBlock.m_pMaterial->pDuplicate(); } } }
const MCE::FBX::Material& Scene::GetMaterial( int id ) const { FBX_ASSERT( ( id >= 0 ) && ( id < NumMaterials() ), "Index out of bounds" ); const MCE::FBX::Material& material = m_materials[ id ]; return material; }
int Scene::AddMaterial( const MCE::FBX::Material& material ) { int id = NumMaterials(); m_materials.push_back( material ); return id; }