Commit 84bb3a4d authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: start new subdivision plugin

parent 8f0aab16
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
ADD_SUBDIRECTORY(import) ADD_SUBDIRECTORY(importSurface)
ADD_SUBDIRECTORY(render) ADD_SUBDIRECTORY(render)
ADD_SUBDIRECTORY(renderVector) ADD_SUBDIRECTORY(renderVector)
ADD_SUBDIRECTORY(subdivideSurface)
...@@ -7,11 +7,11 @@ INCLUDE_DIRECTORIES( ...@@ -7,11 +7,11 @@ INCLUDE_DIRECTORIES(
) )
SET( PLUGIN_SRC SET( PLUGIN_SRC
${SCHNApps_ROOT_DIR}/Plugins/import/import.cpp ${SCHNApps_ROOT_DIR}/Plugins/importSurface/importSurface.cpp
) )
SET( PLUGIN_H SET( PLUGIN_H
${SCHNApps_ROOT_DIR}/Plugins/import/import.h ${SCHNApps_ROOT_DIR}/Plugins/importSurface/importSurface.h
) )
IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug ) IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
...@@ -27,21 +27,21 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug ) ...@@ -27,21 +27,21 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
# QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} ) # QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} )
QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} ) QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} )
ADD_LIBRARY( ImportPluginD SHARED ADD_LIBRARY( ImportSurfacePluginD SHARED
${PLUGIN_SRC} ${PLUGIN_SRC}
${PLUGIN_UI} ${PLUGIN_UI}
${PLUGIN_MOC} ${PLUGIN_MOC}
) )
TARGET_LINK_LIBRARIES( ImportPluginD TARGET_LINK_LIBRARIES( ImportSurfacePluginD
${CGoGN_LIBS_D} ${CGoGN_LIBS_D}
${COMMON_LIBS} ${COMMON_LIBS}
${QGLVIEWER_LIBRARIES} ${QGLVIEWER_LIBRARIES}
) )
ADD_DEPENDENCIES( ImportPluginD SCHNAppsD ) ADD_DEPENDENCIES( ImportSurfacePluginD SCHNAppsD )
SET_TARGET_PROPERTIES( ImportPluginD PROPERTIES COMPILE_DEFINITIONS "DEBUG" ) SET_TARGET_PROPERTIES( ImportSurfacePluginD PROPERTIES COMPILE_DEFINITIONS "DEBUG" )
ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug ) ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
...@@ -54,18 +54,18 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug ) ...@@ -54,18 +54,18 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
# QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} ) # QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} )
QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} ) QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} )
ADD_LIBRARY( ImportPlugin SHARED ADD_LIBRARY( ImportSurfacePlugin SHARED
${PLUGIN_SRC} ${PLUGIN_SRC}
${PLUGIN_UI} ${PLUGIN_UI}
${PLUGIN_MOC} ${PLUGIN_MOC}
) )
TARGET_LINK_LIBRARIES( ImportPlugin TARGET_LINK_LIBRARIES( ImportSurfacePlugin
${CGoGN_LIBS_R} ${CGoGN_LIBS_R}
${COMMON_LIBS} ${COMMON_LIBS}
${QGLVIEWER_LIBRARIES} ${QGLVIEWER_LIBRARIES}
) )
ADD_DEPENDENCIES( ImportPlugin SCHNApps ) ADD_DEPENDENCIES( ImportSurfacePlugin SCHNApps )
ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL Debug ) ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
#include "import.h" #include "importSurface.h"
#include "system.h"
#include "mapHandler.h" #include "mapHandler.h"
#include "Algo/Import/import.h" #include "Algo/Import/import.h"
...@@ -8,7 +7,7 @@ ...@@ -8,7 +7,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo> #include <QFileInfo>
bool ImportPlugin::enable() bool ImportSurfacePlugin::enable()
{ {
importAction = new QAction("import", this); importAction = new QAction("import", this);
addMenuAction("Import;Import Surface", importAction); addMenuAction("Import;Import Surface", importAction);
...@@ -16,11 +15,7 @@ bool ImportPlugin::enable() ...@@ -16,11 +15,7 @@ bool ImportPlugin::enable()
return true; return true;
} }
void ImportPlugin::disable() void ImportSurfacePlugin::cb_import()
{
}
void ImportPlugin::cb_import()
{ {
QString fileName = QFileDialog::getOpenFileName(m_window, "Import file", m_window->getAppPath(), "Mesh Files (*.ply *.off)"); QString fileName = QFileDialog::getOpenFileName(m_window, "Import file", m_window->getAppPath(), "Mesh Files (*.ply *.off)");
QFileInfo fi(fileName); QFileInfo fi(fileName);
...@@ -60,16 +55,8 @@ void ImportPlugin::cb_import() ...@@ -60,16 +55,8 @@ void ImportPlugin::cb_import()
} }
} }
/**
* If we want to compile this plugin in debug mode,
* we also define a DEBUG macro at the compilation
*/
#ifndef DEBUG #ifndef DEBUG
// essential Qt function: Q_EXPORT_PLUGIN2(ImportSurfacePlugin, ImportSurfacePlugin)
// arguments are
// - the compiled name of the plugin
// - the main class of our plugin
Q_EXPORT_PLUGIN2(ImportPlugin, ImportPlugin)
#else #else
Q_EXPORT_PLUGIN2(ImportPluginD, ImportPlugin) Q_EXPORT_PLUGIN2(ImportSurfacePluginD, ImportSurfacePlugin)
#endif #endif
#ifndef _IMPORT_PLUGIN_H_ #ifndef _IMPORTSURFACE_PLUGIN_H_
#define _IMPORT_PLUGIN_H_ #define _IMPORTSURFACE_PLUGIN_H_
#include "plugin.h" #include "plugin.h"
#include "view.h"
#include "Topology/generic/functor.h" #include "Topology/generic/functor.h"
#include "Topology/generic/parameters.h" #include "Topology/generic/parameters.h"
...@@ -21,22 +20,22 @@ struct PFP: public PFP_STANDARD ...@@ -21,22 +20,22 @@ struct PFP: public PFP_STANDARD
typedef PFP::MAP MAP; typedef PFP::MAP MAP;
typedef PFP::VEC3 VEC3; typedef PFP::VEC3 VEC3;
class ImportPlugin : public Plugin class ImportSurfacePlugin : public Plugin
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(CGoGN::SCHNApps::Plugin) Q_INTERFACES(CGoGN::SCHNApps::Plugin)
public: public:
ImportPlugin() ImportSurfacePlugin()
{ {
setProvidesRendering(false); setProvidesRendering(false);
} }
~ImportPlugin() ~ImportSurfacePlugin()
{} {}
virtual bool enable(); virtual bool enable();
virtual void disable(); virtual void disable() {}
virtual void redraw(View *view) {} virtual void redraw(View *view) {}
......
...@@ -181,16 +181,7 @@ void RenderDockTab::refreshUI(ParameterSet* params) ...@@ -181,16 +181,7 @@ void RenderDockTab::refreshUI(ParameterSet* params)
/**
* If we want to compile this plugin in debug mode,
* we also define a DEBUG macro at the compilation
*/
#ifndef DEBUG #ifndef DEBUG
// essential Qt function:
// arguments are
// - the compiled name of the plugin
// - the main class of our plugin
Q_EXPORT_PLUGIN2(RenderPlugin, RenderPlugin) Q_EXPORT_PLUGIN2(RenderPlugin, RenderPlugin)
#else #else
Q_EXPORT_PLUGIN2(RenderPluginD, RenderPlugin) Q_EXPORT_PLUGIN2(RenderPluginD, RenderPlugin)
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "plugin.h" #include "plugin.h"
#include "ui_render.h" #include "ui_render.h"
#include "Topology/generic/functor.h" //#include "Topology/generic/functor.h"
#include "Topology/generic/parameters.h" //#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h" //#include "Topology/map/embeddedMap2.h"
#include "Utils/Shaders/shaderFlat.h" #include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderPhong.h" #include "Utils/Shaders/shaderPhong.h"
......
...@@ -212,15 +212,7 @@ void RenderVectorDockTab::refreshUI(ParameterSet* params) ...@@ -212,15 +212,7 @@ void RenderVectorDockTab::refreshUI(ParameterSet* params)
/**
* If we want to compile this plugin in debug mode,
* we also define a DEBUG macro at the compilation
*/
#ifndef DEBUG #ifndef DEBUG
// essential Qt function:
// arguments are
// - the compiled name of the plugin
// - the main class of our plugin
Q_EXPORT_PLUGIN2(RenderVectorPlugin, RenderVectorPlugin) Q_EXPORT_PLUGIN2(RenderVectorPlugin, RenderVectorPlugin)
#else #else
Q_EXPORT_PLUGIN2(RenderVectorPluginD, RenderVectorPlugin) Q_EXPORT_PLUGIN2(RenderVectorPluginD, RenderVectorPlugin)
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "plugin.h" #include "plugin.h"
#include "ui_renderVector.h" #include "ui_renderVector.h"
#include "Topology/generic/functor.h" //#include "Topology/generic/functor.h"
#include "Topology/generic/parameters.h" //#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h" //#include "Topology/map/embeddedMap2.h"
#include "Utils/Shaders/shaderVectorPerVertex.h" #include "Utils/Shaders/shaderVectorPerVertex.h"
......
cmake_minimum_required(VERSION 2.8)
INCLUDE_DIRECTORIES(
${SCHNApps_ROOT_DIR}/include
${SCHNApps_ROOT_DIR}/Plugins/import
${CMAKE_CURRENT_BINARY_DIR}
)
SET( PLUGIN_SRC
${SCHNApps_ROOT_DIR}/Plugins/subdivideSurface/subdivideSurface.cpp
)
SET( PLUGIN_H
${SCHNApps_ROOT_DIR}/Plugins/subdivideSurface/subdivideSurface.h
)
SET( PLUGIN_FORM
${SCHNApps_ROOT_DIR}/Plugins/subdivideSurface/subdivideSurface.ui
)
IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
ADD_DEFINITIONS(-DDEBUG)
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ELSE (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Debug ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF (WIN32)
QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} )
QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} )
ADD_LIBRARY( SubdivideSurfacePluginD SHARED
${PLUGIN_SRC}
${PLUGIN_UI}
${PLUGIN_MOC}
)
TARGET_LINK_LIBRARIES( SubdivideSurfacePluginD
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
)
ADD_DEPENDENCIES( SubdivideSurfacePluginD SCHNAppsD )
SET_TARGET_PROPERTIES( SubdivideSurfacePluginD PROPERTIES COMPILE_DEFINITIONS "DEBUG" )
ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ELSE (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF (WIN32)
QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} )
QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} )
ADD_LIBRARY( SubdivideSurfacePlugin SHARED
${PLUGIN_SRC}
${PLUGIN_UI}
${PLUGIN_MOC}
)
TARGET_LINK_LIBRARIES( SubdivideSurfacePlugin
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
)
ADD_DEPENDENCIES( SubdivideSurfacePlugin SCHNApps )
ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
#include "subdivideSurface.h"
#include "mapHandler.h"
bool SubdivideSurfacePlugin::enable()
{
m_dockTab = new SubdivideSurfaceDockTab();
addTabInDock(m_dockTab, "SubdivideSurface");
connect(m_dockTab->mapList, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedMapChanged()));
connect(m_window, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(cb_addMapToList(MapHandlerGen*)));
connect(m_window, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(cb_removeMapFromList(MapHandlerGen*)));
QList<MapHandlerGen*> maps = m_window->getMapsList();
foreach(MapHandlerGen* m, maps)
m_dockTab->mapList->addItem(m->getName());
connect(m_dockTab->button_trianguleFaces, SIGNAL(clicked()), this, SLOT(cb_trianguleFaces()));
return true;
}
void SubdivideSurfacePlugin::cb_selectedMapChanged()
{
}
void SubdivideSurfacePlugin::cb_addMapToList(MapHandlerGen* m)
{
m_dockTab->mapList->addItem(m->getName());
}
void SubdivideSurfacePlugin::cb_removeMapFromList(MapHandlerGen* m)
{
for(int i = 0; i < m_dockTab->mapList->count(); ++i)
{
if(m_dockTab->mapList->item(i)->text() == m->getName())
{
delete m_dockTab->mapList->item(i);
return;
}
}
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2(SubdivideSurfacePlugin, SubdivideSurfacePlugin)
#else
Q_EXPORT_PLUGIN2(SubdivideSurfacePluginD, SubdivideSurfacePlugin)
#endif
#ifndef _SUBDIVIDESURFACE_PLUGIN_H_
#define _SUBDIVIDESURFACE_PLUGIN_H_
#include "plugin.h"
#include "ui_subdivideSurface.h"
#include "Topology/generic/functor.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
using namespace CGoGN;
using namespace SCHNApps;
class SubdivideSurfaceDockTab : public QWidget, public Ui::SubdivideSurfaceWidget
{
public:
SubdivideSurfaceDockTab() { setupUi(this); }
};
class SubdivideSurfacePlugin : public Plugin
{
Q_OBJECT
Q_INTERFACES(CGoGN::SCHNApps::Plugin)
public:
SubdivideSurfacePlugin()
{
setProvidesRendering(false);
}
~SubdivideSurfacePlugin()
{}
virtual bool enable();
virtual void disable() {}
virtual void redraw(View *view) {}
virtual void keyPress(View* view, int key) {}
virtual void keyRelease(View* view, int key) {}
virtual void mousePress(View* view, int button, int x, int y) {}
virtual void mouseRelease(View* view, int button, int x, int y) {}
virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view) {}
virtual void viewUnlinked(View* view) {}
virtual void currentViewChanged(View* view) {}
virtual void mapLinked(View* view, MapHandlerGen* m) {}
virtual void mapUnlinked(View* view, MapHandlerGen* m) {}
protected:
SubdivideSurfaceDockTab* m_dockTab;
public slots:
void cb_selectedMapChanged();
void cb_addMapToList(MapHandlerGen* m);
void cb_removeMapFromList(MapHandlerGen* m);
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SubdivideSurfaceWidget</class>
<widget class="QWidget" name="SubdivideSurfaceWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>174</width>
<height>397</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="mapList"/>
</item>
<item>
<widget class="QPushButton" name="button_trianguleFaces">
<property name="text">
<string>Triangule Faces</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>156</width>
<height>161</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>1000</width>
<height>600</height> <height>800</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>1000</width>
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
......
SCHNApps/resources/cgogn/splash.png

172 KB | W: | H:

SCHNApps/resources/cgogn/splash.png

183 KB | W: | H:

SCHNApps/resources/cgogn/splash.png
SCHNApps/resources/cgogn/splash.png
SCHNApps/resources/cgogn/splash.png
SCHNApps/resources/cgogn/splash.png
  • 2-up
  • Swipe
  • Onion skin
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