Commit 54ec8819 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'master' of cgogn:CGoGN

parents d5fb4a51 2cb5349c
......@@ -23,6 +23,7 @@
*******************************************************************************/
#include "clipping.h"
#include "Utils/vbo.h"
#include "Utils/static_assert.h"
/*******************************************************************************
......
......@@ -35,6 +35,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/vbo.h"
#include <glm/gtc/type_ptr.hpp>
......
......@@ -40,6 +40,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/vbo.h"
#include <vector>
......
......@@ -38,6 +38,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/vbo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/MC/marchingcube.h"
......
......@@ -25,6 +25,7 @@
#include "texturesExample.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Utils/vbo.h"
TexView::TexView():
m_render(NULL),
......
......@@ -46,7 +46,7 @@
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/pointSprite.h"
#include "Utils/text3d.h"
#include "Utils/vboRender.h"
#include "Utils/vbo.h"
#include "Utils/Qt/qtInputs.h"
......
......@@ -46,6 +46,10 @@ int main(int argc, char **argv)
void MyQT::createMap()
{
// creation of a new attribute on vertices of type 3D vector for position.
// a handler to this attribute is returned
position = myMap.addAttribute<VEC3, VERTEX>("position");
// creation of 2 new faces: 1 triangle and 1 square
Dart d1 = myMap.newFace(3);
Dart d2 = myMap.newFace(4);
......@@ -53,10 +57,6 @@ void MyQT::createMap()
// sew these faces along one of their edge
myMap.sewFaces(d1, d2);
// creation of a new attribute on vertices of type 3D vector for position.
// a handler to this attribute is returned
position = myMap.addAttribute<VEC3, VERTEX>("position");
// affect position by moving in the map
position[d1] = VEC3(0, 0, 0);
position[PHI1(d1)] = VEC3(2, 0, 0);
......
......@@ -41,6 +41,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/vbo.h"
using namespace CGoGN ;
......
......@@ -45,7 +45,7 @@
#include "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/vbo.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
......
......@@ -35,7 +35,7 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/vbo.h"
#include "Algo/Histogram/histogram.h"
#include "Utils/Qt/qthistodraw.h"
......
......@@ -37,6 +37,7 @@
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/vbo.h"
#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
......
......@@ -330,6 +330,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if (d != Dart::nil())
m_selected = d;
std::cout << myMap.edgeCanCollapse(d) << std::endl;
}
if (button == Qt::RightButton)
{
......@@ -650,11 +651,14 @@ void MyQT::importMesh(std::string& filename)
else
{
std::cerr << "could not import " << filename << std::endl ;
return ;
}
m_selected = NIL;
m_selected2 = NIL;
m_render_topo->updateData<PFP>(myMap, position, m_ex1,m_ex2,m_ex3, nb);
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
setParamObject(bb.maxSize(), bb.center().data()) ;
m_shift = bb.maxSize()/200.0f;
......
......@@ -92,7 +92,7 @@ private:
// Assigne un nouveau plongement au sommet. Les anciens plongements sont libérés.
void newVertex(Dart d) {
embedNewCell<VERTEX>(d);
setOrbitEmbeddingOnNewCell<VERTEX>(d);
}
public:
......
......@@ -88,6 +88,15 @@ AttributeHandler<PFP::VEC3> normal;
class QuadMesh : public EmbeddedMap2
{
private:
// 3 brins de la carte
Dart d_carre;
Dart d_tri;
Dart d_multiFaces;
// Assigne un nouveau plongement au sommet. Les anciens plongements sont libérés.
void newVertex(Dart d) {
setOrbitEmbeddingOnNewCell(VERTEX,d);
}
public:
void createMesh() {
......
......@@ -135,6 +135,7 @@ IF(APPLE)
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)
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} "-framework Foundation -framework cocoa" )
ENDIF(APPLE)
IF(WIN32)
......
cmake_minimum_required(VERSION 2.8)
project(SCHNApps)
SET( QT_USE_QTOPENGL TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTDESIGNER TRUE )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTPLUGIN TRUE )
#========CGoGN========#
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
INCLUDE(${CGoGN_ROOT_DIR}/apps_cmake.txt)
find_package(Qt4 REQUIRED)
#=======QGLViewer=========#
find_package(QGLViewer REQUIRED)
#======SCHNApps=======#
SET(SCHNApps_ROOT_DIR ${CGoGN_ROOT_DIR}/SCHNApps)
SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/Plugins)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/Release Release)
IF (NOT WIN32)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/Debug Debug)
ENDIF (NOT WIN32)
configure_file(${CMAKE_SOURCE_DIR}/settings/state_save.xml ${EXECUTABLE_OUTPUT_PATH}/state_save.xml @ONLY)
#======Documentation=======#
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Doc
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_BUILD_TYPE Debug)
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)
INCLUDE_DIRECTORIES(
${CGoGN_ROOT_DIR}/include
${COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${QGLVIEWER_INCLUDE_DIR}
${SCHNApps_ROOT_DIR}/include
)
file(
GLOB
SCHNApps_SRC_FILES
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/interface/*.cpp
${SCHNApps_ROOT_DIR}/src/visualization/*.cpp
${SCHNApps_ROOT_DIR}/src/dialogs/*.cpp
)
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/interface/window.h
${SCHNApps_ROOT_DIR}/include/interface/system.h
${SCHNApps_ROOT_DIR}/include/interface/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/interface/splitArea.h
${SCHNApps_ROOT_DIR}/include/visualization/view.h
${SCHNApps_ROOT_DIR}/include/visualization/scene.h
${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/pluginDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/linkViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/mapPluginDialog.h
)
file(
GLOB
SCHNApps_FORM_FILES
${SCHNApps_ROOT_DIR}/forms/*.ui
)
QT4_WRAP_UI( UI_H_FILES
${SCHNApps_FORM_FILES}
)
QT4_WRAP_CPP( MOC_FILES
${SCHNApps_H_OBJECT_FILES}
)
QT4_ADD_RESOURCES( RCC_FILES
${SCHNApps_ROOT_DIR}/resources/resources.qrc
)
ADD_EXECUTABLE( SCHNAppsD
${SCHNApps_SRC_FILES}
${UI_H_FILES}
${MOC_FILES}
${RCC_FILES}
)
TARGET_LINK_LIBRARIES( SCHNAppsD
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD)
cmake_minimum_required(VERSION 2.8)
ADD_SUBDIRECTORY(firstPlugin)
cmake_minimum_required(VERSION 2.8)
INCLUDE_DIRECTORIES(
${SCHNApps_ROOT_DIR}/include
${SCHNApps_ROOT_DIR}/Plugins/firstPlugin/include
${CMAKE_CURRENT_BINARY_DIR}
)
SET( FIRSTPLUGIN_PLUGIN_SRC
${SCHNApps_ROOT_DIR}/src/plugins/visualPlugin.cpp
${SCHNApps_ROOT_DIR}/Plugins/firstPlugin/src/firstPlugin.cpp
)
SET( FIRSTPLUGIN_PLUGIN_H
${SCHNApps_ROOT_DIR}/include/plugins/visualPlugin.h
${SCHNApps_ROOT_DIR}/Plugins/firstPlugin/include/firstPlugin.h
)
IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
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_CPP( FIRSTPLUGIN_MOC ${FIRSTPLUGIN_PLUGIN_H} )
ADD_LIBRARY( FirstPluginD SHARED
${FIRSTPLUGIN_PLUGIN_SRC}
${FIRSTPLUGIN_MOC}
)
TARGET_LINK_LIBRARIES( FirstPluginD
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
)
ADD_DEPENDENCIES( FirstPluginD SCHNAppsD )
SET_TARGET_PROPERTIES( FirstPluginD 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_CPP( FIRSTPLUGIN_MOC ${FIRSTPLUGIN_PLUGIN_H} )
ADD_LIBRARY( FirstPlugin SHARED
${FIRSTPLUGIN_PLUGIN_SRC}
${FIRSTPLUGIN_MOC}
)
TARGET_LINK_LIBRARIES( FirstPlugin
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
)
ADD_DEPENDENCIES( FirstPlugin SCHNApps )
ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
#ifndef _FIRSTPLUGIN_H_
#define _FIRSTPLUGIN_H_
#include "plugins/visualPlugin.h"
/**---CGoGN includes **/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Algo/Render/GL2/topoRender.h"
/**---CGoGN includes **/
/**---Definitions specific to CGoGN ---*/
using namespace CGoGN ;
/**
* Struct that contains some informations about the types of the manipulated objects
* Mainly here to be used by the algorithms that are parameterized by it
*/
struct PFP: public PFP_STANDARD
{
// definition of the map
typedef EmbeddedMap2 MAP;
};
typedef PFP::MAP MAP;
typedef PFP::VEC3 VEC3;
/**---Definitions specific to CGoGN ---*/
/**
* This class is a basic minimal plugin.
* All the methods in this class are overloaded methods.
* In order to create a valid plugin, all the method in this
* needs to be declared (they are actually overloaded methods
* from VisualPlugin), even if your plugin doesn't make any
* drawing.
*/
/**
* Our plugin must inherit from VisualPlugin,
* that is a class that itself is an implementation
* of the Plugin interface (virtual class). It contains
* many useful and essantial methods.
*/
class FirstPlugin : public VisualPlugin
{
/**
* Essential Qt macros.
*/
Q_OBJECT
Q_INTERFACES(Plugin)
public:
FirstPlugin() {}
~FirstPlugin() {}
/**
* The classical call back for the initGL method
* When a scene will be link to this plugin, it will call
* back this method with itself as a parameter.
*/
void cb_initGL(Scene *scene);
/**
* The drawing method that needs to be overloaded.
* Each time a scene (that is to say, at least one of the
* views that is contains) needs to be refresh, it calls back
* this method with itself as a parameter
*/
void cb_redraw(Scene *scene);
/**
* The plugin's activation method
* Each time the main application loads this plugin,
* it call this method. Writing this method is
* the occasion to initialize the plugin and check certain
* conditions.
* If this methods return 'false', the plugin load will be aborted.
*/
bool activate();
/**
* The plugin's disabling method
* Each time the main application will unload the plugin
* it will call this method.
*/
void disable();
protected:
/** Attributes that are specific to this plugin **/
MAP myMap;
// attribute for vertices positions
VertexAttribute<VEC3> position;
// render (for the topo)
Algo::Render::GL2::TopoRender *m_render_topo;
// just for more compact writing
inline Dart PHI1(Dart d)
{
return myMap.phi1(d);
}
inline Dart PHI_1(Dart d)
{
return myMap.phi_1(d);
}
inline Dart PHI2(Dart d)
{
return myMap.phi2(d);
}
template<int X>
Dart PHI(Dart d)
{
return myMap.phi<X>(d);
}
/** Attributes that are specific to this plugin **/
};
#endif // _FIRSTPLUGIN_H_
#include "firstPlugin.h"
#include "Algo/Geometry/boundingbox.h"
void FirstPlugin::cb_initGL(Scene *scene)
{
if (scene)
{
// we fit the first (possibly the only) view of the newly liked
// scene to the content of our map
// bounding box of scene
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
scene->firstViewFitSphere(bb.center()[0], bb.center()[1], bb.center()[2], bb.maxSize());
m_render_topo = new Algo::Render::GL2::TopoRender() ;
// render the topo of the map without boundary darts
SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f, nb);
}
}
void FirstPlugin::cb_redraw(Scene *scene)
{
m_render_topo->drawTopo();
}
bool FirstPlugin::activate()
{
// creation of 2 new faces: 1 triangle and 1 square
Dart d1 = myMap.newFace(3);