bool SceneGraph::save(char *filename, void (*callbackFn)(int nNode, void *info), void *callbackFnInfo) { ofstream outputFile(filename); if (!outputFile) return false; uninitialize(); outputFile << "#VRML V2.0 utf8" << endl; int nNode = 0; for (Node *node = Parser::getNodes(); node; node = node->next()) { node->output(outputFile, 0); nNode++; if (callbackFn) callbackFn(nNode, callbackFnInfo); } for (Route *route = Parser::getRoutes(); route; route = route->next()) { route->output(outputFile); } initialize(); return true; }
bool SceneGraph::save(const wchar_t *filename, void (*callbackFn)(int nNode, void *info), void *callbackFnInfo) { char nonsense[100]; wcstombs(nonsense, filename, 100); std::ofstream outputFile(nonsense); if (!outputFile) return false; uninitialize(); outputFile << "#VRML V2.0 utf8" << std::endl; int nNode = 0; for (Node *node = getNodes(); node; node = node->next()) { node->output(outputFile, 0); nNode++; if (callbackFn) callbackFn(nNode, callbackFnInfo); } for (Route *route = getRoutes(); route; route = route->next()) { route->output(outputFile); } initialize(); return true; }
void SceneGraph::print() { uninitialize(); for (Node *node = Parser::getNodes(); node; node = node->next()) { node->print(); } for (Route *route = Parser::getRoutes(); route; route = route->next()) { route->output(cout); } initialize(); }