Beispiel #1
0
void Base::compareScreenShots() const
{
	std::list<int> differences;
	for (int i = 0; i <= m_fileCounter; i++)
	{
		namespace bfs=boost::filesystem;
		const bfs::path referencePathfilename( getReferencePath() / vgTest::getNumberedImageName(getScreenShotName(), i) );
		if (!boost::filesystem::exists(referencePathfilename) )
		{
			FAIL() << "REFERENCES FILES : " + referencePathfilename.string() + " IS NOT CREATED";
		}

		SCOPED_TRACE("Screenshot : " + vgTest::getNumberedImageName(getDatedScreenShotName(), i) + " Reference : " +  vgTest::getNumberedImageName(getScreenShotName(), i)); 

		const bfs::path screenshotPathfilename( getScreenShotPath() / vgTest::getNumberedImageName(getDatedScreenShotName(), i) );
		const bfs::path differencePathfilename( getDifferencePath() / vgTest::getNumberedImageName(getDatedScreenShotName(), i) );
		const int diff = vgTest::compare(	referencePathfilename.string(),
											screenshotPathfilename.string(),
											differencePathfilename.string() );

		EXPECT_EQ( diff, 0 );

		if( diff != 0)
		{
			differences.push_back(i);
		}
	}

	m_log->add("ImagePath", getImagesPath(differences));
}
Beispiel #2
0
void PlotCartesianWidget::initializeText()
{
    // Create font texture
    glf->glGenTextures( 1, &textTexureID );
    glf->glBindTexture( GL_TEXTURE_2D, textTexureID );

    glf->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glf->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glf->glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glf->glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

    QImage img;
    if(!img.load(QString((getImagesPath() + "verasansmono.png").c_str())))
        std::cout << "Can't load font texture" << std::endl;

    glf->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img.width(), img.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, img.convertToFormat(QImage::Format_RGB888).bits());
    glf->glBindTexture( GL_TEXTURE_2D, 0 );

    textShader = new DGLShader( (getShaderTemplatesPath() + "Text.vert").c_str(), (getShaderTemplatesPath() + "Text.frag").c_str(), (getShaderTemplatesPath() + "Text.geom").c_str() );

    glf->glGenVertexArrays(1,&textVAO);
    glf->glGenBuffers(1,&textVBO);
}
Beispiel #3
0
ParameterGroupWidget::ParameterGroupWidget( ParameterWindow* pWindow, BRDFBase* brdfIn )
    : QFrame(), paramWindow(pWindow), brdf(brdfIn), visibleCheckBox(NULL), dirty(true)
{
    // start by setting the draw color of the BRDF
    brdfDrawColor[0] = drawColors[colorIndex][0];
    brdfDrawColor[1] = drawColors[colorIndex][1];
    brdfDrawColor[2] = drawColors[colorIndex][2];

    colorIndex = (colorIndex + 1) % NUM_DRAW_COLORS;



    // now let's get to the layout
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin( 0 );
    layout->setContentsMargins( 0, 0, 0, 0 );

    // the parameter window needs to know to emit changes whenever this BRDF is reloaded
    connect( this, SIGNAL(brdfChanged(ParameterGroupWidget*)), paramWindow, SLOT(emitBRDFListChanged()) );


    // add and connect the show/hide button
    titleButton = new QPushButton( QString("  ") + QString(extractFilename(brdf->getName()).c_str()) );
    titleButton->setFixedHeight( 22 ); 
    connect( titleButton, SIGNAL(clicked()), this, SLOT(titleButtonPushed()) );


    // set the button color to the BRDF's draw color
    changeTitleButtonColor( false );



    // make the command QFrame - contains the visible checkbox and reload/close buttons
    QFrame* cmdFrame = new QFrame;

    QHBoxLayout* cmdLayout = new QHBoxLayout;
    cmdLayout->setMargin( 0 );
    cmdLayout->setContentsMargins( 0, 0, 0, 0 );
    cmdLayout->setSpacing( 11 );
    cmdFrame->setLayout( cmdLayout );


    visibleCheckBox = new QCheckBox( "Visible" );
    visibleCheckBox->setChecked( true );
    cmdLayout->addWidget( visibleCheckBox );
    connect( visibleCheckBox, SIGNAL(stateChanged(int)), this, SLOT(paramChanged()) );


    // add the solo button
    soloButton = new QPushButton();
    QPixmap* soloPixmap = new QPixmap((getImagesPath() + "soloSmall.png").c_str());
    soloButton->setIconSize( QSize(soloPixmap->width(), soloPixmap->height()) );
    soloButton->setIcon( QIcon(*soloPixmap) );
    soloButton->setFixedWidth( 24 );
    soloButton->setFixedHeight( 20 );
    soloButton->setCheckable( true );
    soloButton->setChecked( false );
    soloButton->setToolTip( "Solo this BRDF" );
    connect( soloButton, SIGNAL(clicked()), this, SLOT(soloButtonPushed()) );
    cmdLayout->addWidget( soloButton );


    // add the solo colors button
    soloColorsButton = new QPushButton();
    QPixmap* soloColorsPixmap = new QPixmap((getImagesPath() + "soloColorsSmall.png").c_str());
    soloColorsButton->setIconSize( QSize(soloColorsPixmap->width(), soloColorsPixmap->height()) );
    soloColorsButton->setIcon( QIcon(*soloColorsPixmap) );
    soloColorsButton->setFixedWidth( 24 );
    soloColorsButton->setFixedHeight( 20 );
    soloColorsButton->setCheckable( true );
    soloColorsButton->setChecked( false );
    soloColorsButton->setToolTip( "Solo this BRDF's color channels" );
    connect( soloColorsButton, SIGNAL(clicked()), this, SLOT(soloColorsButtonPushed()) );
    cmdLayout->addWidget( soloColorsButton );
   
    
    QMenu* optionsMenu = new QMenu;
    QAction* reloadAction = optionsMenu->addAction( "Reload BRDF" );
    QPixmap* reloadPixmap = new QPixmap((getImagesPath() + "reloadSmall.png").c_str());
    reloadAction->setIcon( QIcon(*reloadPixmap) );    
    connect( reloadAction, SIGNAL(triggered()), this, SLOT(reloadButtonPushed()) );
    
    QAction* resetAction = optionsMenu->addAction( "Reload BRDF and reset to default" );
    QPixmap* resetPixmap = new QPixmap((getImagesPath() + "resetSmall.png").c_str());
    resetAction->setIcon( QIcon(*resetPixmap) );
    connect( resetAction, SIGNAL(triggered()), this, SLOT(resetButtonPushed()) );
    
    QAction* saveAction = optionsMenu->addAction( "Save Parameters File..." );
    QPixmap* folderPixmap = new QPixmap((getImagesPath() + "folderSmall.png").c_str());
    saveAction->setIcon( QIcon(*folderPixmap) );
    connect( saveAction, SIGNAL(triggered()), this, SLOT(saveParamsFileButtonPushed()) );
    
    optionsMenu->addSeparator();
    
    QAction* closeAction = optionsMenu->addAction( "Close BRDF" );
    QPixmap* closePixmap = new QPixmap((getImagesPath() + "closeSmall.png").c_str());
    closeAction->setIcon( QIcon(*closePixmap) );
    connect( closeAction, SIGNAL(triggered()), this, SLOT(removeButtonPushed()) );
    

    // add the button with the menu dropdown
    QPushButton* menuButton = new QPushButton();
    menuButton->setFixedWidth( 24 );
    menuButton->setFixedHeight( 20 );
    menuButton->setMenu( optionsMenu );    
    cmdLayout->addWidget( menuButton );


    // make the container frame and its layout
    containerFrame = new QFrame;
    containerLayout = new QVBoxLayout( 0 );
    containerLayout->setMargin( 0 );
    containerLayout->setContentsMargins( 0, 0, 0, 0 );
    containerLayout->addWidget( cmdFrame );
    containerLayout->setSpacing( 2 );
    containerFrame->setLayout( containerLayout );

    addParameterWidgets();

    // add the widgets to the layout
    layout->addWidget( titleButton );
    layout->addWidget( containerFrame );


    setLayout(layout);
}
Beispiel #4
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);
}