Commit 8811f892 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' of /home/git/repositories/cgogn/cgogn

parents 6166fbb6 2b08f627
......@@ -55,7 +55,7 @@ void testVAbyNames(MAP& map, const std::string& name)
if (testPos.isValid())
std::cout << "Attribute "<< name <<" valid"<< std::endl;
else
std::cout << "Attribute "<< name <<"invalid"<< std::endl;
std::cout << "Attribute "<< name <<" invalid"<< std::endl;
}
/**
......@@ -240,6 +240,7 @@ int main()
computeNewPositions(myMap,positionAtt);
dumpAttribute(positionAtt);
//check if there is a Vertex Attribute of VEC3 named position => yes
testVAbyNames(myMap,"position");
......@@ -247,7 +248,29 @@ int main()
myMap.removeAttribute(positionAtt);
//check if there is a Vertex Attribute of VEC3 named position => no
std::cout << "after removing position"<< std::endl;
testVAbyNames(myMap,"position");
// its also possible to add an attribute only with name of type in a string (if type has been registred)
if (myMap.addAttribute<VERTEX>("double", "pipo_double"))
{
VertexAttribute<double, MAP> position_double = myMap.getAttribute<double, VERTEX, MAP>("pipo_double");
position_double[v] = 3.1415926;
}
if (!myMap.addAttribute<VERTEX>("double", "pipo_double"))
{
std::cout << "problem"<< std::endl;
}
if (!myMap.addAttribute<VERTEX>("triple", "pipo_triple"))
{
std::cout << "problem"<< std::endl;
}
return 0;
}
......@@ -6,7 +6,9 @@ project(Tutos)
#SET (CMAKE_BUILD_TYPE Debug)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# ${CGoGN_ROOT_DIR}/include
......
......@@ -84,6 +84,7 @@ ENDIF (WITH_GLEWMX)
add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/")
add_definitions(-DGLM_FORCE_RADIANS)
# define includes of external libs
SET (CGoGN_EXT_INCLUDES
......@@ -115,7 +116,7 @@ IF(WIN32)
ELSE(WIN32)
find_package(SuiteSparse REQUIRED)
SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${SUITESPARSE_INCLUDE_DIRS})
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${SUITESPARSE_LIBRARIES})
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${SUITESPARSE_LIBRARIES} pthread)
ENDIF(WIN32)
......@@ -150,7 +151,6 @@ IF (WITH_GLEWMX)
ADD_DEFINITIONS(-DGLEW_MX)
ENDIF (WITH_GLEWMX)
# qq definition specifiques pour mac
#IF(APPLE)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
......@@ -174,7 +174,9 @@ ELSE()
endif()
ENDIF()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")
endif()
IF(WIN32)
......
......@@ -39,6 +39,7 @@ SET( QT_USE_QTSVG TRUE )
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
add_definitions(-DGLM_FORCE_RADIANS)
#MESSAGE HERE FOR MORE EASY READING (MESSAGE AT THE END)
MESSAGE("Build type = " ${CMAKE_BUILD_TYPE} " (for change -DCMAKE_BUILD_TYPE=Release|Debug)" )
......@@ -96,13 +97,18 @@ SET (EXT_LIBS
# qq definition specifiques pour mac
IF(APPLE)
#IF(APPLE)
# attention a changer pour chercher la bonne version automatiquement
SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "developer SDK")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
SET(CMAKE_OSX_ARCHITECTURES x86_64)
ENDIF(APPLE)
# SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "developer SDK")
# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
# SET(CMAKE_OSX_ARCHITECTURES x86_64)
#ENDIF(APPLE)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-overloaded-virtual")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
......@@ -150,6 +156,7 @@ SET(SCHNApps_QOBJECT_FILES
${SCHNApps_ROOT_DIR}/include/controlDock_pluginTab.h
${SCHNApps_ROOT_DIR}/include/controlDock_mapTab.h
${SCHNApps_ROOT_DIR}/include/colorComboBox.h
${SCHNApps_ROOT_DIR}/include/dialogList.h
)
......@@ -187,6 +194,7 @@ ADD_EXECUTABLE( SCHNApps
TARGET_LINK_LIBRARIES( SCHNApps
${CGoGN_LIBS}
${EXT_LIBS}
pthread
)
......
......@@ -3,10 +3,13 @@ QT4_WRAP_UI( PLUGIN_UIC_FILES ${PLUGIN_UI_FILES} )
QT4_WRAP_CPP( PLUGIN_MOC_FILES ${PLUGIN_QOBJECT_FILES} )
IF(APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/lib")
ENDIF(APPLE)
#IF(APPLE)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/lib")
#ENDIF(APPLE)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
endif()
ADD_LIBRARY( ${PLUGIN_NAME} SHARED
${PLUGIN_FILES}
......@@ -17,6 +20,7 @@ ADD_LIBRARY( ${PLUGIN_NAME} SHARED
TARGET_LINK_LIBRARIES( ${PLUGIN_NAME}
${CGoGN_LIBS}
${EXT_LIBS}
pthread
)
ADD_DEPENDENCIES( ${PLUGIN_NAME} SCHNApps )
......
......@@ -38,6 +38,8 @@ private slots:
void computeNormalFromDialog();
void computeCurvatureFromDialog();
void appsFinished();
public slots:
void computeNormal(const QString& mapName,
const QString& positionAttributeName = "position",
......
......@@ -37,6 +37,9 @@ bool Surface_DifferentialProperties_Plugin::enable()
connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(appsFinished()), this, SLOT(appsFinished()));
foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
mapAdded(map);
......@@ -56,6 +59,8 @@ void Surface_DifferentialProperties_Plugin::disable()
disconnect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(appsFinished()), this, SLOT(appsFinished()));
}
void Surface_DifferentialProperties_Plugin::mapAdded(MapHandlerGen *map)
......@@ -213,6 +218,7 @@ void Surface_DifferentialProperties_Plugin::computeNormal(
mh->notifyAttributeModification(normal);
}
void Surface_DifferentialProperties_Plugin::computeCurvature(
const QString& mapName,
const QString& positionAttributeName,
......@@ -303,6 +309,13 @@ void Surface_DifferentialProperties_Plugin::computeCurvature(
}
}
void Surface_DifferentialProperties_Plugin::appsFinished()
{
m_computeNormalDialog->close();
m_computeCurvatureDialog->close();
}
Q_EXPORT_PLUGIN2(Surface_DifferentialProperties_Plugin, Surface_DifferentialProperties_Plugin)
} // namespace SCHNApps
......
......@@ -67,6 +67,8 @@ public:
~Surface_Render_Plugin()
{}
private:
virtual bool enable();
virtual void disable();
......@@ -95,6 +97,8 @@ private slots:
void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo);
void appsFinished();
public slots:
// slots for Python calls
......
......@@ -41,6 +41,7 @@ bool Surface_Render_Plugin::enable()
connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(appsFinished()), this, SLOT(appsFinished()));
foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
mapAdded(map);
......@@ -61,6 +62,7 @@ void Surface_Render_Plugin::disable()
disconnect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(appsFinished()), this, SLOT(appsFinished()));
foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
mapRemoved(map);
......@@ -397,6 +399,12 @@ void Surface_Render_Plugin::changeVertexColor(const QString& view, const QString
}
void Surface_Render_Plugin::appsFinished()
{
m_dockTab->m_colorDial->close();
}
Q_EXPORT_PLUGIN2(Surface_Render_Plugin, Surface_Render_Plugin)
} // namespace SCHNApps
......
......@@ -29,6 +29,7 @@ public:
private slots:
void openSubdivisionDialog();
void subdivideFromDialog();
void appsFinished();
public slots:
void loopSubdivision(
......
......@@ -125,6 +125,12 @@ void Surface_Subdivision_Plugin::trianguleFaces(
view->updateGL();
}
void Surface_Subdivision_Plugin::appsFinished()
{
m_subdivisionDialog->close();
}
Q_EXPORT_PLUGIN2(Surface_Subdivision_Plugin, Surface_Subdivision_Plugin)
} // namespace SCHNApps
......
......@@ -26,6 +26,12 @@ public:
~Camera();
const QString& getName() const { return m_name; }
void updateParams();
void drawBBCam();
bool m_drawBB;
public slots:
QString getName() { return m_name; }
SCHNApps* getSCHNApps() const { return m_schnapps; }
......@@ -40,24 +46,34 @@ public slots:
const QList<View*>& getLinkedViews() const { return l_views; }
bool isLinkedToView(View* view) const { return l_views.contains(view); }
bool isLinkedToMap(MapHandlerGen* mhg) const;
private:
void linkView(View* view);
void unlinkView(View* view);
private slots:
void frameModified();
void mapAdded(MapHandlerGen* mhg);
void mapRemoved(MapHandlerGen* mhg);
void BBModified();
public slots:
void setProjectionType(int t);
void setDraw(bool b);
void setDrawPath(bool b);
signals:
void projectionTypeChanged(int);
void drawChanged(bool);
void drawPathChanged(bool);
protected:
qglviewer::Vec m_bbMin;
qglviewer::Vec m_bbMax;
QString m_name;
SCHNApps* m_schnapps;
......
......@@ -28,22 +28,25 @@ private slots:
void cameraProjectionChanged(QAbstractButton* b);
void cameraDrawClicked(bool b);
void cameraDrawPathClicked(bool b);
void cameraSelectionChanged();
// slots called from SCHNApps signals
void cameraAdded(Camera* c);
void cameraRemoved(Camera* c);
void selectedViewChanged(View* prev, View* cur);
// void selectedViewChanged(View* prev, View* cur);
// slots called from selected View signals
void selectedViewCurrentCameraChanged(Camera* prev, Camera* cur);
// void selectedViewCurrentCameraChanged(Camera* prev, Camera* cur);
// slots called from current Camera signals
void currentCameraProjectionTypeChanged(int t);
void currentCameraDrawChanged(bool b);
void currentCameraDrawPathChanged(bool b);
// void currentCameraProjectionTypeChanged(int t);
// void currentCameraDrawChanged(bool b);
// void currentCameraDrawPathChanged(bool b);
private:
void updateCurrentCameraInfo();
Camera* currentCam();
SCHNApps* m_schnapps;
bool b_updatingUI;
......
......@@ -36,7 +36,7 @@ public:
private slots:
// slots called from UI actions
void selectedMapChanged();
void mapCheckStateChanged(QListWidgetItem* item);
// void mapCheckStateChanged(QListWidgetItem* item);
void vertexAttributeCheckStateChanged(QListWidgetItem* item);
void selectedSelectorChanged();
......@@ -47,11 +47,11 @@ private slots:
// slots called from SCHNApps signals
void mapAdded(MapHandlerGen* m);
void mapRemoved(MapHandlerGen* m);
void selectedViewChanged(View* prev, View* cur);
// void selectedViewChanged(View* prev, View* cur);
// slots called from selected View signals
void selectedViewMapLinked(MapHandlerGen* plugin);
void selectedViewMapUnlinked(MapHandlerGen* plugin);
// void selectedViewMapLinked(MapHandlerGen* plugin);
// void selectedViewMapUnlinked(MapHandlerGen* plugin);
// slots called from selected MapHandler signals
void selectedMapAttributeAdded(unsigned int orbit, const QString& name);
......
......@@ -27,17 +27,17 @@ private slots:
void addPluginDirectoryClicked();
void enableSelectedPluginsClicked();
void disableSelectedPluginsClicked();
void pluginCheckStateChanged(QListWidgetItem* item);
// void pluginCheckStateChanged(QListWidgetItem* item);
// slots called from SCHNApps signals
void pluginAvailableAdded(QString name);
void pluginEnabled(Plugin* plugin);
void pluginDisabled(Plugin* plugin);
void selectedViewChanged(View* prev, View* cur);
// void selectedViewChanged(View* prev, View* cur);
// slots called from selected View signals
void selectedViewPluginLinked(PluginInteraction* plugin);
void selectedViewPluginUnlinked(PluginInteraction* plugin);
// void selectedViewPluginLinked(PluginInteraction* plugin);
// void selectedViewPluginUnlinked(PluginInteraction* plugin);
private:
SCHNApps* m_schnapps;
......
#ifndef _DIALOG_LIST_H_
#define _DIALOG_LIST_H_
#include <QDialog>
#include <QVBoxLayout>
#include <QListWidget>
#include <QListWidgetItem>
namespace CGoGN
{
namespace SCHNApps
{
class ListPopUp : public QDialog
{
Q_OBJECT
QVBoxLayout* m_layout;
QListWidget* m_list_items;
public:
ListPopUp(const QString& name, QWidget* parent = NULL);
virtual ~ListPopUp();
QListWidget* list();
QListWidgetItem* addItem(const QString& str, Qt::CheckState checked = Qt::Unchecked);
QListWidgetItem* getItem(unsigned int row);
unsigned int nbItems();
QListWidgetItem* findItem(const QString& str);
bool removeItem(const QString& str);
void check(const QString& str, Qt::CheckState ck);
bool isChecked(const QString& str);
};
} // namespace SCHNApps
} // namespace CGoGN
#endif
......@@ -51,8 +51,8 @@ public slots:
const QList<View*>& getLinkedViews() const { return l_views; }
bool isLinkedToView(View* view) const { return l_views.contains(view); }
const qglviewer::Vec& getBBmin() const { return m_bbMin; }
const qglviewer::Vec& getBBmax() const { return m_bbMax; }
// const qglviewer::Vec& getBBmin() const { return m_bbMin; }
// const qglviewer::Vec& getBBmax() const { return m_bbMax; }
float getBBdiagSize() const { return m_bbDiagSize; }
Utils::GLSLShader* getBBDrawerShader() const
......@@ -77,9 +77,12 @@ public slots:
return matrix;
}
void frameModified() { DEBUG_EMIT("frameModified");emit(BBisModified());}
public:
virtual void draw(Utils::GLSLShader* shader, int primitive) = 0;
virtual void drawBB() = 0;
virtual void transformedBB(qglviewer::Vec& bbMin, qglviewer::Vec& bbMax) = 0;
void setPrimitiveDirty(int primitive) { m_render->setPrimitiveDirty(primitive); }
......@@ -181,6 +184,8 @@ signals:
void cellSelectorRemoved(unsigned int orbit, const QString& name);
void selectedCellsChanged(CellSelectorGen* cs);
void BBisModified();
protected:
QString m_name;
SCHNApps* m_schnapps;
......@@ -253,6 +258,9 @@ public:
void updateBB(const VertexAttribute<VEC3, MAP>& position);
void updateBBDrawer();
void transformedBB(qglviewer::Vec& bbMin, qglviewer::Vec& bbMax);
/*********************************************************
* MANAGE TOPO DRAWING
*********************************************************/
......
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Geometry/bounding_box.h"
namespace CGoGN
{
......@@ -73,10 +75,8 @@ void MapHandler<PFP>::draw(Utils::GLSLShader* shader, int primitive)
if(!m_render->isPrimitiveUpToDate(primitive))
m_render->initPrimitives<PFP>(*(static_cast<MAP*>(m_map)), primitive) ;
glPushMatrix();
glMultMatrixd(m_frame->matrix());
m_render->draw(shader, primitive);
glPopMatrix();
}
template <typename PFP>
......@@ -88,32 +88,30 @@ void MapHandler<PFP>::drawBB()
updateBBDrawer();
}
glPushMatrix();
glMultMatrixd(m_frame->matrix());
// QGLViewer::drawAxis();
m_bbDrawer->callList();
glPopMatrix();
}
template <typename PFP>
void MapHandler<PFP>::updateBB(const VertexAttribute<VEC3, MAP>& position)
{