Commit 734a59a7 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: debug surface deformation

parent 9a08b7b1
...@@ -7,5 +7,5 @@ ADD_SUBDIRECTORY(render) ...@@ -7,5 +7,5 @@ ADD_SUBDIRECTORY(render)
ADD_SUBDIRECTORY(renderVector) ADD_SUBDIRECTORY(renderVector)
ADD_SUBDIRECTORY(renderExplod) ADD_SUBDIRECTORY(renderExplod)
ADD_SUBDIRECTORY(subdivideSurface) ADD_SUBDIRECTORY(subdivideSurface)
#ADD_SUBDIRECTORY(surfaceDeformation) ADD_SUBDIRECTORY(surfaceDeformation)
#ADD_SUBDIRECTORY(renderTopoSurface) #ADD_SUBDIRECTORY(renderTopoSurface)
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="combo_positionVBO"> <widget class="QComboBox" name="combo_positionAttribute">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
......
...@@ -2,27 +2,34 @@ ...@@ -2,27 +2,34 @@
#define _SURFACEDEFORMATION_PLUGIN_H_ #define _SURFACEDEFORMATION_PLUGIN_H_
#include "plugin.h" #include "plugin.h"
#include "mapHandler.h"
#include "ui_surfaceDeformation.h"
#include "Utils/drawer.h"
using namespace CGoGN; using namespace CGoGN;
using namespace SCHNApps; using namespace SCHNApps;
enum SelectionMode
{
LOCKED,
HANDLE
};
struct PerMapParameterSet struct PerMapParameterSet
{ {
PerMapParameterSet() {} PerMapParameterSet() {}
PerMapParameterSet(MapHandlerGen* mh); PerMapParameterSet(MapHandlerGen* mh);
~PerMapParameterSet();
VertexAttribute<PFP2::VEC3> positionAttribute; VertexAttribute<PFP2::VEC3> positionAttribute;
CellMarker<VERTEX> lockingMarker; CellMarker<VERTEX>* lockingMarker;
bool setLockedVertices; CellMarker<VERTEX>* handleMarker;
bool selecting; SelectionMode verticesSelectionMode;
PFP2::VEC3 selectionCenter;
PFP2::REAL selectionRadius;
bool dragging;
PFP2::REAL dragZ;
qglviewer::Vec dragPrevious;
std::vector<unsigned int> locked_vertices; std::vector<unsigned int> locked_vertices;
std::vector<unsigned int> handle_vertices; std::vector<unsigned int> handle_vertices;
}; };
...@@ -32,12 +39,12 @@ struct ParameterSet ...@@ -32,12 +39,12 @@ struct ParameterSet
ParameterSet() : selectedMap(NULL) ParameterSet() : selectedMap(NULL)
{} {}
PerMapParameterSet& getCurrentMapParameterSet() PerMapParameterSet* getCurrentMapParameterSet()
{ {
return perMap[selectedMap->getName()]; return perMap[selectedMap->getName()];
} }
QHash<QString, PerMapParameterSet> perMap; QHash<QString, PerMapParameterSet*> perMap;
MapHandlerGen* selectedMap; MapHandlerGen* selectedMap;
}; };
...@@ -65,7 +72,10 @@ class SurfaceDeformationPlugin : public Plugin ...@@ -65,7 +72,10 @@ class SurfaceDeformationPlugin : public Plugin
Q_INTERFACES(CGoGN::SCHNApps::Plugin) Q_INTERFACES(CGoGN::SCHNApps::Plugin)
public: public:
SurfaceDeformationPlugin() : b_refreshingUI(false) SurfaceDeformationPlugin() :
b_refreshingUI(false),
selecting(false),
dragging(false)
{ {
setProvidesRendering(true); setProvidesRendering(true);
} }
...@@ -74,7 +84,7 @@ public: ...@@ -74,7 +84,7 @@ public:
{} {}
virtual bool enable(); virtual bool enable();
virtual void disable() {} virtual void disable();
virtual void redraw(View *view); virtual void redraw(View *view);
...@@ -95,17 +105,31 @@ public slots: ...@@ -95,17 +105,31 @@ public slots:
void mapLinked(MapHandlerGen* m); void mapLinked(MapHandlerGen* m);
void mapUnlinked(MapHandlerGen* m); void mapUnlinked(MapHandlerGen* m);
void attributeAdded();
void changeSelectedMap(View* view, MapHandlerGen* map); void changeSelectedMap(View* view, MapHandlerGen* map);
void changePositionAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP2::VEC3> attribute); void changePositionAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP2::VEC3> attribute);
void changeVerticesSelectionMode(View* view, MapHandlerGen* map, SelectionMode m);
void cb_selectedMapChanged(); void cb_selectedMapChanged();
void cb_positionAttributeChanged(int index); void cb_positionAttributeChanged(int index);
void cb_selectLockedVertices(bool b);
void cb_selectHandleVertices(bool b);
private: private:
RenderVectorDockTab* m_dockTab; SurfaceDeformationDockTab* m_dockTab;
QHash<View*, ParameterSet*> h_viewParams; QHash<View*, ParameterSet*> h_viewParams;
Utils::Drawer* m_drawer;
bool b_refreshingUI; bool b_refreshingUI;
bool selecting;
PFP2::VEC3 selectionCenter;
PFP2::REAL selectionRadius;
bool dragging;
PFP2::REAL dragZ;
qglviewer::Vec dragPrevious;
}; };
#endif #endif
...@@ -3,14 +3,17 @@ renderPlugin = schnapps.loadPlugin("Render"); ...@@ -3,14 +3,17 @@ renderPlugin = schnapps.loadPlugin("Render");
renderVectorPlugin = schnapps.loadPlugin("RenderVector"); renderVectorPlugin = schnapps.loadPlugin("RenderVector");
differentialPropertiesPlugin = schnapps.loadPlugin("DifferentialProperties"); differentialPropertiesPlugin = schnapps.loadPlugin("DifferentialProperties");
subdivisionPlugin = schnapps.loadPlugin("SubdivideSurface"); subdivisionPlugin = schnapps.loadPlugin("SubdivideSurface");
surfaceDeformationPlugin = schnapps.loadPlugin("SurfaceDeformation");
#obj = importPlugin.importFromFile("/home/untereiner/Developments/meshes/egea.off"); obj = importPlugin.importFromFile("/home/kraemer/Media/Data/surface/midRes/egea_remesh_9k.off");
v = schnapps.getView("view_0"); v = schnapps.getView("view_0");
schnapps.linkViewAndPlugin(v.getName(), renderPlugin.getName()); schnapps.linkViewAndPlugin(v.getName(), renderPlugin.getName());
schnapps.linkViewAndPlugin(v.getName(), renderVectorPlugin.getName()); schnapps.linkViewAndPlugin(v.getName(), renderVectorPlugin.getName());
#schnapps.linkViewAndMap(v.getName(), obj.getName()); schnapps.linkViewAndPlugin(v.getName(), surfaceDeformationPlugin.getName());
schnapps.linkViewAndMap(v.getName(), obj.getName());
#differentialPropertiesPlugin.computeNormal(obj.getName()); #differentialPropertiesPlugin.computeNormal(obj.getName());
#differentialPropertiesPlugin.computeCurvature(obj.getName()); #differentialPropertiesPlugin.computeCurvature(obj.getName());
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include <vector> #include <vector>
#include "Utils/gl_def.h" #include "Utils/gl_def.h"
#include "Geometry/vector_gen.h" #include "Geometry/vector_gen.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
namespace CGoGN { namespace Utils { class VBO; } } namespace CGoGN { namespace Utils { class VBO; } }
namespace CGoGN { namespace Utils { class ShaderColorPerVertex; } }
namespace CGoGN { namespace Utils { namespace SVG { class SVGOut ; } } } namespace CGoGN { namespace Utils { namespace SVG { class SVGOut ; } } }
namespace CGoGN namespace CGoGN
...@@ -81,6 +81,8 @@ public: ...@@ -81,6 +81,8 @@ public:
*/ */
~Drawer(); ~Drawer();
Utils::ShaderColorPerVertex* getShader();
/** /**
* init the data structure * init the data structure
* @param com say if compile only, or compile and execute (GL_COMPILE/ GL_COMPILE_AND_EXECUTE) * @param com say if compile only, or compile and execute (GL_COMPILE/ GL_COMPILE_AND_EXECUTE)
......
...@@ -1061,14 +1061,10 @@ void GLSLShader::updateMatrices(const glm::mat4& projection, const glm::mat4& mo ...@@ -1061,14 +1061,10 @@ void GLSLShader::updateMatrices(const glm::mat4& projection, const glm::mat4& mo
glUniformMatrix4fv(*m_uniMat_Model, 1, false, &modelview[0][0]); glUniformMatrix4fv(*m_uniMat_Model, 1, false, &modelview[0][0]);
if (*m_uniMat_ModelProj >= 0) if (*m_uniMat_ModelProj >= 0)
{
glUniformMatrix4fv(*m_uniMat_ModelProj, 1 , false, &PMV[0][0]); glUniformMatrix4fv(*m_uniMat_ModelProj, 1 , false, &PMV[0][0]);
}
if (*m_uniMat_Normal >= 0) if (*m_uniMat_Normal >= 0)
{
glUniformMatrix4fv(*m_uniMat_Normal, 1 , false, &normalMatrix[0][0]); glUniformMatrix4fv(*m_uniMat_Normal, 1 , false, &normalMatrix[0][0]);
}
this->unbind(); this->unbind();
} }
......
...@@ -64,6 +64,11 @@ Drawer::~Drawer() ...@@ -64,6 +64,11 @@ Drawer::~Drawer()
delete m_shader; delete m_shader;
} }
Utils::ShaderColorPerVertex* Drawer::getShader()
{
return m_shader;
}
void Drawer::lineWidth(float lw) void Drawer::lineWidth(float lw)
{ {
m_currentWidth = lw; m_currentWidth = lw;
......
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