MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / dumpSceneToDot

Function dumpSceneToDot

shared/scene/Scene.cpp:383–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void dumpSceneToDot(const char* fileName, const Scene& scene, int* visited)
384{
385 FILE* f = fopen(fileName, "w");
386 fprintf(f, "digraph G\n{\n");
387 for (size_t i = 0; i < scene.globalTransform_.size(); i++)
388 {
389 std::string name = "";
390 std::string extra = "";
391 if (scene.nameForNode_.contains(i))
392 {
393 int strID = scene.nameForNode_.at(i);
394 name = scene.names_[strID];
395 }
396 if (visited)
397 {
398 if (visited[i])
399 extra = ", color = red";
400 }
401 fprintf(f, "n%d [label=\"%s\" %s]\n", (int)i, name.c_str(), extra.c_str());
402 }
403 for (size_t i = 0; i < scene.hierarchy_.size(); i++)
404 {
405 int p = scene.hierarchy_[i].parent_;
406 if (p > -1)
407 fprintf(f, "\t n%d -> n%d\n", p, (int)i);
408 }
409 fprintf(f, "}\n");
410 fclose(f);
411}
412
413/** A rather long algorithm (and the auxiliary routines) to delete a number of scene nodes from the hierarchy */
414/* */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected