MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / replaceMaterial

Method replaceMaterial

Source/Falcor/Scene/Material/MaterialSystem.cpp:272–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270 }
271
272 void MaterialSystem::replaceMaterial(const MaterialID materialID, const ref<Material>& pReplacement)
273 {
274 FALCOR_CHECK(materialID.isValid() && materialID.get() < mMaterials.size(), "Material ID is invalid.");
275 FALCOR_CHECK(pReplacement != nullptr, "Replacement material is missing.");
276
277 // Remove the previous material.
278 removeMaterial(materialID);
279
280 // Prepare replacement material.
281 if (pReplacement->getDefaultTextureSampler() == nullptr)
282 {
283 pReplacement->setDefaultTextureSampler(mpDefaultTextureSampler);
284 }
285 pReplacement->registerUpdateCallback([this](auto flags) { mMaterialUpdates |= flags; });
286
287 // Replace the material.
288 mMaterials[materialID.get()] = pReplacement;
289 mMaterialsChanged = true;
290 }
291
292 void MaterialSystem::replaceMaterial(const ref<Material>& pMaterial, const ref<Material>& pReplacement)
293 {

Callers

nothing calls this directly

Calls 8

findFunction · 0.85
replaceMaterialFunction · 0.85
isValidMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected