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

SCHNApps: debug surface deformation

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