MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / Refresh

Method Refresh

src/engine/SceneGraph.cpp:959–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

957}
958
959void SceneGraph::Refresh(uint32_t frameIndex)
960{
961 struct StackItem
962 {
963 bool supergraphTransformUpdated = false;
964 bool supergraphContentUpdate = false;
965 };
966
967 bool structureDirty = HasPendingStructureChanges();
968
969 StackItem context;
970 std::vector<StackItem> stack;
971
972 SceneGraphWalker walker(m_Root.get());
973 while (walker)
974 {
975 auto current = walker.Get();
976 auto parent = current->m_Parent;
977
978 // save the current local/global transforms as previous
979 current->m_PrevLocalTransform = current->m_LocalTransform;
980 current->m_PrevGlobalTransform = current->m_GlobalTransform;
981 current->m_PrevGlobalTransformFloat = current->m_GlobalTransformFloat;
982
983 bool currentTransformUpdated = (current->m_Dirty & SceneGraphNode::DirtyFlags::LocalTransform) != 0;
984 bool currentContentUpdated = (current->m_Dirty & SceneGraphNode::DirtyFlags::SubgraphContentUpdate) != 0;
985
986 if (currentTransformUpdated)
987 {
988 current->UpdateLocalTransform();
989 }
990
991 // update the global transform of the current node
992 if (parent)
993 {
994 current->m_GlobalTransform = current->m_HasLocalTransform
995 ? current->m_LocalTransform * parent->m_GlobalTransform
996 : parent->m_GlobalTransform;
997 }
998 else
999 {
1000 current->m_GlobalTransform = current->m_LocalTransform;
1001 }
1002 current->m_GlobalTransformFloat = dm::affine3(current->m_GlobalTransform);
1003
1004 // initialize the global bbox of the current node, start with the leaf (or an empty box if there is no leaf)
1005 if ((current->m_Dirty & (SceneGraphNode::DirtyFlags::SubgraphStructure | SceneGraphNode::DirtyFlags::SubgraphTransforms)) != 0 || context.supergraphTransformUpdated)
1006 {
1007 current->m_GlobalBoundingBox = dm::box3::empty();
1008 if (current->m_Leaf)
1009 {
1010 dm::box3 localBoundingBox = current->m_Leaf->GetLocalBoundingBox();
1011 if (!localBoundingBox.isempty())
1012 current->m_GlobalBoundingBox = localBoundingBox * current->m_GlobalTransformFloat;
1013 }
1014 }
1015
1016 // initialize the content flags of the current node

Callers

nothing calls this directly

Calls 12

getMethod · 0.80
UpdateLocalTransformMethod · 0.80
NextMethod · 0.80
push_backMethod · 0.80
pop_backMethod · 0.80
StackItemClass · 0.70
GetMethod · 0.45
GetLocalBoundingBoxMethod · 0.45
isemptyMethod · 0.45
GetContentFlagsMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected