diff --git a/README b/README index a0abe5f5d278df912edd07305f037c8be466a16d..040b46ac0f4081f87cf2e73db33fc94b64339be2 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ This program compiles on GNU/Linux, Mac and Windows (this port is currently -in development). It requires: +in development and may not run). It requires: -qmake, -make, -g++ in GNU/Linux or Mac --Visual C++ in Windows +-Visual C++ or MinGW with g++ in Windows -Qt 4, --OpenGL 3.1 or GLew 1.5.2, +-OpenGL 3.1 or GLew 1.3.5, -freeglut (maybe it also works with glut), -libjpeg, -libpng, and @@ -16,14 +16,20 @@ project (http://gnuwin32.sourceforge.net). Additionally, you need flex because it contains an implementation of unistd.h. To build in GNU/Linux and Mac, simply run qmake and make. In Windows, it -would be easier to go thru QtCreator. +would be easier to go through QtCreator (of course, you can also use +QtCreator on GNU/Linux and Mac). To configure, you can set in the file ~/.panorc the following options. shader_dir= - image_file= + image_file= + image_dir= + fov= max_fov= + zblambda= + zbR= Lines in the file must start with option names, and no spaces should go between option names, equal signs and values. If no shader path is set, the default is ./shaders/. If no input file is set, or the file is missing, a -file chooser will be shown at startup. The default value of max_fov is 60 -degrees. +file chooser will be shown at startup. The default value of max_fov and fov +are 60 degrees. zblambda and zbR are specified in floating-point, following +machine locales. diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 00b18ba7ad8ac5771b7d8c1e77613510a301056f..0b4ce7e25ff3842cc3d0ac718b90b0f993f95e92 100644 --- a/openglcanvas.cpp +++ b/openglcanvas.cpp @@ -205,6 +205,8 @@ void OpenGLCanvas::read_config_file(){ shader_dir[0]='\0'; input_image_file=(char*)malloc(512*sizeof(char)); input_image_file[0]='\0'; + input_image_dir=(char*)malloc(512*sizeof(char)); + input_image_dir[0]='\0'; char *read_line=(char*)malloc(64*sizeof(char)); struct stat testbuf; if(stat(filepath,&testbuf)){ @@ -236,6 +238,12 @@ void OpenGLCanvas::read_config_file(){ input_image_file[strlen(line)-12]='\0'; fprintf(stderr,"input_image_file=%s\n",input_image_file); } + // check for 'image_dir' option + if(!strncmp(line,"image_dir=",10)){ + strcpy(input_image_dir,line+10); + input_image_dir[strlen(line)-11]='\0'; + fprintf(stderr,"input_image_dir=%s\n",input_image_dir); + } // check for 'max_fov' option if(!strncmp(line,"max_fov=",8)){ strcpy(read_line,line+8); @@ -243,6 +251,13 @@ void OpenGLCanvas::read_config_file(){ fov_max=atof(read_line); fprintf(stderr,"max_fov=%f\n",fov_max); } + // check for 'fov' option + if(!strncmp(line,"fov=",4)){ + strcpy(read_line,line+4); + read_line[strlen(line)-5]='\0'; + fov=atof(read_line); + fprintf(stderr,"fov=%f\n",fov); + } // check for 'auto_max_fov' option if(!strncmp(line,"auto_max_fov=",13)){ strcpy(read_line,line+13); @@ -293,7 +308,7 @@ void OpenGLCanvas::load_image(const char *new_image){ } void OpenGLCanvas::change_input_image(){ - const char *fname=QFileDialog::getOpenFileName(this,tr("Choose Panorama File"),"",FileRead::image_types).toStdString().c_str(); + const char *fname=QFileDialog::getOpenFileName(this,tr("Choose Panorama File"),input_image_dir,FileRead::image_types).toStdString().c_str(); if(strlen(fname)>0){ load_image(fname); updateGL(); @@ -322,7 +337,7 @@ void OpenGLCanvas::initializeGL(){ // If the input file does not exist or was not specified. struct stat testbuf; if(stat(input_image_file,&testbuf)||!strcmp(input_image_file,"")){ - load_image(QFileDialog::getOpenFileName(this,tr("Choose Panorama File"),"",FileRead::image_types).toStdString().c_str()); + load_image(QFileDialog::getOpenFileName(this,tr("Choose Panorama File"),input_image_dir,FileRead::image_types).toStdString().c_str()); }else{ load_image(input_image_file); } diff --git a/openglcanvas.h b/openglcanvas.h index 064ba3b1a65a0255401d5b7acbc7cbed515a5f72..9bde7348961605fa6ef795962ec0bbd85de4cf98 100644 --- a/openglcanvas.h +++ b/openglcanvas.h @@ -88,6 +88,7 @@ private: char* shader_dir; char* input_image_file; + char* input_image_dir; // input image size int image_size_x;