Commit 5d488ffc authored by Luis Peñaranda's avatar Luis Peñaranda
Browse files

hidden option to automatically compute fov_max

activate with the option auto_max_fov=1 in ~/.panorc
parent 4465264d
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
    center_phi = 0.f;
    fov_scale_relation = "Square Root";
    visualization = "Perspective";
    auto_fov_max=false;

    time_frames = 0;
    time_timer.setInterval(0);
@@ -84,6 +85,15 @@ void OpenGLCanvas::change_fov(double f){
void OpenGLCanvas::change_fov(int new_fov){
    if(new_fov<=360&&new_fov>=1)
            change_fov((double)new_fov);
    if(auto_fov_max){
        if(new_fov<60)
            change_fov_max(60);
        else
            if(new_fov>180)
                change_fov_max(1);
            else
                change_fov_max(90-new_fov/2);
    }
}

void OpenGLCanvas::change_fov_max(int new_fov_max){
@@ -185,7 +195,7 @@ void OpenGLCanvas::read_config_file(){
    shader_dir[0]='\0';
    input_image_file=(char*)malloc(512*sizeof(char));
    input_image_file[0]='\0';
    char *max_fov_str=(char*)malloc(64*sizeof(char));
    char *read_line=(char*)malloc(64*sizeof(char));
    struct stat testbuf;
    if(stat(filepath,&testbuf)){
        fprintf(stderr,"~/.panorc does not exist\n");
@@ -217,11 +227,18 @@ void OpenGLCanvas::read_config_file(){
            }
            // check for 'max_fov' option
            if(!strncmp(line,"max_fov=",8)){
                strcpy(max_fov_str,line+8);
                max_fov_str[strlen(line)-9]='\0';
                fov_max=atof(max_fov_str);
                strcpy(read_line,line+8);
                read_line[strlen(line)-9]='\0';
                fov_max=atof(read_line);
                fprintf(stderr,"max_fov=%f\n",fov_max);
            }
            // check for 'auto_max_fov' option
            if(!strncmp(line,"auto_max_fov=",13)){
                strcpy(read_line,line+13);
                read_line[strlen(line)-14]='\0';
                auto_fov_max=atof(read_line);
                fprintf(stderr,"auto_max_fov=%d\n",auto_fov_max);
            }
        }
        fclose(rcfile);
    }
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ private:
    double center_phi;
    QString fov_scale_relation;
    QString visualization;
    bool auto_fov_max;

    Chronos time_time;
    QTimer time_timer;