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

Method updateMaterials

Source/Falcor/Scene/Scene.cpp:1750–1799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1748 }
1749
1750 IScene::UpdateFlags Scene::updateMaterials(bool forceUpdate)
1751 {
1752 // Update material system.
1753 FALCOR_ASSERT(mpMaterials);
1754 Material::UpdateFlags materialUpdates = mpMaterials->update(forceUpdate);
1755
1756 IScene::UpdateFlags flags = IScene::UpdateFlags::None;
1757 if (forceUpdate || materialUpdates != Material::UpdateFlags::None)
1758 {
1759 flags |= IScene::UpdateFlags::MaterialsChanged;
1760
1761 // Bind materials parameter block to scene.
1762 if (mpSceneBlock)
1763 {
1764 mpMaterials->bindShaderData(mpSceneBlock->getRootVar()[kMaterialsBlockName]);
1765 }
1766
1767 // If displacement parameters have changed, we need to trigger displacement update.
1768 if (is_set(materialUpdates, Material::UpdateFlags::DisplacementChanged))
1769 {
1770 mDisplacement.needsUpdate = true;
1771 }
1772
1773 // Check if emissive materials have changed.
1774 if (is_set(materialUpdates, Material::UpdateFlags::EmissiveChanged))
1775 {
1776 flags |= IScene::UpdateFlags::EmissiveMaterialsChanged;
1777 }
1778
1779 // Update type conformances.
1780 auto prevTypeConformances = mTypeConformances;
1781 mTypeConformances = mpMaterials->getTypeConformances();
1782 if (mTypeConformances != prevTypeConformances)
1783 {
1784 flags |= IScene::UpdateFlags::TypeConformancesChanged;
1785 }
1786
1787 // Pass on update flag indicating shader code changes.
1788 if (is_set(materialUpdates, Material::UpdateFlags::CodeChanged))
1789 {
1790 flags |= IScene::UpdateFlags::ShaderCodeChanged;
1791 }
1792
1793 // Update material stats upon any material changes for now.
1794 // This is not strictly needed for most changes and can be optimized if the overhead becomes a problem.
1795 updateMaterialStats();
1796 }
1797
1798 return flags;
1799 }
1800
1801 IScene::UpdateFlags Scene::updateGeometry(RenderContext* pRenderContext, bool forceUpdate)
1802 {

Callers

nothing calls this directly

Calls 4

getRootVarMethod · 0.80
updateMethod · 0.45
bindShaderDataMethod · 0.45
getTypeConformancesMethod · 0.45

Tested by

no test coverage detected