BGE Dome: Console arguments: angle, tilt, mode and warpdata (not working yet)

2Do:
(1) open external warpdata file
(2) documentation
(3) preserve scene settings (at least scene->gm.dome) even if you load a new file inside the game (e.g. Yo Frankie loading new levels)
otherwise it's a nightmare to update all your files every time you change your projection system. See note.
Maybe SYS_WriteCommandLineInt/Float/String can be used for that. Gotta investigate further.

* Note: an external warpdata file is a must ! Currently every time you need to calibrate your system you have to update the warp file in all your demo files. This is terrible. I'm glad I *now* have a dome near by to test it ;)
* FYI: A recent 'Yo Frankie in a dome' video if you want to see how it works: http://www.vimeo.com/9629626 I'm going to record a better one tomorrow.
This commit is contained in:
Dalai Felinto 2010-02-24 23:01:49 +00:00
parent b78b12b7ae
commit 47d79b04d1

@ -195,6 +195,17 @@ void usage(const char* program)
printf(" anaglyph (Red-Blue glasses)\n"); printf(" anaglyph (Red-Blue glasses)\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(" depending on the type of stereo you want\n\n");
printf(" -D: start player in dome mode\n");
printf(" --Optional parameters--\n");
printf(" angle = field of view in degrees\n");
printf(" tilt = tilt angle in degrees\n");
printf(" warpdata = a file to use for warping the image\n");
printf(" mode: fisheye (Fisheye)\n");
printf(" truncatedfront (Front-Truncated)\n");
printf(" truncatedrear (Rear-Truncated)\n");
printf(" cubemap (Cube Map)\n");
printf(" sphericalpanoramic (Spherical Panoramic)\n");
printf(" depending on the type of dome you are using\n\n");
#ifndef _WIN32 #ifndef _WIN32
printf(" -i: parent windows ID \n\n"); printf(" -i: parent windows ID \n\n");
#endif #endif
@ -310,6 +321,11 @@ int main(int argc, char** argv)
RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
bool stereoWindow = false; bool stereoWindow = false;
bool stereoParFound = false; bool stereoParFound = false;
int stereoFlag = STEREO_NOSTEREO;
int domeFov = -1;
int domeTilt = -200;
int domeMode = 0;
char* domeWarp = NULL;
int windowLeft = 100; int windowLeft = 100;
int windowTop = 100; int windowTop = 100;
int windowWidth = 640; int windowWidth = 640;
@ -525,30 +541,31 @@ int main(int argc, char** argv)
stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
// only the hardware pageflip method needs a stereo window // only the hardware pageflip method needs a stereo window
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;
} }
if(!strcmp(argv[i], "syncdoubling")) else if(!strcmp(argv[i], "syncdoubling"))
stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW;
if(!strcmp(argv[i], "anaglyph")) else if(!strcmp(argv[i], "anaglyph"))
stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH;
if(!strcmp(argv[i], "sidebyside")) else if(!strcmp(argv[i], "sidebyside"))
stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE; stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE;
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
if(strcmp(argv[i], "stencil") else if(!strcmp(argv[i], "stencil")
stereomode = RAS_STEREO_STENCIL; stereomode = RAS_STEREO_STENCIL;
#endif #endif
i++; i++;
stereoParFound = true; stereoParFound = true;
stereoFlag = STEREO_ENABLED;
} }
else else
{ {
@ -556,6 +573,47 @@ int main(int argc, char** argv)
printf("error: too few options for stereo argument.\n"); printf("error: too few options for stereo argument.\n");
} }
break; break;
case 'D':
stereoFlag = STEREO_DOME;
stereomode = RAS_IRasterizer::RAS_STEREO_DOME;
i++;
if ((i + 1) < argc)
{
if(!strcmp(argv[i], "angle")){
i++;
domeFov = atoi(argv[i++]);
}
if(!strcmp(argv[i], "tilt")){
i++;
domeTilt = atoi(argv[i++]);
}
if(!strcmp(argv[i], "warpdata")){
i++;
domeWarp = argv[i++];
}
if(!strcmp(argv[i], "mode")){
i++;
if(!strcmp(argv[i], "fisheye"))
domeMode = DOME_FISHEYE;
else if(!strcmp(argv[i], "truncatedfront"))
domeMode = DOME_TRUNCATED_FRONT;
else if(!strcmp(argv[i], "truncatedrear"))
domeMode = DOME_TRUNCATED_REAR;
else if(!strcmp(argv[i], "cubemap"))
domeMode = DOME_ENVMAP;
else if(!strcmp(argv[i], "sphericalpanoramic"))
domeMode = DOME_PANORAM_SPH;
else
printf("error: %s is not a valid dome mode.\n", argv[i]);
}
i++;
}
break;
default: default:
printf("Unkown argument: %s\n", argv[i++]); printf("Unkown argument: %s\n", argv[i++]);
break; break;
@ -714,6 +772,24 @@ int main(int argc, char** argv)
stereoWindow = true; stereoWindow = true;
} }
} }
else
scene->gm.stereoflag = STEREO_ENABLED;
if (stereoFlag == STEREO_DOME){
stereomode = RAS_IRasterizer::RAS_STEREO_DOME;
scene->gm.stereoflag = STEREO_DOME;
if (domeFov > 89)
scene->gm.dome.angle = domeFov;
if (domeTilt > -180)
scene->gm.dome.tilt = domeTilt;
if (domeMode > 0)
scene->gm.dome.mode = domeMode;
if (domeWarp)
{
printf("using external file as dome warping. Not implemented yet");
//scene->gm.dome.warptext
}
}
// GPG_Application app (system, maggie, startscenename); // GPG_Application app (system, maggie, startscenename);
app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */