# HG changeset patch # User John Tsiombikas # Date 1345850168 -10800 # Node ID 527fede3005779424fbe44f7a7bcecf2f7e0b459 # Parent e122ba214ee1858d0400db7d23f80637b5e1b6ce - fixed sphere rendering (PointLight::draw) - added config argument options - fixed macosx compilation diff -r e122ba214ee1 -r 527fede30057 prototype/Makefile --- a/prototype/Makefile Thu Aug 23 18:03:11 2012 +0300 +++ b/prototype/Makefile Sat Aug 25 02:16:08 2012 +0300 @@ -11,10 +11,12 @@ inc = -Ivmath -Idrawtext `pkg-config --cflags freetype2` CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(inc) -CXXFLAGS = $(CFLAGS) -std=c++11 -LDFLAGS = $(libgl) -lm -lassimp -limago `pkg-config --libs freetype2` +CXXFLAGS = $(CFLAGS) -std=c++11 $(add_cxxflags) +LDFLAGS = $(add_ldflags) $(libgl) -lm -lassimp -limago `pkg-config --libs freetype2` ifeq ($(shell uname -s), Darwin) + add_cxxflags = -stdlib=libc++ + add_ldflags = -stdlib=libc++ libgl = -framework OpenGL -framework GLUT -lglew else libgl = -lGL -lGLU -lglut -lGLEW diff -r e122ba214ee1 -r 527fede30057 prototype/src/cfg.cc --- a/prototype/src/cfg.cc Thu Aug 23 18:03:11 2012 +0300 +++ b/prototype/src/cfg.cc Sat Aug 25 02:16:08 2012 +0300 @@ -17,29 +17,33 @@ bool Config::parse_args(int argc, char **argv) { for(int i=1; ix\n"); + if(argv[i][0] == '-') { + if(strcmp(argv[i], "-s") == 0) { + if(sscanf(argv[++i], "%dx%d", &width, &height) != 2) { + fprintf(stderr, "-s must be followed by x\n"); + return false; + } + } else if(strcmp(argv[i], "-stereo") == 0) { + stereo = true; + } else if(strcmp(argv[i], "-level") == 0) { + level_file = argv[++i]; + } else if(strcmp(argv[i], "-tileset") == 0) { + tileset_file = argv[++i]; + } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { + printf("Usage: %s [options]\n", argv[0]); + printf(" -s WxH window size (resolution)\n"); + printf(" -level specify which level file to load\n"); + printf(" -tileset specify which tileset to use\n"); + printf(" -stereo enable stereoscopic rendering\n"); + printf(" -h/-help print usage information and exit\n"); + exit(0); + + } else { + fprintf(stderr, "unrecognized option: %s\n", argv[i]); return false; } - } else if(strcmp(argv[i], "-stereo") == 0) { - stereo = true; - } else if(strcmp(argv[i], "-level") == 0) { - level_file = argv[++i]; - } else if(strcmp(argv[i], "-tileset") == 0) { - tileset_file = argv[++i]; - } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { - printf("Usage: %s [options]\n", argv[0]); - printf(" -s WxH window size (resolution)\n"); - printf(" -level specify which level file to load\n"); - printf(" -tileset specify which tileset to use\n"); - printf(" -stereo enable stereoscopic rendering\n"); - printf(" -h/-help print usage information and exit\n"); - exit(0); - } else { - fprintf(stderr, "unrecognized argument: %s\n", argv[i]); - return false; + level_file = argv[i]; } } return true; diff -r e122ba214ee1 -r 527fede30057 prototype/src/cmdcon.cc --- a/prototype/src/cmdcon.cc Thu Aug 23 18:03:11 2012 +0300 +++ b/prototype/src/cmdcon.cc Sat Aug 25 02:16:08 2012 +0300 @@ -60,7 +60,7 @@ case '\b': if(!cmdline.empty()) { - cmdline.erase(cmdline.back()); + cmdline.pop_back(); // <-- C++11 } break; diff -r e122ba214ee1 -r 527fede30057 prototype/src/light.cc --- a/prototype/src/light.cc Thu Aug 23 18:03:11 2012 +0300 +++ b/prototype/src/light.cc Sat Aug 25 02:16:08 2012 +0300 @@ -124,9 +124,9 @@ float phi = v * M_PI; Vector3 res; - res.x = sin(theta) * cos(phi); - res.y = sin(theta); - res.z = cos(theta) * cos(phi); + res.x = sin(theta) * sin(phi); + res.y = cos(phi); + res.z = cos(theta) * sin(phi); return res; } diff -r e122ba214ee1 -r 527fede30057 prototype/src/main.cc --- a/prototype/src/main.cc Thu Aug 23 18:03:11 2012 +0300 +++ b/prototype/src/main.cc Sat Aug 25 02:16:08 2012 +0300 @@ -78,6 +78,7 @@ glEnable(GL_CULL_FACE); glEnable(GL_MULTISAMPLE); + add_data_path("."); add_data_path("data"); add_data_path("sdr");