---------------------------------------------------------------------------- */
| 356 | |
| 357 | /* ---------------------------------------------------------------------------- */ |
| 358 | int main(int argc, char **argv) |
| 359 | { |
| 360 | const char* model_file = NULL; |
| 361 | C_STRUCT aiLogStream stream; |
| 362 | |
| 363 | if (argc < 2) { |
| 364 | print_error("No input model file specified."); |
| 365 | print_run_command(COMMAND_USAGE); |
| 366 | return EXIT_FAILURE; |
| 367 | } |
| 368 | |
| 369 | // Find and execute available commands entered by the user. |
| 370 | for (int i = 1; i < argc; ++i) { |
| 371 | if (!strncmp(argv[i], COMMAND_USAGE, strlen(COMMAND_USAGE))) { |
| 372 | print_usage(); |
| 373 | return EXIT_SUCCESS; |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | // Check and validate the specified model file extension. |
| 378 | model_file = argv[1]; |
| 379 | const char* extension = strrchr(model_file, '.'); |
| 380 | if (!extension) { |
| 381 | print_error("Please provide a file with a valid extension."); |
| 382 | return EXIT_FAILURE; |
| 383 | } |
| 384 | |
| 385 | if (AI_FALSE == aiIsExtensionSupported(extension)) { |
| 386 | print_error("The specified model file extension is currently " |
| 387 | "unsupported in Assimp " ASSIMP_VERSION "."); |
| 388 | return EXIT_FAILURE; |
| 389 | } |
| 390 | |
| 391 | glutInitWindowSize(900,600); |
| 392 | glutInitWindowPosition(100,100); |
| 393 | glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); |
| 394 | glutInit(&argc, argv); |
| 395 | glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); |
| 396 | |
| 397 | glutCreateWindow("Assimp - Very simple OpenGL sample"); |
| 398 | glutDisplayFunc(display); |
| 399 | glutReshapeFunc(reshape); |
| 400 | |
| 401 | /* get a handle to the predefined STDOUT log stream and attach |
| 402 | it to the logging system. It remains active for all further |
| 403 | calls to aiImportFile(Ex) and aiApplyPostProcessing. */ |
| 404 | stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL); |
| 405 | aiAttachLogStream(&stream); |
| 406 | |
| 407 | /* ... same procedure, but this stream now writes the |
| 408 | log messages to assimp_log.txt */ |
| 409 | stream = aiGetPredefinedLogStream(aiDefaultLogStream_FILE,"assimp_log.txt"); |
| 410 | aiAttachLogStream(&stream); |
| 411 | |
| 412 | // Load the model file. |
| 413 | if(0 != loadasset(model_file)) { |
| 414 | print_error("Failed to load model. Please ensure that the specified file exists."); |
| 415 | aiDetachAllLogStreams(); |
nothing calls this directly
no test coverage detected