Exemplo n.º 1
0
LitSphereWindow::LitSphereWindow( ParameterWindow* paramWindow )
{
    glWidget = new LitSphereWidget( this, paramWindow->getBRDFList() );

    // so we can tell the parameter window when the incident vector changes (from dragging on the sphere)
    connect( glWidget, SIGNAL(incidentVectorChanged( float, float )), paramWindow, SLOT(incidentVectorChanged( float, float )) );

    connect( paramWindow, SIGNAL(incidentDirectionChanged(float,float)), glWidget, SLOT(incidentDirectionChanged(float,float)) );
    connect( paramWindow, SIGNAL(brdfListChanged(std::vector<brdfPackage>)), glWidget, SLOT(brdfListChanged(std::vector<brdfPackage>)) );

        
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(glWidget);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    mainLayout->addLayout(buttonLayout);

    doubleTheta = new QCheckBox( "Double theta" );
    doubleTheta->setChecked( true );
    connect( doubleTheta, SIGNAL(stateChanged(int)), glWidget, SLOT(doubleThetaChanged(int)) );
    buttonLayout->addWidget(doubleTheta);

    useNDotL = new QCheckBox( "Multiply by N . L" );
    useNDotL->setChecked( true );
    connect( useNDotL, SIGNAL(stateChanged(int)), glWidget, SLOT(useNDotLChanged(int)) );
    buttonLayout->addWidget(useNDotL);

    FloatVarWidget* fv;
        
#if 0
    fv = new FloatVarWidget("Brightness", 0, 100.0, 1.0);
    connect(fv, SIGNAL(valueChanged(float)), glWidget, SLOT(brightnessChanged(float)));
    mainLayout->addWidget(fv);
#endif
    
    fv = new FloatVarWidget("Gamma", 1.0, 5.0, 2.2);
    connect(fv, SIGNAL(valueChanged(float)), glWidget, SLOT(gammaChanged(float)));
    mainLayout->addWidget(fv);
    
    fv = new FloatVarWidget("Exposure", -6.0, 6.0, 0.0);
    connect(fv, SIGNAL(valueChanged(float)), glWidget, SLOT(exposureChanged(float)));
    mainLayout->addWidget(fv);


    setLayout(mainLayout);
    
    setWindowTitle( "Lit Sphere" );
}
Exemplo n.º 2
0
MainWindow::MainWindow()
{
    setWindowTitle( "BRDF Explorer" );

    // create the parameter window
    paramWnd = new ParameterWindow();

    viewer3D = new Plot3DWidget( this->windowHandle(), paramWnd->getBRDFList() );
    connect( paramWnd, SIGNAL(incidentDirectionChanged(float,float)), viewer3D, SLOT(incidentDirectionChanged(float,float)) );
    connect( paramWnd, SIGNAL(graphParametersChanged(bool,bool)), viewer3D, SLOT(graphParametersChanged(bool,bool)) );
    connect( paramWnd, SIGNAL(brdfListChanged(std::vector<brdfPackage>)), viewer3D, SLOT(brdfListChanged(std::vector<brdfPackage>)) );
    plot3D = new ViewerWindow( viewer3D );

    cartesianThetaV = new PlotCartesianWindow( paramWnd, THETA_V_PLOT );
    cartesianThetaH = new PlotCartesianWindow( paramWnd, THETA_H_PLOT );
    cartesianThetaD = new PlotCartesianWindow( paramWnd, THETA_D_PLOT );
    cartesianAlbedo = new PlotCartesianWindow( paramWnd, ALBEDO_PLOT );

    viewer2D = new PlotPolarWidget( this->windowHandle(), paramWnd->getBRDFList() );
    connect( paramWnd, SIGNAL(incidentDirectionChanged(float,float)), viewer2D, SLOT(incidentDirectionChanged(float,float)) );
    connect( paramWnd, SIGNAL(graphParametersChanged(bool,bool)), viewer2D, SLOT(graphParametersChanged(bool,bool)) );
    connect( paramWnd, SIGNAL(brdfListChanged(std::vector<brdfPackage>)), viewer2D, SLOT(brdfListChanged(std::vector<brdfPackage>)) );
    polarPlot = new ViewerWindow(viewer2D);

    viewerSphere = new LitSphereWindow( paramWnd );

    ibl = new IBLWindow( paramWnd );

    imageSlice = new ImageSliceWindow( paramWnd );

    
    
    
    ShowingDockWidget* Plot3DWidget = new ShowingDockWidget("3D Plot", this);
    Plot3DWidget->setWidget( plot3D );
    addDockWidget( Qt::RightDockWidgetArea, Plot3DWidget );
    
    
    

    ShowingDockWidget* paramsWidget = new ShowingDockWidget(tr("BRDF Parameters"), this);
    paramsWidget->setWidget( paramWnd );
    addDockWidget( Qt::LeftDockWidgetArea, paramsWidget );

    ShowingDockWidget* PlotPolarWidget = new ShowingDockWidget(tr("Polar Plot"), this);
    PlotPolarWidget->setWidget( polarPlot );
    addDockWidget( Qt::RightDockWidgetArea, PlotPolarWidget );

    ShowingDockWidget* thetaVWidget = new ShowingDockWidget(tr("Theta V"), this);
    thetaVWidget->setWidget( cartesianThetaV );
    addDockWidget( Qt::RightDockWidgetArea, thetaVWidget );

    ShowingDockWidget* thetaHWidget = new ShowingDockWidget(tr("Theta H"), this);
    thetaHWidget->setWidget( cartesianThetaH );
    addDockWidget( Qt::RightDockWidgetArea, thetaHWidget );

    ShowingDockWidget* thetaDWidget = new ShowingDockWidget(tr("Theta D"), this);
    thetaDWidget->setWidget( cartesianThetaD );
    addDockWidget( Qt::RightDockWidgetArea, thetaDWidget );

    ShowingDockWidget* albedoWidget = new ShowingDockWidget(tr("Albedo"), this);
    albedoWidget->setWidget( cartesianAlbedo );
    addDockWidget( Qt::RightDockWidgetArea, albedoWidget );

    tabifyDockWidget( Plot3DWidget, albedoWidget);
    tabifyDockWidget( albedoWidget, thetaHWidget);
    tabifyDockWidget( thetaHWidget, thetaDWidget );
    tabifyDockWidget( thetaDWidget, thetaVWidget );
    tabifyDockWidget( thetaVWidget, PlotPolarWidget );

    ShowingDockWidget* litSphereWidget = new ShowingDockWidget(tr("Lit Sphere"), this);
    litSphereWidget->setWidget( viewerSphere );
    addDockWidget( Qt::RightDockWidgetArea, litSphereWidget );


    ShowingDockWidget* imageSliceWidget = new ShowingDockWidget(tr("Image Slice"), this);
    imageSliceWidget->setWidget( imageSlice );
    addDockWidget( Qt::RightDockWidgetArea, imageSliceWidget );

    ShowingDockWidget* iblWidget = new ShowingDockWidget(tr("Lit Object"), this);
    iblWidget->setWidget( ibl );
    addDockWidget( Qt::RightDockWidgetArea, iblWidget );


    tabifyDockWidget( imageSliceWidget, iblWidget );
    tabifyDockWidget( iblWidget, litSphereWidget );
    //tabifyDockWidget( litSphereWidget, imageSliceWidget );


    setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
    setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );

    setCentralWidget( new QWidget() ); // dummy central widget
    centralWidget()->hide();

    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    QAction* openBRDF = fileMenu->addAction( "Open BRDF..." );
    openBRDF->setShortcut( QKeySequence("Ctrl+O") );
    connect( openBRDF, SIGNAL(triggered()), paramWnd, SLOT(openBRDFFromFile()) );
    fileMenu->addAction( "&Quit", this, SLOT(close()), QKeySequence("Ctrl+Q") );

    QMenu* utilMenu = menuBar()->addMenu(tr("&Utilities"));
    QAction* reloadAuxShaders = utilMenu->addAction( "Reload Auxiliary Shaders" );
    connect( reloadAuxShaders, SIGNAL(triggered()), ibl->getWidget(), SLOT(reloadAuxShaders()) );

    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    QAction* helpAbout = helpMenu->addAction( "About..." );
    connect( helpAbout, SIGNAL(triggered()), this, SLOT(about()) );

    // make sure everything has the correct incident direction param values at the start
    paramWnd->emitIncidentDirectionChanged();
}
Exemplo n.º 3
0
IBLWindow::IBLWindow( ParameterWindow* paramWindow )
{
    glWidget = new IBLWidget( this, paramWindow->getBRDFList() );

    connect( paramWindow, SIGNAL(incidentDirectionChanged(float,float)), glWidget, SLOT(incidentDirectionChanged(float,float)) );
    connect( paramWindow, SIGNAL(brdfListChanged(std::vector<brdfPackage>)), glWidget, SLOT(brdfListChanged(std::vector<brdfPackage>)) );

    
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(QWidget::createWindowContainer(glWidget));


    FloatVarWidget* fv;
        
#if 0
        fv = new FloatVarWidget("Brightness", 0, 100.0, 1.0);
        connect(fv, SIGNAL(valueChanged(float)), glWidget, SLOT(brightnessChanged(float)));
        mainLayout->addWidget(fv);
#endif

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    mainLayout->addLayout(buttonLayout);

    
    iblCombo = new QComboBox();
    iblCombo->setMinimumWidth( 100 );
    connect( iblCombo, SIGNAL(activated(int)), glWidget, SLOT(renderingModeChanged(int)) );
    buttonLayout->addWidget( iblCombo );
    

    QCheckBox* keepAddingSamplesCheckbox = new QCheckBox( "Keep Sampling" );
    keepAddingSamplesCheckbox->setChecked(true);
    connect( keepAddingSamplesCheckbox, SIGNAL(stateChanged(int)), glWidget, SLOT(keepAddingSamplesChanged(int)) );
    buttonLayout->addWidget(keepAddingSamplesCheckbox);
    
    
    // add the change probe button
    QPushButton* probeButton = new QPushButton();
    QPixmap* probePixmap = new QPixmap( (getImagesPath() + "imageSmall.png").c_str() );
    probeButton->setIconSize( QSize(probePixmap->width(), probePixmap->height()) );
    probeButton->setIcon( QIcon(*probePixmap) );
    probeButton->setFixedWidth( 30 );
    probeButton->setFixedHeight( 24 );
    probeButton->setToolTip( "Switch Environment Probe" );
    connect( probeButton, SIGNAL(clicked()), this, SLOT(loadIBLButtonClicked()) );
    buttonLayout->addWidget( probeButton );
    
    
    // add the change model button
    QPushButton* modelButton = new QPushButton();
    QPixmap* modelPixmap = new QPixmap( (getImagesPath() + "modelSmall.png").c_str() );
    modelButton->setIconSize( QSize(probePixmap->width(), modelPixmap->height()) );
    modelButton->setIcon( QIcon(*modelPixmap) );
    modelButton->setFixedWidth( 30 );
    modelButton->setFixedHeight( 24 );
    modelButton->setToolTip( "Switch Model" );
    connect( modelButton, SIGNAL(clicked()), this, SLOT(loadModelButtonClicked()) );
    buttonLayout->addWidget( modelButton );
    
    
    fv = new FloatVarWidget("Gamma", 1.0, 5.0, 2.2);
    connect(fv, SIGNAL(valueChanged(float)), glWidget, SLOT(gammaChanged(float)));
    mainLayout->addWidget(fv);
    
    fv = new FloatVarWidget("Exposure", -12.0, 12.0, 0.0);
    connect(fv, SIGNAL(valueChanged(float)), glWidget, SLOT(exposureChanged(float)));
    mainLayout->addWidget(fv);


    setLayout(mainLayout);
    
    setWindowTitle( "Lit Sphere" );

    probeFileDialog =  new QFileDialog(this, "Open Cube Map", "", "Ptex Cube Maps (*.penv *.ptex *.ptx)");
    probeFileDialog->setFileMode(QFileDialog::ExistingFile);

    modelFileDialog =  new QFileDialog(this, "Open Model", "", "OBJ files (*.obj)");
    modelFileDialog->setFileMode(QFileDialog::ExistingFile);
}