| 1264 | } |
| 1265 | |
| 1266 | void MeshRoad::_initMaterial() |
| 1267 | { |
| 1268 | if (mTopMaterialAsset.notNull()) |
| 1269 | { |
| 1270 | if (!mMatInst[Top] || !String(mTopMaterialAsset->getMaterialDefinitionName()).equal(mMatInst[Top]->getMaterial()->getName(), String::NoCase)) |
| 1271 | { |
| 1272 | SAFE_DELETE(mMatInst[Top]); |
| 1273 | |
| 1274 | Material* tMat = nullptr; |
| 1275 | if (!Sim::findObject(mTopMaterialAsset->getMaterialDefinitionName(), tMat)) |
| 1276 | Con::errorf("MeshRoad::_initMaterial - Material %s was not found.", mTopMaterialAsset->getMaterialDefinitionName()); |
| 1277 | |
| 1278 | mMaterial[Top] = tMat; |
| 1279 | |
| 1280 | if (mMaterial[Top]) |
| 1281 | mMatInst[Top] = mMaterial[Top]->createMatInstance(); |
| 1282 | else |
| 1283 | mMatInst[Top] = MATMGR->createMatInstance("WarningMaterial"); |
| 1284 | |
| 1285 | mMatInst[Top]->init(MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPNTT>()); |
| 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | if (mBottomMaterialAsset.notNull()) |
| 1290 | { |
| 1291 | if (!mMatInst[Bottom] || !String(mBottomMaterialAsset->getMaterialDefinitionName()).equal(mMatInst[Bottom]->getMaterial()->getName(), String::NoCase)) |
| 1292 | { |
| 1293 | |
| 1294 | SAFE_DELETE(mMatInst[Bottom]); |
| 1295 | |
| 1296 | Material* tMat = nullptr; |
| 1297 | if (!Sim::findObject(mBottomMaterialAsset->getMaterialDefinitionName(), tMat)) |
| 1298 | Con::errorf("MeshRoad::_initMaterial - Material %s was not found.", mBottomMaterialAsset->getMaterialDefinitionName()); |
| 1299 | |
| 1300 | mMaterial[Bottom] = tMat; |
| 1301 | |
| 1302 | if (mMaterial[Bottom]) |
| 1303 | mMatInst[Bottom] = mMaterial[Bottom]->createMatInstance(); |
| 1304 | else |
| 1305 | mMatInst[Bottom] = MATMGR->createMatInstance("WarningMaterial"); |
| 1306 | |
| 1307 | mMatInst[Bottom]->init(MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPNTT>()); |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | if (mSideMaterialAsset.notNull()) |
| 1312 | { |
| 1313 | if (!mMatInst[Side] || !String(mSideMaterialAsset->getMaterialDefinitionName()).equal(mMatInst[Side]->getMaterial()->getName(), String::NoCase)) |
| 1314 | { |
| 1315 | SAFE_DELETE(mMatInst[Side]); |
| 1316 | |
| 1317 | Material* tMat = nullptr; |
| 1318 | if (!Sim::findObject(mSideMaterialAsset->getMaterialDefinitionName(), tMat)) |
| 1319 | Con::errorf("MeshRoad::_initMaterial - Material %s was not found.", mSideMaterialAsset->getMaterialDefinitionName()); |
| 1320 | |
| 1321 | mMaterial[Side] = tMat; |
| 1322 | |
| 1323 | if (mMaterial[Side]) |
nothing calls this directly
no test coverage detected