erebus

diff src/main.cc @ 19:6204e4d3f445

scene loading
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 27 May 2014 07:43:55 +0300
parents 20d6c05529f1
children e49f4d7ad04c
line diff
     1.1 --- a/src/main.cc	Mon May 26 23:34:12 2014 +0300
     1.2 +++ b/src/main.cc	Tue May 27 07:43:55 2014 +0300
     1.3 @@ -1,6 +1,7 @@
     1.4  #include <stdio.h>
     1.5  #include <stdlib.h>
     1.6  #include <assert.h>
     1.7 +#include <vector>
     1.8  #include "opengl.h"
     1.9  #include "erebus.h"
    1.10  
    1.11 @@ -25,11 +26,17 @@
    1.12  static erebus *erb;
    1.13  static bool render_pending;
    1.14  
    1.15 +static std::vector<char*> sfiles;
    1.16  
    1.17  int main(int argc, char **argv)
    1.18  {
    1.19  	glutInitWindowSize(1024, 600);
    1.20  	glutInit(&argc, argv);
    1.21 +
    1.22 +	for(int i=1; i<argc; i++) {
    1.23 +		sfiles.push_back(argv[i]);
    1.24 +	}
    1.25 +
    1.26  	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    1.27  	glutCreateWindow("erebus OpenGL frontend");
    1.28  
    1.29 @@ -61,8 +68,11 @@
    1.30  	erb_setopti(erb, ERB_OPT_WIDTH, width);
    1.31  	erb_setopti(erb, ERB_OPT_HEIGHT, height);
    1.32  
    1.33 -	if(erb_load_scene(erb, "scene") == -1) {
    1.34 -		return false;
    1.35 +	for(size_t i=0; i<sfiles.size(); i++) {
    1.36 +		printf("loading scene file: %s\n", sfiles[i]);
    1.37 +		if(erb_load_scene(erb, sfiles[i]) == -1) {
    1.38 +			return false;
    1.39 +		}
    1.40  	}
    1.41  
    1.42  	printf("begin rendering\n");