Commit 23bb9e6f by Luis Penaranda

added options fov, image_dir in the config file

1 parent bd95f302
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=<path to directory containing the shader files>
image_file=<path to the desired input file>
image_file=<full path to the desired input file>
image_dir=<path to directory containing the input files>
fov=<starting value of fov, in degrees>
max_fov=<starting value of max_fov, in degrees>
zblambda=<Zorin-Barr lambda parameter>
zbR=<Zorin-Barr R parameter>
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.
......@@ -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);
}
......
......@@ -88,6 +88,7 @@ private:
char* shader_dir;
char* input_image_file;
char* input_image_dir;
// input image size
int image_size_x;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!