Commit 16a8470d authored by Pierre Kraemer's avatar Pierre Kraemer

Merge branch 'develop' into 'develop'

Develop

See merge request !36
parents 5fcb3fc3 2a010a38
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "schnapps.h" #include "schnapps.h"
#include "Utils/gl_matrices.h" #include "Utils/gl_matrices.h"
#include "Utils/GLSLShader.h" #include "Utils/GLSLShader.h"
#include "Utils/Shaders/shaderWallPaper.h"
#include "Utils/drawer.h" #include "Utils/drawer.h"
namespace CGoGN namespace CGoGN
...@@ -105,7 +106,6 @@ private slots: ...@@ -105,7 +106,6 @@ private slots:
void ui_horizontalSplitView(int x, int y, int globalX, int globalY); void ui_horizontalSplitView(int x, int y, int globalX, int globalY);
void ui_closeView(int x, int y, int globalX, int globalY); void ui_closeView(int x, int y, int globalX, int globalY);
void ui_mapsListView(int x, int y, int globalX, int globalY); void ui_mapsListView(int x, int y, int globalX, int globalY);
void ui_pluginsListView(int x, int y, int globalX, int globalY); void ui_pluginsListView(int x, int y, int globalX, int globalY);
void ui_camerasListView(int x, int y, int globalX, int globalY); void ui_camerasListView(int x, int y, int globalX, int globalY);
...@@ -158,6 +158,8 @@ protected: ...@@ -158,6 +158,8 @@ protected:
Utils::Drawer* m_frameDrawer; Utils::Drawer* m_frameDrawer;
Utils::Texture<2, Geom::Vec3uc>* m_textureWallpaper;
Utils::ShaderWallPaper* m_shaderWallpaper;
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -36,7 +36,12 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) : ...@@ -36,7 +36,12 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) :
m_mapsButton(NULL), m_mapsButton(NULL),
m_pluginsButton(NULL), m_pluginsButton(NULL),
m_camerasButton(NULL), m_camerasButton(NULL),
m_dialogMaps(NULL) m_dialogMaps(NULL),
m_dialogPlugins(NULL),
m_dialogCameras(NULL),
m_frameDrawer(NULL),
m_textureWallpaper(NULL),
m_shaderWallpaper(NULL)
{ {
++viewCount; ++viewCount;
...@@ -75,10 +80,6 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) : ...@@ -75,10 +80,6 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) :
m_dialogCameras->check(m_currentCamera->getName(),Qt::Checked); m_dialogCameras->check(m_currentCamera->getName(),Qt::Checked);
} }
View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget* shareWidget) : View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget* shareWidget) :
QGLViewer(format, NULL, shareWidget), QGLViewer(format, NULL, shareWidget),
b_updatingUI(false), b_updatingUI(false),
...@@ -94,7 +95,12 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget ...@@ -94,7 +95,12 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget
m_mapsButton(NULL), m_mapsButton(NULL),
m_pluginsButton(NULL), m_pluginsButton(NULL),
m_camerasButton(NULL), m_camerasButton(NULL),
m_dialogMaps(NULL) m_dialogMaps(NULL),
m_dialogPlugins(NULL),
m_dialogCameras(NULL),
m_frameDrawer(NULL),
m_textureWallpaper(NULL),
m_shaderWallpaper(NULL)
{ {
++viewCount; ++viewCount;
...@@ -232,7 +238,7 @@ void View::linkPlugin(PluginInteraction* plugin) ...@@ -232,7 +238,7 @@ void View::linkPlugin(PluginInteraction* plugin)
emit(pluginLinked(plugin)); emit(pluginLinked(plugin));
b_updatingUI = true; b_updatingUI = true;
m_dialogPlugins->check(plugin->getName(),Qt::Checked); m_dialogPlugins->check(plugin->getName(), Qt::Checked);
b_updatingUI = false; b_updatingUI = false;
updateGL(); updateGL();
...@@ -256,7 +262,7 @@ void View::unlinkPlugin(PluginInteraction* plugin) ...@@ -256,7 +262,7 @@ void View::unlinkPlugin(PluginInteraction* plugin)
emit(pluginUnlinked(plugin)); emit(pluginUnlinked(plugin));
b_updatingUI = true; b_updatingUI = true;
m_dialogPlugins->check(plugin->getName(),Qt::Unchecked); m_dialogPlugins->check(plugin->getName(), Qt::Unchecked);
b_updatingUI = false; b_updatingUI = false;
updateGL(); updateGL();
...@@ -298,7 +304,7 @@ void View::linkMap(MapHandlerGen* map) ...@@ -298,7 +304,7 @@ void View::linkMap(MapHandlerGen* map)
setManipulatedFrame(map->getFrame()); setManipulatedFrame(map->getFrame());
b_updatingUI = true; b_updatingUI = true;
m_dialogMaps->check(map->getName(),Qt::Checked); m_dialogMaps->check(map->getName(), Qt::Checked);
b_updatingUI = false; b_updatingUI = false;
} }
} }
...@@ -330,7 +336,7 @@ void View::unlinkMap(MapHandlerGen* map) ...@@ -330,7 +336,7 @@ void View::unlinkMap(MapHandlerGen* map)
setManipulatedFrame(NULL); setManipulatedFrame(NULL);
b_updatingUI = true; b_updatingUI = true;
m_dialogMaps->check(map->getName(),Qt::Unchecked); m_dialogMaps->check(map->getName(), Qt::Unchecked);
b_updatingUI = false; b_updatingUI = false;
} }
...@@ -360,7 +366,6 @@ void View::init() ...@@ -360,7 +366,6 @@ void View::init()
// glGetIntegerv(GL_MINOR_VERSION, &minor); // glGetIntegerv(GL_MINOR_VERSION, &minor);
// std::cout << this->getName().toStdString() << "is using GL "<< major <<"."<< minor << std::endl; // std::cout << this->getName().toStdString() << "is using GL "<< major <<"."<< minor << std::endl;
qglviewer::Camera* c = this->camera(); qglviewer::Camera* c = this->camera();
this->setCamera(m_currentCamera); this->setCamera(m_currentCamera);
delete c; delete c;
...@@ -387,7 +392,6 @@ void View::init() ...@@ -387,7 +392,6 @@ void View::init()
m_buttonAreaLeft = new ViewButtonArea(this); m_buttonAreaLeft = new ViewButtonArea(this);
m_buttonAreaLeft->setTopLeftPosition(0, 0); m_buttonAreaLeft->setTopLeftPosition(0, 0);
m_mapsButton = new ViewButton(":icons/icons/maps.png", this); m_mapsButton = new ViewButton(":icons/icons/maps.png", this);
m_buttonAreaLeft->addButton(m_mapsButton); m_buttonAreaLeft->addButton(m_mapsButton);
connect(m_mapsButton, SIGNAL(clicked(int, int, int, int)), this, SLOT(ui_mapsListView(int, int, int, int))); connect(m_mapsButton, SIGNAL(clicked(int, int, int, int)), this, SLOT(ui_mapsListView(int, int, int, int)));
...@@ -400,7 +404,6 @@ void View::init() ...@@ -400,7 +404,6 @@ void View::init()
m_buttonAreaLeft->addButton(m_camerasButton); m_buttonAreaLeft->addButton(m_camerasButton);
connect(m_camerasButton, SIGNAL(clicked(int, int, int, int)), this, SLOT(ui_camerasListView(int, int, int, int))); connect(m_camerasButton, SIGNAL(clicked(int, int, int, int)), this, SLOT(ui_camerasListView(int, int, int, int)));
// FRAME DRAWER // FRAME DRAWER
m_frameDrawer = new Utils::Drawer(); m_frameDrawer = new Utils::Drawer();
...@@ -419,18 +422,36 @@ void View::init() ...@@ -419,18 +422,36 @@ void View::init()
m_frameDrawer->end(); m_frameDrawer->end();
m_frameDrawer->endList(); m_frameDrawer->endList();
std::cout << "end INIT of "<< this->getName().toStdString()<< std::endl; std::cout << "end INIT of " << this->getName().toStdString() << std::endl;
// qglviewer::Camera* c = this->camera(); // qglviewer::Camera* c = this->camera();
// this->setCamera(m_currentCamera); // this->setCamera(m_currentCamera);
// delete c; // delete c;
m_textureWallpaper = new Utils::Texture<2, Geom::Vec3uc>(GL_UNSIGNED_BYTE);
m_textureWallpaper->create(Geom::Vec2ui(1024, 1024));
const float max = m_textureWallpaper->size()[0];
for (unsigned int ki = 0; ki < m_textureWallpaper->size()[0]; ++ki)
{
for (unsigned int kj = 0; kj < m_textureWallpaper->size()[1]; ++kj)
{
float col = 255 - (255 * (ki/max));//*0.85 + 0.15;
(*m_textureWallpaper)(kj, ki) = Geom::Vec3f(col, col, col);
}
}
m_textureWallpaper->update();
m_textureWallpaper->setWrapping(GL_CLAMP_TO_EDGE);
m_shaderWallpaper = new Utils::ShaderWallPaper();
m_shaderWallpaper->setTextureUnit(GL_TEXTURE0);
m_shaderWallpaper->setTexture(m_textureWallpaper);
this->setBackgroundColor(QColor(0,0,0)); this->setBackgroundColor(QColor(0,0,0));
} }
void View::preDraw() void View::preDraw()
{ {
if (Utils::GLSLShader::CURRENT_OGL_VERSION>=3) if (Utils::GLSLShader::CURRENT_OGL_VERSION >= 3)
makeCurrent(); makeCurrent();
m_currentCamera->setScreenWidthAndHeight(width(), height()); m_currentCamera->setScreenWidthAndHeight(width(), height());
...@@ -439,7 +460,7 @@ void View::preDraw() ...@@ -439,7 +460,7 @@ void View::preDraw()
void View::draw() void View::draw()
{ {
if (Utils::GLSLShader::CURRENT_OGL_VERSION>=3) if (Utils::GLSLShader::CURRENT_OGL_VERSION >= 3)
{ {
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS); glDepthFunc(GL_LESS);
...@@ -487,6 +508,8 @@ void View::draw() ...@@ -487,6 +508,8 @@ void View::draw()
foreach(PluginInteraction* plugin, l_plugins) foreach(PluginInteraction* plugin, l_plugins)
plugin->draw(this); plugin->draw(this);
m_shaderWallpaper->draw();
} }
void View::postDraw() void View::postDraw()
...@@ -610,7 +633,6 @@ glm::mat4 View::getCurrentModelViewProjectionMatrix() const ...@@ -610,7 +633,6 @@ glm::mat4 View::getCurrentModelViewProjectionMatrix() const
return mvpm; return mvpm;
} }
void View::selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur) void View::selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur)
{ {
DEBUG_SLOT(); DEBUG_SLOT();
...@@ -619,7 +641,6 @@ void View::selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur) ...@@ -619,7 +641,6 @@ void View::selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur)
updateGL(); updateGL();
} }
void View::ui_verticalSplitView(int x, int y, int globalX, int globalY) void View::ui_verticalSplitView(int x, int y, int globalX, int globalY)
{ {
m_schnapps->splitView(m_name, Qt::Horizontal); m_schnapps->splitView(m_name, Qt::Horizontal);
...@@ -646,10 +667,8 @@ void View::ui_mapsListView(int x, int y, int globalX, int globalY) ...@@ -646,10 +667,8 @@ void View::ui_mapsListView(int x, int y, int globalX, int globalY)
} }
else else
m_dialogMaps->hide(); m_dialogMaps->hide();
} }
void View::ui_pluginsListView(int x, int y, int globalX, int globalY) void View::ui_pluginsListView(int x, int y, int globalX, int globalY)
{ {
if (m_dialogPlugins->isHidden()) if (m_dialogPlugins->isHidden())
...@@ -661,7 +680,6 @@ void View::ui_pluginsListView(int x, int y, int globalX, int globalY) ...@@ -661,7 +680,6 @@ void View::ui_pluginsListView(int x, int y, int globalX, int globalY)
} }
else else
m_dialogPlugins->hide(); m_dialogPlugins->hide();
} }
void View::ui_camerasListView(int x, int y, int globalX, int globalY) void View::ui_camerasListView(int x, int y, int globalX, int globalY)
...@@ -675,7 +693,6 @@ void View::ui_camerasListView(int x, int y, int globalX, int globalY) ...@@ -675,7 +693,6 @@ void View::ui_camerasListView(int x, int y, int globalX, int globalY)
} }
else else
m_dialogCameras->hide(); m_dialogCameras->hide();
} }
void View::mapAdded(MapHandlerGen* mh ) void View::mapAdded(MapHandlerGen* mh )
...@@ -696,7 +713,6 @@ void View::mapRemoved(MapHandlerGen* mh ) ...@@ -696,7 +713,6 @@ void View::mapRemoved(MapHandlerGen* mh )
} }
} }
void View::pluginEnabled(Plugin *plugin) void View::pluginEnabled(Plugin *plugin)
{ {
DEBUG_SLOT(); DEBUG_SLOT();
......
...@@ -73,6 +73,7 @@ void main () ...@@ -73,6 +73,7 @@ void main ()
//init_K_tab(); //init_K_tab();
vec3 eyeV = normalize(camera - VertexPosition); // normalized outgoing line-of-sight vector vec3 eyeV = normalize(camera - VertexPosition); // normalized outgoing line-of-sight vector
eyeV = 2*dot(VertexNormal,eyeV)*VertexNormal-eyeV ; // symmetrize
set_eval_direction(eyeV); set_eval_direction(eyeV);
ColorAttrib = vec3(0.,0.,0.) ; ColorAttrib = vec3(0.,0.,0.) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment