comparison gldragon.cpp @ 31:6847715b46cd

Move piece of code a bit as a cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 22 Nov 2019 19:53:55 +0200
parents 097184bd34a8
children 1215fdd0a8ab
comparison
equal deleted inserted replaced
30:1a0e823283e4 31:6847715b46cd
419 printf("ERROR: Scenefile '%s' contains no models.\n", 419 printf("ERROR: Scenefile '%s' contains no models.\n",
420 optInputFilename.c_str()); 420 optInputFilename.c_str());
421 goto exit; 421 goto exit;
422 } 422 }
423 423
424 // Define a default light if none defined in scene file
425 if (scene.lights.size() == 0)
426 {
427 DMLight light; // Default light
428 scene.lights.push_back(light);
429 }
430
424 printf("INFO: Loading %ld model(s) ..\n", 431 printf("INFO: Loading %ld model(s) ..\n",
425 scene.models.size()); 432 scene.models.size());
426 433
427 basePath = dmGetPath(optInputFilename); 434 basePath = dmGetPath(optInputFilename);
428 printf("INFO: Model base path '%s'\n", basePath.c_str()); 435 printf("INFO: Model base path '%s'\n", basePath.c_str());
440 447
441 if (!dmReadText(fragFile, model.fragShaderStr, SET_MAX_SHADER_SIZE) || 448 if (!dmReadText(fragFile, model.fragShaderStr, SET_MAX_SHADER_SIZE) ||
442 !dmReadText(vertFile, model.vertShaderStr, SET_MAX_SHADER_SIZE)) 449 !dmReadText(vertFile, model.vertShaderStr, SET_MAX_SHADER_SIZE))
443 goto exit; 450 goto exit;
444 } 451 }
445 }
446
447 // Define a default light if none defined in scene file
448 if (scene.lights.size() == 0)
449 {
450 DMLight light; // Default light
451 scene.lights.push_back(light);
452 } 452 }
453 453
454 // Initialize SDL + OpenGL 454 // Initialize SDL + OpenGL
455 if (!dmInitSDLGL(optWidth, optHeight, "GLDragon")) 455 if (!dmInitSDLGL(optWidth, optHeight, "GLDragon"))
456 goto exit; 456 goto exit;