Skip to content

Commit

Permalink
Merge pull request #49 from untereiner/few_changes
Browse files Browse the repository at this point in the history
Few changes
  • Loading branch information
pierrekraemer authored May 22, 2017
2 parents 78b7584 + f2099ef commit 5923a09
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 4 deletions.
25 changes: 24 additions & 1 deletion schnapps/core/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ uint32 View::view_count_ = 0;
View::View(const QString& name, SCHNApps* s) :
name_(name),
schnapps_(s),
background_color_(0.1f, 0.1f, 0.2f, 0.0f),
current_camera_(nullptr),
bb_min_(0.0, 0.0, 0.0),
bb_max_(0.0, 0.0, 0.0),
Expand All @@ -65,6 +66,8 @@ View::View(const QString& name, SCHNApps* s) :
{
++view_count_;

this->setAutoFillBackground(true);

this->setSnapshotFormat("BMP");
this->setSnapshotFileName(name_);
this->setSnapshotQuality(100);
Expand Down Expand Up @@ -98,6 +101,9 @@ View::View(const QString& name, SCHNApps* s) :
dialog_cameras_->check(current_camera_->get_name(), Qt::Checked);

connect(schnapps_, SIGNAL(schnapps_closing()), this, SLOT(close_dialogs()));

color_dial_ = new QColorDialog(background_color_, nullptr);
connect(color_dial_, SIGNAL(accepted()), this, SLOT(color_selected()));
}

View::~View()
Expand Down Expand Up @@ -326,7 +332,7 @@ void View::init()
this->setCamera(current_camera_);
// delete c;

glClearColor(0.1f, 0.1f, 0.2f, 0.0f);


frame_drawer_ = cgogn::make_unique<cgogn::rendering::DisplayListDrawer>();
frame_drawer_renderer_ = frame_drawer_->generate_renderer();
Expand All @@ -345,6 +351,10 @@ void View::init()
button_area_ = new ViewButtonArea(this);
button_area_->set_top_right_position(this->width(), 0);

color_button_ = new ViewButton(":icons/icons/color.png", this);
button_area_->add_button(color_button_);
connect(color_button_, SIGNAL(clicked(int, int, int, int)), this, SLOT(ui_color_view(int, int, int, int)));

Vsplit_button_ = new ViewButton(":icons/icons/Vsplit.png", this);
button_area_->add_button(Vsplit_button_);
connect(Vsplit_button_, SIGNAL(clicked(int, int, int, int)), this, SLOT(ui_vertical_split_view(int, int, int, int)));
Expand Down Expand Up @@ -724,6 +734,13 @@ void View::update_bb()
emit(bb_changed());
}

void View::color_selected()
{
background_color_ = color_dial_->currentColor();
this->makeCurrent();
glClearColor(background_color_.redF(), background_color_.greenF(), background_color_.blueF(), background_color_.alphaF());
}

void View::ui_vertical_split_view(int, int, int, int)
{
schnapps_->split_view(name_, Qt::Horizontal);
Expand All @@ -739,6 +756,12 @@ void View::ui_close_view(int, int, int, int)
schnapps_->remove_view(name_);
}

void View::ui_color_view(int, int, int, int)
{
color_dial_->show();
color_dial_->setCurrentColor(background_color_);
}

void View::ui_maps_list_view(int, int, int globalX, int globalY)
{
if (dialog_maps_->isHidden())
Expand Down
9 changes: 9 additions & 0 deletions schnapps/core/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#ifndef SCHNAPPS_CORE_VIEW_H_
#define SCHNAPPS_CORE_VIEW_H_

#include <QColorDialog>

#include <schnapps/core/dll.h>
#include <schnapps/core/types.h>

Expand Down Expand Up @@ -254,9 +256,12 @@ private slots:

void update_bb();

void color_selected();

void ui_vertical_split_view(int x, int y, int globalX, int globalY);
void ui_horizontal_split_view(int x, int y, int globalX, int globalY);
void ui_close_view(int x, int y, int globalX, int globalY);
void ui_color_view(int x, int y, int globalX, int globalY);

void ui_maps_list_view(int x, int y, int globalX, int globalY);
void ui_plugins_list_view(int x, int y, int globalX, int globalY);
Expand All @@ -279,6 +284,9 @@ private slots:
QString name_;
SCHNApps* schnapps_;

QColorDialog* color_dial_;
QColor background_color_;

Camera* current_camera_;
std::list<PluginInteraction*> plugins_;
std::list<MapHandlerGen*> maps_;
Expand All @@ -289,6 +297,7 @@ private slots:
ViewButtonArea* button_area_;

ViewButton* close_button_;
ViewButton* color_button_;
ViewButton* Vsplit_button_;
ViewButton* Hsplit_button_;

Expand Down
13 changes: 10 additions & 3 deletions schnapps/plugins/volume_render/volume_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,16 @@ void Plugin_VolumeRender::draw_map(View* view, MapHandlerGen* map, const QMatrix
{
if (p.get_position_vbo())
{
p.shader_simple_color_param_->bind(proj, mv);
map->draw(cgogn::rendering::LINES);
p.shader_simple_color_param_->release();
if(p.volume_drawer_rend_)
{
p.volume_drawer_rend_->draw_edges(proj, mv, view);
}
else
{
p.shader_simple_color_param_->bind(proj, mv);
map->draw(cgogn::rendering::LINES);
p.shader_simple_color_param_->release();
}
}
}

Expand Down
Binary file added schnapps/resources/icons/color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 155 additions & 0 deletions schnapps/resources/icons/color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions schnapps/resources/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
<file>icons/arrow_up.png</file>
<file>icons/minus.png</file>
<file>icons/plus.png</file>
<file>icons/color.png</file>
</qresource>
</RCC>

0 comments on commit 5923a09

Please sign in to comment.