Changeset View
Standalone View
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
| Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | |||||
| static void usage(const char* program, bool isBlenderPlayer) | static void usage(const char* program, bool isBlenderPlayer) | ||||
| { | { | ||||
| const char * consoleoption; | const char * consoleoption; | ||||
| const char * example_filename = ""; | const char * example_filename = ""; | ||||
| const char * example_pathname = ""; | const char * example_pathname = ""; | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| consoleoption = "-c "; | consoleoption = "[-c] "; | ||||
moguri: We should probably leave the space out here and let the printf string handle the space. | |||||
Not Done Inline ActionsI did not touch the space, I only added '[ ]' because -c is optional brita_: I did not touch the space, I only added '[ ]' because -c is optional | |||||
| #else | #else | ||||
| consoleoption = ""; | consoleoption = ""; | ||||
| #endif | #endif | ||||
| if (isBlenderPlayer) { | if (isBlenderPlayer) { | ||||
| example_filename = "filename.blend"; | example_filename = "filename.blend"; | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| example_pathname = "c:\\"; | example_pathname = "c:\\"; | ||||
| #else | #else | ||||
| example_pathname = "/home/user/"; | example_pathname = "/home/user/"; | ||||
| #endif | #endif | ||||
| } | } | ||||
| printf("\n"); | |||||
| printf("usage: %s [-w [w h l t]] [-f [fw fh fb ff]] %s[-g gamengineoptions] " | printf("usage: %s [--options] %s\n\n", program, example_filename); | ||||
| "[-s stereomode] [-m aasamples] %s\n", program, consoleoption, example_filename); | printf("Available options are: [-w [w h l t]] [-f [fw fh fb ff]] %s[-g gamengineoptions] ", consoleoption); | ||||
| printf("[-s stereomode] [-m aasamples]\n"); | |||||
| printf("Optional parameters must be passed in order.\n"); | |||||
| printf("Default values are set in the blend file.\n\n"); | |||||
| printf(" -h: Prints this command summary\n\n"); | printf(" -h: Prints this command summary\n\n"); | ||||
| printf(" -w: display in a window\n"); | printf(" -w: display in a window\n"); | ||||
| printf(" --Optional parameters--\n"); | printf(" --Optional parameters--\n"); | ||||
| printf(" w = window width\n"); | printf(" w = window width\n"); | ||||
| printf(" h = window height\n\n"); | printf(" h = window height\n"); | ||||
| printf(" l = window left coordinate\n"); | printf(" l = window left coordinate\n"); | ||||
| printf(" t = window top coordinate\n"); | printf(" t = window top coordinate\n"); | ||||
| printf(" Note: If w or h is defined, both must be defined.\n"); | printf(" Note: To define 'w' or 'h', both must be used."); | ||||
| printf(" Also, if l or t is defined, all options must be used.\n\n"); | printf("Also, to define 'l' or 't', all four parameters must be used.\n"); | ||||
Not Done Inline ActionsThis should probably be indented. moguri: This should probably be indented. | |||||
Not Done Inline Actions224 has no \n, so 224+225 shows up as one indented line, but it was to big to fit in the code. brita_: 224 has no \n, so 224+225 shows up as one indented line, but it was to big to fit in the code. | |||||
| printf(" Example: -w or -w 500 300 or -w 500 300 0 0\n\n"); | |||||
| printf(" -f: start game in full screen mode\n"); | printf(" -f: start game in fullscreen mode\n"); | ||||
| printf(" --Optional parameters--\n"); | printf(" --Optional parameters--\n"); | ||||
| printf(" fw = full screen mode pixel width\n"); | printf(" fw = fullscreen mode pixel width (use 0 to detect automatically)\n"); | ||||
| printf(" fh = full screen mode pixel height\n\n"); | printf(" fh = fullscreen mode pixel height (use 0 to detect automatically)\n"); | ||||
| printf(" fb = full screen mode bits per pixel\n"); | printf(" fb = fullscreen mode bits per pixel (default unless set in the blend file: 32)\n"); | ||||
| printf(" ff = full screen mode frequency\n"); | printf(" ff = fullscreen mode frequency (default unless set in the blend file: 60)\n"); | ||||
Not Done Inline ActionsI think bits per pixel and frequency both default to the values in their blend files. moguri: I think bits per pixel and frequency both default to the values in their blend files. | |||||
Not Done Inline ActionsEverything defaults to the blend file. I wrote this in 216. brita_: Everything defaults to the blend file. I wrote this in 216.
What I meant is that, if it was not… | |||||
| printf(" Note: If fw or fh is defined, both must be defined.\n"); | printf(" Note: To define 'fw'' or 'fh'', both must be used.\n"); | ||||
| printf(" Also, if fb is used, fw and fh must be used. ff requires all options.\n\n"); | printf(" Example: -f or -f 1024 768 or -f 0 0 16 or -f 1024 728 16 30\n\n"); | ||||
| printf(" -s: start player in stereo\n"); | printf(" -s: start player in stereoscopy mode (requires 3D capable hardware)\n"); | ||||
| printf(" stereomode: hwpageflip (Quad buffered shutter glasses)\n"); | printf(" stereomode: nostereo (default unless stereo is set in the blend file)\n"); | ||||
| printf(" syncdoubling (Above Below)\n"); | |||||
| printf(" sidebyside (Left Right)\n"); | |||||
| printf(" anaglyph (Red-Blue glasses)\n"); | printf(" anaglyph (Red-Blue glasses)\n"); | ||||
| printf(" sidebyside (Left Right)\n"); | |||||
| printf(" syncdoubling (Above Below)\n"); | |||||
| printf(" 3dtvtopbottom (Squashed Top-Bottom for passive glasses)\n"); | |||||
| printf(" interlace (Interlace horizontally)\n"); | |||||
| printf(" vinterlace (Vertical interlace for autostereo display)\n"); | printf(" vinterlace (Vertical interlace for autostereo display)\n"); | ||||
| printf(" depending on the type of stereo you want\n\n"); | printf(" hwpageflip (Quad buffered shutter glasses)\n"); | ||||
| printf(" Example: -s sidebyside or -s vinterlace\n\n"); | |||||
| printf(" -D: start player in dome mode\n"); | printf(" -D: start player in dome mode\n"); | ||||
| printf(" --Optional parameters--\n"); | printf(" --Optional parameters--\n"); | ||||
| printf(" angle = field of view in degrees\n"); | printf(" angle = field of view in degrees\n"); | ||||
| printf(" tilt = tilt angle in degrees\n"); | printf(" tilt = tilt angle in degrees\n"); | ||||
| printf(" warpdata = a file to use for warping the image (absolute path)\n"); | printf(" warpdata = a file to use for warping the image (absolute path)\n"); | ||||
| printf(" mode: fisheye (Fisheye)\n"); | printf(" mode: fisheye (Fisheye)\n"); | ||||
| printf(" truncatedfront (Front-Truncated)\n"); | printf(" truncatedfront (Front-Truncated)\n"); | ||||
| printf(" truncatedrear (Rear-Truncated)\n"); | printf(" truncatedrear (Rear-Truncated)\n"); | ||||
| printf(" cubemap (Cube Map)\n"); | printf(" cubemap (Cube Map)\n"); | ||||
| printf(" sphericalpanoramic (Spherical Panoramic)\n"); | printf(" sphericalpanoramic (Spherical Panoramic)\n"); | ||||
| printf(" depending on the type of dome you are using\n\n"); | printf(" Example: -D or -D mode cubemap\n\n"); | ||||
| printf(" -m: maximum anti-aliasing (eg. 2,4,8,16)\n\n"); | printf(" -m: maximum anti-aliasing (eg. 2,4,8,16)\n\n"); | ||||
| printf(" -i: parent windows ID\n\n"); | printf(" -i: parent window's ID\n\n"); | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| printf(" -c: keep console window open\n\n"); | printf(" -c: keep console window open\n\n"); | ||||
| #endif | #endif | ||||
| printf(" -d: turn debugging on\n\n"); | printf(" -d: turn debugging on\n\n"); | ||||
| printf(" -g: game engine options:\n\n"); | printf(" -g: game engine options:\n\n"); | ||||
| printf(" Name Default Description\n"); | printf(" Name Default Description\n"); | ||||
| printf(" ------------------------------------------------------------------------\n"); | printf(" ------------------------------------------------------------------------\n"); | ||||
| printf(" fixedtime 0 \"Enable all frames\"\n"); | printf(" fixedtime 0 \"Enable all frames\"\n"); | ||||
| printf(" nomipmap 0 Disable mipmaps\n"); | printf(" nomipmap 0 Disable mipmaps\n"); | ||||
| printf(" show_framerate 0 Show the frame rate\n"); | printf(" show_framerate 0 Show the frame rate\n"); | ||||
| printf(" show_properties 0 Show debug properties\n"); | printf(" show_properties 0 Show debug properties\n"); | ||||
| printf(" show_profile 0 Show profiling information\n"); | printf(" show_profile 0 Show profiling information\n"); | ||||
| printf(" blender_material 0 Enable material settings\n"); | printf(" blender_material 0 Enable material settings\n"); | ||||
| printf(" ignore_deprecation_warnings 1 Ignore deprecation warnings\n"); | printf(" ignore_deprecation_warnings 1 Ignore deprecation warnings\n"); | ||||
| printf("\n"); | printf("\n"); | ||||
| printf(" - : all arguments after this are ignored, allowing python to access them from sys.argv\n"); | printf(" - : all arguments after this are ignored, allowing python to access them from sys.argv\n"); | ||||
| printf("\n"); | printf("\n"); | ||||
| printf("example: %s -w 320 200 10 10 -g noaudio%s%s\n", program, example_pathname, example_filename); | printf("example: %s -w 320 200 10 10 -g noaudio %s%s\n", program, example_pathname, example_filename); | ||||
| printf("example: %s -g show_framerate = 0 %s%s\n", program, example_pathname, example_filename); | printf("example: %s -g show_framerate = 0 %s%s\n", program, example_pathname, example_filename); | ||||
| printf("example: %s -i 232421 -m 16 %s%s\n\n", program, example_pathname, example_filename); | printf("example: %s -i 232421 -m 16 %s%s\n\n", program, example_pathname, example_filename); | ||||
| } | } | ||||
| static void get_filename(int argc, char **argv, char *filename) | static void get_filename(int argc, char **argv, char *filename) | ||||
| { | { | ||||
| #ifdef __APPLE__ | #ifdef __APPLE__ | ||||
| /* On Mac we park the game file (called game.blend) in the application bundle. | /* On Mac we park the game file (called game.blend) in the application bundle. | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | #endif | ||||
| int windowTop = 100; | int windowTop = 100; | ||||
| int windowWidth = 640; | int windowWidth = 640; | ||||
| int windowHeight = 480; | int windowHeight = 480; | ||||
| GHOST_TUns32 fullScreenWidth = 0; | GHOST_TUns32 fullScreenWidth = 0; | ||||
| GHOST_TUns32 fullScreenHeight= 0; | GHOST_TUns32 fullScreenHeight= 0; | ||||
| int fullScreenBpp = 32; | int fullScreenBpp = 32; | ||||
| int fullScreenFrequency = 60; | int fullScreenFrequency = 60; | ||||
| GHOST_TEmbedderWindowID parentWindow = 0; | GHOST_TEmbedderWindowID parentWindow = 0; | ||||
| bool isBlenderPlayer = false; | bool isBlenderPlayer = false; //true when lauching from blender or command line. false for bundled player | ||||
| int validArguments=0; | int validArguments=0; | ||||
| bool samplesParFound = false; | bool samplesParFound = false; | ||||
| GHOST_TUns16 aasamples = 0; | GHOST_TUns16 aasamples = 0; | ||||
| #ifdef __linux__ | #ifdef __linux__ | ||||
| #ifdef __alpha__ | #ifdef __alpha__ | ||||
| signal (SIGFPE, SIG_IGN); | signal (SIGFPE, SIG_IGN); | ||||
| #endif /* __alpha__ */ | #endif /* __alpha__ */ | ||||
| ▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | #endif | ||||
| U.anisotropic_filter = 2; | U.anisotropic_filter = 2; | ||||
| // enable fast mipmap generation | // enable fast mipmap generation | ||||
| U.use_gpu_mipmap = 1; | U.use_gpu_mipmap = 1; | ||||
| sound_init_once(); | sound_init_once(); | ||||
| set_free_windowmanager_cb(wm_free); | set_free_windowmanager_cb(wm_free); | ||||
| /* if running blenderplayer the last argument can't be parsed since it has to be the filename. */ | /* if running blenderplayer the last argument can't be parsed since it has to be the filename. else it is bundled */ | ||||
| isBlenderPlayer = !BLO_is_a_runtime(argv[0]); | isBlenderPlayer = !BLO_is_a_runtime(argv[0]); | ||||
| if (isBlenderPlayer) | if (isBlenderPlayer) | ||||
| validArguments = argc - 1; | validArguments = argc - 1; | ||||
| else | else | ||||
| validArguments = argc; | validArguments = argc; | ||||
| /* Parsing command line arguments (can be set from WM_OT_blenderplayer_start) */ | |||||
| #if defined(DEBUG) | |||||
| printf("Parsing command line arguments...\n"); | |||||
| printf("Num of arguments is: %i\n", validArguments-1); //-1 because i starts at 1 | |||||
| #endif | |||||
| for (i = 1; (i < validArguments) && !error | for (i = 1; (i < validArguments) && !error | ||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| && scr_saver_mode == SCREEN_SAVER_MODE_NONE | && scr_saver_mode == SCREEN_SAVER_MODE_NONE | ||||
| #endif | #endif | ||||
| ;) | ;) | ||||
| { | { | ||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| printf("argv[%d] = '%s', %i\n", i, argv[i],argc); | printf("argv[%d] = '%s'\n", i, argv[i]); | ||||
| #endif | #endif | ||||
| if (argv[i][0] == '-') | if (argv[i][0] == '-') | ||||
| { | { | ||||
| /* ignore all args after " - ", allow python to have own args */ | /* ignore all args after " - ", allow python to have own args */ | ||||
| if (argv[i][1]=='\0') { | if (argv[i][1]=='\0') { | ||||
| argc_py_clamped= i; | argc_py_clamped= i; | ||||
| break; | break; | ||||
| } | } | ||||
| switch (argv[i][1]) | switch (argv[i][1]) | ||||
| { | { | ||||
| case 'g': | case 'g': //game engine options (show_framerate, fixedtime, etc) | ||||
| // Parse game options | |||||
| { | { | ||||
| i++; | i++; | ||||
| if (i <= validArguments) | if (i <= validArguments) | ||||
| { | { | ||||
| char* paramname = argv[i]; | char* paramname = argv[i]; | ||||
| // Check for single value versus assignment | // Check for single value versus assignment | ||||
| if (i+1 <= validArguments && (*(argv[i+1]) == '=')) | if (i+1 <= validArguments && (*(argv[i+1]) == '=')) | ||||
| { | { | ||||
| i++; | i++; | ||||
| if (i + 1 <= validArguments) | if (i + 1 <= validArguments) | ||||
| { | { | ||||
| i++; | i++; | ||||
| // Assignment | // Assignment | ||||
| SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i])); | SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i])); | ||||
| SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i])); | SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i])); | ||||
| SYS_WriteCommandLineString(syshandle, paramname, argv[i]); | SYS_WriteCommandLineString(syshandle, paramname, argv[i]); | ||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| printf("%s = '%s'\n", paramname, argv[i]); | printf("%s = '%s'\n", paramname, argv[i]); | ||||
| #endif | #endif | ||||
| i++; | i++; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| error = true; | error = true; | ||||
| printf("error: argument assignment %s without value.\n", paramname); | printf("error: argument assignment %s without value.\n", paramname); | ||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| // SYS_WriteCommandLineInt(syshandle, argv[i++], 1); | // SYS_WriteCommandLineInt(syshandle, argv[i++], 1); | ||||
Not Done Inline ActionsI don't see any change here, other than some whitespace. Whitespace changes should probably be left to their own patch unless you're specifically fixing whitespace. moguri: I don't see any change here, other than some whitespace. Whitespace changes should probably be… | |||||
Not Done Inline ActionsAs I added blocks to the cases, and this one already had a block, I pulled this block one tab left as it affects less lines than pulling all the other cases one tab right. I don't know why it only registered the indentation change in this line. Because it is a comment, maybe? brita_: As I added blocks to the cases, and this one already had a block, I pulled this block one tab… | |||||
| } | } | ||||
| } | } | ||||
| } | |||||
| break; | break; | ||||
| } | |||||
| case 'd': | case 'd': //debug on | ||||
| { | |||||
Not Done Inline ActionsI have added blocks { } to the cases and the comments in the same line so that the switch can be folded in QtCreator for easy viewing brita_: I have added blocks { } to the cases and the comments in the same line so that the switch can… | |||||
| i++; | i++; | ||||
| G.debug |= G_DEBUG; | G.debug |= G_DEBUG; | ||||
| MEM_set_memory_debug(); | MEM_set_memory_debug(); | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| BLI_mempool_set_memory_debug(); | BLI_mempool_set_memory_debug(); | ||||
| #endif | #endif | ||||
| break; | break; | ||||
| } | |||||
| case 'f': | case 'f': //fullscreen mode | ||||
| { | |||||
| i++; | i++; | ||||
| fullScreen = true; | fullScreen = true; | ||||
| fullScreenParFound = true; | fullScreenParFound = true; | ||||
| if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | ||||
| { | { | ||||
| fullScreenWidth = atoi(argv[i++]); | fullScreenWidth = atoi(argv[i++]); | ||||
| fullScreenHeight = atoi(argv[i++]); | fullScreenHeight = atoi(argv[i++]); | ||||
| if ((i + 1) <= validArguments && argv[i][0] != '-') | if ((i + 1) <= validArguments && argv[i][0] != '-') | ||||
| { | { | ||||
| fullScreenBpp = atoi(argv[i++]); | fullScreenBpp = atoi(argv[i++]); | ||||
| if ((i + 1) <= validArguments && argv[i][0] != '-') | if ((i + 1) <= validArguments && argv[i][0] != '-') | ||||
| fullScreenFrequency = atoi(argv[i++]); | fullScreenFrequency = atoi(argv[i++]); | ||||
| } | } | ||||
| } | } | ||||
| else if ((i + 1) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | |||||
| { | |||||
| error = true; | |||||
| printf("error: to define fullscreen width or height, both options must be used.\n"); | |||||
| } | |||||
| break; | break; | ||||
| case 'w': | } | ||||
| // Parse window position and size options | case 'w': //display in a window | ||||
| { | |||||
| i++; | i++; | ||||
| fullScreen = false; | fullScreen = false; | ||||
| windowParFound = true; | windowParFound = true; | ||||
| // Parse window position and size options | |||||
| if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | ||||
| { | { | ||||
| windowWidth = atoi(argv[i++]); | windowWidth = atoi(argv[i++]); | ||||
| windowHeight = atoi(argv[i++]); | windowHeight = atoi(argv[i++]); | ||||
| if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | ||||
| { | { | ||||
| windowLeft = atoi(argv[i++]); | windowLeft = atoi(argv[i++]); | ||||
| windowTop = atoi(argv[i++]); | windowTop = atoi(argv[i++]); | ||||
| } | } | ||||
| else if ((i + 1) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | |||||
| { | |||||
| error = true; | |||||
| printf("error: to define the window left or right coordinates, both options must be used.\n"); | |||||
| } | |||||
| } | |||||
| else if ((i + 1) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') | |||||
| { | |||||
| error = true; | |||||
| printf("error: to define the window's width or height, both options must be used.\n"); | |||||
| } | } | ||||
| break; | break; | ||||
| } | |||||
| case 'h': | case 'h': //display help | ||||
| { | |||||
| usage(argv[0], isBlenderPlayer); | usage(argv[0], isBlenderPlayer); | ||||
| return 0; | return 0; | ||||
| break; | break; | ||||
| case 'i': | } | ||||
| case 'i': //parent window ID | |||||
| { | |||||
| i++; | i++; | ||||
| if ( (i + 1) <= validArguments ) | if ( (i + 1) <= validArguments ) | ||||
| parentWindow = atoi(argv[i++]); | parentWindow = atoi(argv[i++]); | ||||
| else { | else { | ||||
| error = true; | error = true; | ||||
| printf("error: too few options for parent window argument.\n"); | printf("error: too few options for parent window argument.\n"); | ||||
| } | } | ||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| printf("XWindows ID = %d\n", parentWindow); | printf("XWindows ID = %d\n", parentWindow); | ||||
| #endif // defined(DEBUG) | #endif // defined(DEBUG) | ||||
| break; | break; | ||||
| case 'm': | } | ||||
| case 'm': //maximum anti-aliasing (eg. 2,4,8,16) | |||||
| { | |||||
| i++; | i++; | ||||
| samplesParFound = true; | samplesParFound = true; | ||||
| if ((i+1) <= validArguments ) | if ((i+1) <= validArguments ) | ||||
| aasamples = atoi(argv[i++]); | aasamples = atoi(argv[i++]); | ||||
| else | else | ||||
| { | { | ||||
| error = true; | error = true; | ||||
| printf("error: No argument supplied for -m"); | printf("error: No argument supplied for -m"); | ||||
| } | } | ||||
| break; | break; | ||||
| case 'c': | } | ||||
| case 'c': //keep console (windows only) | |||||
| { | |||||
| i++; | i++; | ||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| closeConsole = false; | closeConsole = false; | ||||
| #endif | #endif | ||||
| break; | break; | ||||
| case 's': // stereo | } | ||||
| case 's': //stereo mode | |||||
| { | |||||
| i++; | i++; | ||||
| if ((i + 1) <= validArguments) | if ((i + 1) <= validArguments) | ||||
| { | { | ||||
| stereomode = (RAS_IRasterizer::StereoMode) atoi(argv[i]); | stereoParFound = true; | ||||
Not Done Inline Actionsremoved this because 'no stereo' is already set as default int the declaration of 'stereomode' brita_: removed this because 'no stereo' is already set as default int the declaration of 'stereomode' | |||||
| if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO) | stereoFlag = STEREO_ENABLED; | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; | |||||
| if (!strcmp(argv[i], "nostereo")) // ok, redundant but clear | if (!strcmp(argv[i], "nostereo")) // may not be redundant if the file has different setting | ||||
| { | |||||
| stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; | stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; | ||||
| stereoFlag = STEREO_NOSTEREO; | |||||
| } | |||||
| // only the hardware pageflip method needs a stereo window | // only the hardware pageflip method needs a stereo window | ||||
| else if (!strcmp(argv[i], "hwpageflip")) { | else if (!strcmp(argv[i], "hwpageflip")) { | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED; | stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED; | ||||
| stereoWindow = true; | stereoWindow = true; | ||||
| } | } | ||||
| else if (!strcmp(argv[i], "syncdoubling")) | else if (!strcmp(argv[i], "syncdoubling")) | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; | stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; | ||||
| else if (!strcmp(argv[i], "3dtvtopbottom")) | else if (!strcmp(argv[i], "3dtvtopbottom")) | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_3DTVTOPBOTTOM; | stereomode = RAS_IRasterizer::RAS_STEREO_3DTVTOPBOTTOM; | ||||
| else if (!strcmp(argv[i], "anaglyph")) | else if (!strcmp(argv[i], "anaglyph")) | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; | stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; | ||||
| else if (!strcmp(argv[i], "sidebyside")) | else if (!strcmp(argv[i], "sidebyside")) | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE; | stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE; | ||||
| else if (!strcmp(argv[i], "interlace")) | |||||
| stereomode = RAS_IRasterizer::RAS_STEREO_INTERLACED; | |||||
| else if (!strcmp(argv[i], "vinterlace")) | else if (!strcmp(argv[i], "vinterlace")) | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE; | stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE; | ||||
| #if 0 | #if 0 | ||||
| // // future stuff | // // future stuff | ||||
| // else if (!strcmp(argv[i], "stencil") | // else if (!strcmp(argv[i], "stencil") | ||||
| // stereomode = RAS_STEREO_STENCIL; | // stereomode = RAS_STEREO_STENCIL; | ||||
| #endif | #endif | ||||
| else | |||||
| { | |||||
| error = true; | |||||
| printf("error: stereomode '%s' unrecognized.\n", argv[i]); | |||||
Not Done Inline ActionsIt looks like you're already adding "new" errors for the window and fullscreen parameters, so we might as well add this one too. Old scripts should be simple to update (and I don't think there are many that would require an update because of this). moguri: It looks like you're already adding "new" errors for the window and fullscreen parameters, so… | |||||
| } | |||||
| i++; | i++; | ||||
| stereoParFound = true; | |||||
| stereoFlag = STEREO_ENABLED; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| error = true; | error = true; | ||||
| printf("error: too few options for stereo argument.\n"); | printf("error: too few options for stereo argument.\n"); | ||||
| } | } | ||||
| break; | break; | ||||
| case 'D': | } | ||||
| case 'D': //dome mode | |||||
| { | |||||
| stereoFlag = STEREO_DOME; | stereoFlag = STEREO_DOME; | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_DOME; | stereomode = RAS_IRasterizer::RAS_STEREO_DOME; | ||||
| i++; | i++; | ||||
| if ((i + 1) <= validArguments) | if ((i + 1) <= validArguments) | ||||
| { | { | ||||
| if (!strcmp(argv[i], "angle")) { | if (!strcmp(argv[i], "angle")) { | ||||
| i++; | i++; | ||||
| domeFov = atoi(argv[i++]); | domeFov = atoi(argv[i++]); | ||||
| Show All 24 Lines | #endif | ||||
| domeMode = DOME_PANORAM_SPH; | domeMode = DOME_PANORAM_SPH; | ||||
| else | else | ||||
| printf("error: %s is not a valid dome mode.\n", argv[i]); | printf("error: %s is not a valid dome mode.\n", argv[i]); | ||||
| } | } | ||||
| i++; | i++; | ||||
| } | } | ||||
| break; | break; | ||||
| default: | } | ||||
| default: //not recognized | |||||
| { | |||||
| printf("Unknown argument: %s\n", argv[i++]); | printf("Unknown argument: %s\n", argv[i++]); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| else | else | ||||
| { | { | ||||
| i++; | i++; | ||||
| } | } | ||||
| } | } | ||||
| if ((windowWidth < kMinWindowWidth) || (windowHeight < kMinWindowHeight)) | if ((windowWidth < kMinWindowWidth) || (windowHeight < kMinWindowHeight)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | if (GHOST_ISystem::createSystem() == GHOST_kSuccess) { | ||||
| BLI_path_abs(temppath, pathname); | BLI_path_abs(temppath, pathname); | ||||
| bfd = load_game_data(temppath); | bfd = load_game_data(temppath); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| bfd = load_game_data(BLI_program_path(), filename[0]? filename: NULL); | bfd = load_game_data(BLI_program_path(), filename[0]? filename: NULL); | ||||
| } | } | ||||
| //::printf("game data loaded from %s\n", filename); | #if defined(DEBUG) | ||||
| printf("Game data loaded from %s\n", filename); | |||||
| #endif | |||||
| if (!bfd) { | if (!bfd) { | ||||
| usage(argv[0], isBlenderPlayer); | usage(argv[0], isBlenderPlayer); | ||||
| error = true; | error = true; | ||||
| exitcode = KX_EXIT_REQUEST_QUIT_GAME; | exitcode = KX_EXIT_REQUEST_QUIT_GAME; | ||||
| } | } | ||||
| else { | else { | ||||
| /* Setting options according to the blend file if not overriden in the command line */ | |||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| #if !defined(DEBUG) | #if !defined(DEBUG) | ||||
| if (closeConsole) { | if (closeConsole) { | ||||
| system->toggleConsole(0); // Close a console window | system->toggleConsole(0); // Close a console window | ||||
| } | } | ||||
| #endif // !defined(DEBUG) | #endif // !defined(DEBUG) | ||||
| #endif // WIN32 | #endif // WIN32 | ||||
| Main *maggie = bfd->main; | Main *maggie = bfd->main; | ||||
| Show All 27 Lines | #endif // WIN32 | ||||
| { | { | ||||
| fullScreen = false; | fullScreen = false; | ||||
| windowWidth = scene->gm.xplay; | windowWidth = scene->gm.xplay; | ||||
| windowHeight = scene->gm.yplay; | windowHeight = scene->gm.yplay; | ||||
| } | } | ||||
| } | } | ||||
| // Check whether the game should be displayed in stereo | // Check whether the game should be displayed in stereo (dome included) | ||||
| if (!stereoParFound) { | if (!stereoParFound) { | ||||
| // Only use file settings when command line did not override | |||||
| if (scene->gm.stereoflag == STEREO_ENABLED) { | if (scene->gm.stereoflag == STEREO_ENABLED) { | ||||
| stereomode = (RAS_IRasterizer::StereoMode) scene->gm.stereomode; | stereomode = (RAS_IRasterizer::StereoMode) scene->gm.stereomode; | ||||
| if (stereomode == RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) | if (stereomode == RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) | ||||
| stereoWindow = true; | stereoWindow = true; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| scene->gm.stereoflag = STEREO_ENABLED; | scene->gm.stereoflag = STEREO_ENABLED; | ||||
| } | } | ||||
| if (!samplesParFound) | if (!samplesParFound) | ||||
| aasamples = scene->gm.aasamples; | aasamples = scene->gm.aasamples; | ||||
| // Dome specific settings | |||||
| if (stereoFlag == STEREO_DOME) { | if (stereoFlag == STEREO_DOME) { | ||||
| stereomode = RAS_IRasterizer::RAS_STEREO_DOME; | stereomode = RAS_IRasterizer::RAS_STEREO_DOME; | ||||
| scene->gm.stereoflag = STEREO_DOME; | scene->gm.stereoflag = STEREO_DOME; | ||||
| if (domeFov > 89) | if (domeFov > 89) | ||||
| scene->gm.dome.angle = domeFov; | scene->gm.dome.angle = domeFov; | ||||
| if (domeTilt > -180) | if (domeTilt > -180) | ||||
| scene->gm.dome.tilt = domeTilt; | scene->gm.dome.tilt = domeTilt; | ||||
| if (domeMode > 0) | if (domeMode > 0) | ||||
| ▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines | |||||
We should probably leave the space out here and let the printf string handle the space.