Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
merging after adding missing includes and removing deprecated AA
  • Loading branch information
bbercovici committed May 6, 2019
2 parents 6fa4dfc + 5bd6d67 commit 93e935b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 49 deletions.
101 changes: 52 additions & 49 deletions SbgatGui/source/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ SettingsWindow::SettingsWindow(Mainwindow * parent) {
this -> background_type_combo_box -> insertItem(1,"Skybox");

// Getting the current antialiasing settings
aa_frames_combo_box -> setCurrentIndex(this -> parent -> qvtkWidget -> GetRenderWindow() -> GetAAFrames());
// TODO deprecated, remove
// aa_frames_combo_box -> setCurrentIndex(this -> parent -> qvtkWidget -> GetRenderWindow() -> GetAAFrames());
antialiasing_group_layout -> addWidget(label_samples, 0, 0, 1, 1);
antialiasing_group_layout -> addWidget(aa_frames_combo_box, 0, 1, 1, 1);

Expand Down Expand Up @@ -172,72 +173,74 @@ void SettingsWindow::show_selected_background_type(int index){
void SettingsWindow::accept() {

// Set new AA settings
this -> parent -> qvtkWidget -> GetRenderWindow() -> SetAAFrames(int(this -> aa_frames_combo_box -> currentText().toDouble()));
// TODO deprecated, remove

// this -> parent -> qvtkWidget -> GetRenderWindow() -> SetAAFrames(int(this -> aa_frames_combo_box -> currentText().toDouble()));

if (open_skybox_directory_dialog_button -> text() != "" && this -> background_type_combo_box -> currentIndex() == 1
&& open_skybox_directory_dialog_button -> text().toStdString() != this -> parent -> get_skybox_pair().first){
std::string skybox_path = open_skybox_directory_dialog_button -> text().toStdString();
const std::string fpath[] = {
skybox_path + "/pX.png",
skybox_path + "/nX.png",
skybox_path + "/pY.png",
skybox_path + "/nY.png",
skybox_path + "/pZ.png",
skybox_path + "/nZ.png",
};

vtkSmartPointer<vtkTexture> texture = vtkSmartPointer<vtkTexture>::New() ;
texture->CubeMapOn();
texture->InterpolateOn();
texture->RepeatOff();
texture->EdgeClampOn();

texture->MipmapOn();

for (int i = 0; i < 6; i++){
vtkNew<vtkPNGReader> imgReader;
imgReader->SetFileName(fpath[i].c_str());
vtkNew<vtkImageFlip> flip;
flip->SetInputConnection(imgReader->GetOutputPort());
flip->SetFilteredAxis(1);
texture->SetInputConnection(i, flip->GetOutputPort(0));
}
const std::string fpath[] = {
skybox_path + "/pX.png",
skybox_path + "/nX.png",
skybox_path + "/pY.png",
skybox_path + "/nY.png",
skybox_path + "/pZ.png",
skybox_path + "/nZ.png",
};

vtkSmartPointer<vtkTexture> texture = vtkSmartPointer<vtkTexture>::New() ;
texture->CubeMapOn();
texture->InterpolateOn();
texture->RepeatOff();
texture->EdgeClampOn();

texture->MipmapOn();

for (int i = 0; i < 6; i++){
vtkNew<vtkPNGReader> imgReader;
imgReader->SetFileName(fpath[i].c_str());
vtkNew<vtkImageFlip> flip;
flip->SetInputConnection(imgReader->GetOutputPort());
flip->SetFilteredAxis(1);
texture->SetInputConnection(i, flip->GetOutputPort(0));
}


// Create the skybox
vtkSmartPointer<vtkSkybox> skybox_actor = vtkSmartPointer<vtkSkybox>::New();
vtkSmartPointer<vtkSkybox> skybox_actor = vtkSmartPointer<vtkSkybox>::New();

skybox_actor -> SetTexture(texture);
skybox_actor -> SetTexture(texture);

this -> parent -> get_renderer() -> AddActor(skybox_actor);
this -> parent -> set_skybox_directory(skybox_path);
this -> parent -> set_skybox_actor(skybox_actor);
}
else if(this -> background_type_combo_box -> currentIndex() == 1 &&
open_skybox_directory_dialog_button -> text().toStdString() == this -> parent -> get_skybox_pair().first){
this -> parent -> get_renderer() -> AddActor(skybox_actor);
this -> parent -> set_skybox_directory(skybox_path);
this -> parent -> set_skybox_actor(skybox_actor);
}
else if(this -> background_type_combo_box -> currentIndex() == 1 &&
open_skybox_directory_dialog_button -> text().toStdString() == this -> parent -> get_skybox_pair().first){
//same skybox, do nothing
}
else{
if (this -> parent -> get_skybox_pair(). first != ""){
this -> parent -> get_renderer() -> RemoveActor(this -> parent -> get_skybox_pair(). second);
this -> parent -> set_skybox_directory("");
this -> parent -> set_skybox_actor(nullptr);
}
else{
if (this -> parent -> get_skybox_pair(). first != ""){
this -> parent -> get_renderer() -> RemoveActor(this -> parent -> get_skybox_pair(). second);
this -> parent -> set_skybox_directory("");
this -> parent -> set_skybox_actor(nullptr);
}


}
}


// Updating the parent window with the new color settings and rendering
this -> parent -> get_renderer() -> SetBackground(
this -> rgb_button[0] / 255.,
this -> rgb_button[1] / 255.,
this -> rgb_button[2] / 255.);
this -> parent -> get_renderer() -> SetGradientBackground(this -> use_gradient_checkbox -> isChecked());
this -> parent -> qvtkWidget -> GetRenderWindow() -> Render();
this -> parent -> get_renderer() -> SetBackground(
this -> rgb_button[0] / 255.,
this -> rgb_button[1] / 255.,
this -> rgb_button[2] / 255.);
this -> parent -> get_renderer() -> SetGradientBackground(this -> use_gradient_checkbox -> isChecked());
this -> parent -> qvtkWidget -> GetRenderWindow() -> Render();


QDialog::accept();
QDialog::accept();

}

Expand Down
2 changes: 2 additions & 0 deletions SbgatGui/source/VertexEditionWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ SOFTWARE.
#include <vtkPolyDataNormals.h>
#include <vtkPointData.h>

#include <vtkRenderWindowInteractor.h>


using namespace SBGAT_GUI;

Expand Down
1 change: 1 addition & 0 deletions SbgatGui/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SOFTWARE.

#include <QApplication>
#include "Mainwindow.hpp"
#include <QSurfaceFormat>

int main( int argc, char** argv ) {

Expand Down

0 comments on commit 93e935b

Please sign in to comment.