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

Method PrintSceneGraph

src/engine/SceneGraph.cpp:1193–1368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1191}
1192
1193void donut::engine::PrintSceneGraph(const std::shared_ptr<SceneGraphNode>& root)
1194{
1195 SceneGraphWalker walker(root.get());
1196 int depth = 0;
1197 while(walker)
1198 {
1199 std::stringstream ss;
1200
1201 for (int i = 0; i < depth; i++)
1202 ss << " ";
1203
1204 if (walker->GetName().empty())
1205 ss << "<Unnamed>";
1206 else
1207 ss << walker->GetName();
1208
1209 bool hasTranslation = dm::any(walker->GetTranslation() != dm::double3::zero());
1210 bool hasRotation = dm::any(walker->GetRotation() != dm::dquat::identity());
1211 bool hasScaling = dm::any(walker->GetScaling() != dm::double3(1.0));
1212
1213 if (hasTranslation || hasRotation || hasScaling)
1214 {
1215 ss << " (";
1216 if (hasTranslation) ss << "T";
1217 if (hasRotation) ss << "R";
1218 if (hasScaling) ss << "S";
1219 ss << ")";
1220 }
1221
1222 auto bbox = walker->GetGlobalBoundingBox();
1223 if (!bbox.isempty())
1224 {
1225 ss << " [" << bbox.m_mins.x << ", " << bbox.m_mins.y << ", " << bbox.m_mins.z << " .. "
1226 << bbox.m_maxs.x << ", " << bbox.m_maxs.y << ", " << bbox.m_maxs.z << "]";
1227 }
1228
1229 if (walker->GetLeaf())
1230 {
1231 ss << ": ";
1232
1233 if (auto meshInstance = dynamic_cast<MeshInstance*>(walker->GetLeaf().get()))
1234 {
1235 if (!meshInstance->GetMesh()->name.empty())
1236 ss << meshInstance->GetMesh()->name;
1237 else
1238 ss << "Unnamed Mesh";
1239
1240 ss << " (" << meshInstance->GetMesh()->geometries.size() << " geometries)";
1241
1242 auto skinnedInstance = dynamic_cast<SkinnedMeshInstance*>(meshInstance);
1243 if (skinnedInstance)
1244 {
1245 ss << " - skinned, " << skinnedInstance->joints.size() << " joints";
1246 }
1247 }
1248 else if (auto animation = dynamic_cast<SceneGraphAnimation*>(walker->GetLeaf().get()))
1249 {
1250 ss << "Animation (" << animation->GetChannels().size() << " channels)";

Callers

nothing calls this directly

Calls 8

infoFunction · 0.85
getMethod · 0.80
GetTargetNodeMethod · 0.80
GetAttributeMethod · 0.80
NextMethod · 0.80
emptyMethod · 0.45
isemptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected