----------------------------------------------------------------------------------- Write a text model dump
| 186 | // ----------------------------------------------------------------------------------- |
| 187 | // Write a text model dump |
| 188 | static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene, IOStream *io, bool shortened) { |
| 189 | time_t tt = ::time(nullptr); |
| 190 | #if _WIN32 |
| 191 | tm *p = gmtime(&tt); |
| 192 | #else |
| 193 | struct tm now; |
| 194 | tm *p = gmtime_r(&tt, &now); |
| 195 | #endif |
| 196 | ai_assert(nullptr != p); |
| 197 | |
| 198 | std::string c = cmd; |
| 199 | std::string::size_type s; |
| 200 | |
| 201 | // https://sourceforge.net/tracker/?func=detail&aid=3167364&group_id=226462&atid=1067632 |
| 202 | // -- not allowed in XML comments |
| 203 | while ((s = c.find("--")) != std::string::npos) { |
| 204 | c[s] = '?'; |
| 205 | } |
| 206 | |
| 207 | // write header |
| 208 | std::string header( |
| 209 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" |
| 210 | "<ASSIMP format_id=\"1\">\n\n" |
| 211 | "<!-- XML Model dump produced by assimp dump\n" |
| 212 | " Library version: %u.%u.%u\n" |
| 213 | " Source: %s\n" |
| 214 | " Command line: %s\n" |
| 215 | " %s\n" |
| 216 | "-->" |
| 217 | " \n\n" |
| 218 | "<Scene flags=\"%u\" postprocessing=\"%u\">\n"); |
| 219 | |
| 220 | const unsigned int majorVersion(aiGetVersionMajor()); |
| 221 | const unsigned int minorVersion(aiGetVersionMinor()); |
| 222 | const unsigned int rev(aiGetVersionRevision()); |
| 223 | const char *curtime = asctime(p); |
| 224 | ioprintf(io, header.c_str(), majorVersion, minorVersion, rev, pFile, c.c_str(), curtime, scene->mFlags, 0u); |
| 225 | |
| 226 | // write the node graph |
| 227 | WriteNode(scene->mRootNode, io, 0); |
| 228 | |
| 229 | #if 0 |
| 230 | // write cameras |
| 231 | for (unsigned int i = 0; i < scene->mNumCameras;++i) { |
| 232 | aiCamera* cam = scene->mCameras[i]; |
| 233 | ConvertName(name,cam->mName); |
| 234 | |
| 235 | // camera header |
| 236 | ioprintf(io,"\t<Camera parent=\"%s\">\n" |
| 237 | "\t\t<Vector3 name=\"up\" > %0 8f %0 8f %0 8f </Vector3>\n" |
| 238 | "\t\t<Vector3 name=\"lookat\" > %0 8f %0 8f %0 8f </Vector3>\n" |
| 239 | "\t\t<Vector3 name=\"pos\" > %0 8f %0 8f %0 8f </Vector3>\n" |
| 240 | "\t\t<Float name=\"fov\" > %f </Float>\n" |
| 241 | "\t\t<Float name=\"aspect\" > %f </Float>\n" |
| 242 | "\t\t<Float name=\"near_clip\" > %f </Float>\n" |
| 243 | "\t\t<Float name=\"far_clip\" > %f </Float>\n" |
| 244 | "\t</Camera>\n", |
| 245 | name.data, |
no test coverage detected