| 231 | } |
| 232 | |
| 233 | void TSShapeInstance::setMaterialList( TSMaterialList *matList ) |
| 234 | { |
| 235 | // get rid of old list |
| 236 | if ( mOwnMaterialList ) |
| 237 | delete mMaterialList; |
| 238 | |
| 239 | mMaterialList = matList; |
| 240 | mOwnMaterialList = false; |
| 241 | |
| 242 | // If the material list is already be mapped then |
| 243 | // don't bother doing the initializing a second time. |
| 244 | // Note: only check the last material instance as this will catch both |
| 245 | // uninitialised lists, as well as initialised lists that have had new |
| 246 | // materials appended |
| 247 | if ( mMaterialList && !mMaterialList->getMaterialInst( mMaterialList->size()-1 ) ) |
| 248 | { |
| 249 | mMaterialList->setTextureLookupPath( mShapeResource.getPath().getPath() ); |
| 250 | mMaterialList->mapMaterials(); |
| 251 | Material::sAllowTextureTargetAssignment = true; |
| 252 | initMaterialList(); |
| 253 | Material::sAllowTextureTargetAssignment = false; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | void TSShapeInstance::cloneMaterialList( const FeatureSet *features ) |
| 258 | { |
no test coverage detected