Commit 6ca39fbe authored by Maire Nicolas's avatar Maire Nicolas

Merge branch 'master' of cgogn:~cgogn/CGoGN

Conflicts:
	src/Utils/Shaders/shaderPhong.cpp
parents 2b0a7d41 04f3042b
......@@ -38,6 +38,11 @@ add_executable( polyhedronsViewD ../polyhedronsView.cpp ${polyhedronsView_moc})
target_link_libraries( polyhedronsViewD
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(frame_manip_moc ../frame_manip.h)
add_executable( frame_manipD ../frame_manip.cpp ${frame_manip_moc})
target_link_libraries( frame_manipD
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(extrusionView_moc ../extrusionView.h)
add_executable( extrusionViewD ../extrusionView.cpp ${extrusionView_moc})
target_link_libraries( extrusionViewD
......
......@@ -42,6 +42,11 @@ add_executable( polyhedronsView ../polyhedronsView.cpp ${polyhedronsView_moc})
target_link_libraries( polyhedronsView
${CGoGN_LIBS_R} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(frame_manip_moc ../frame_manip.h)
add_executable( frame_manip ../frame_manip.cpp ${frame_manip_moc})
target_link_libraries( frame_manip
${CGoGN_LIBS_R} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(extrusionView_moc ../extrusionView.h)
add_executable( extrusionView ../extrusionView.cpp ${extrusionView_moc})
target_link_libraries( extrusionView
......
This diff is collapsed.
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef POLYHEDRONSVIEW_H_
#define POLYHEDRONSVIEW_H_
#include <iostream>
#include "Utils/qtSimple.h"
#include "Utils/frameManipulator.h"
#include "Utils/drawer.h"
// forward definitions (minimize includes)
namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class MapRender; }}}}
namespace CGoGN { namespace Utils { class VBO; } }
namespace CGoGN { namespace Utils { class ShaderFlat; } }
namespace CGoGN { namespace Utils { class ShaderSimpleColor; } }
using namespace CGoGN ;
/**
* A class for a little interface and rendering
*/
class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
public:
// render
Algo::Render::GL2::MapRender* m_render;
// VBO
Utils::VBO* m_positionVBO;
Utils::FrameManipulator* m_frame;
unsigned int m_pickedAxis;
///vector of six drawables
std::vector<Utils::LineDrawable*> m_ld;
/// precision of drawing (number of subdivisions)
unsigned int m_precDraw;
std::vector<Utils::Pickable*> m_pickables;
Utils::Pickable* m_lastPickedObject;
// width of cube of pickable
unsigned int NBP;
MyQT():m_render(NULL), m_positionVBO(NULL),NBP(2){}
// callbacks of simpleQT to overdefine:
void cb_redraw();
void cb_initGL();
void cb_mousePress(int button, int x, int y);
void cb_wheelEvent(int delta, int x, int y);
void cb_keyPress(int code);
void cb_mouseMove(int button, int x, int y);
int m_begX;
int m_begY;
Geom::Vec3f m_projAxis;
Geom::Vec3f m_projCenter;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DockWidget</class>
<widget class="QDockWidget" name="DockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>209</width>
<height>345</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>250</height>
</size>
</property>
<property name="windowTitle">
<string>Interface</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>200</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>4</number>
</property>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -166,6 +166,8 @@ void Viewer::cb_Open()
{
std::string filters("all (*.*);; trian (*.trian);; ctm (*.ctm);; off (*.off);; ply (*.ply)") ;
std::string filename = selectFile("Open Mesh", "", filters) ;
if (filename.empty())
return ;
importMesh(filename) ;
updateGL() ;
......
......@@ -49,6 +49,8 @@
#include "Algo/Render/GL2/topo3Render.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/cgognStream.h"
#include "Utils/drawer.h"
......
Dépendences Linux:
installer les paquets suivants:
cmake libXi-dev libXmu-dev freeglut3-dev libdevil-dev libglew-dev libgmp3-dev libxml2-dev libboost-dev libboost-thread-dev libzip-dev libqt4-help qt4-designer qt4-dev-tools
cmake libXi-dev libXmu-dev freeglut3-dev libdevil-dev libglew-dev libgmp3-dev libxml2-dev libboost-dev libboost-thread-dev libzip-dev libqt4-help qt4-designer qt4-dev-tools uuid-dev
Pour compiler CGoGN:
- aller dans ThirdParty et taper "cmake .", puis make
......
Pour utiliser Eclipse (testé avec la version Helios & Galileo)
Pour utiliser Eclipse (testé avec la version Helios, Galileo & Indigo)
Faire un nouveau projet C++
Choisir Makefile project -> Empty Project
Choisir Comme "Location": la racine de NewCGoGN
Choisir Toolchains: Linux GCC
* Configurer un projet dans Eclipse :
- Faire un nouveau projet C++
- Choisir Makefile project -> Empty Project
- Choisir Comme "Location": la racine de CGoGN
- Choisir Toolchains: Linux GCC
* Compilation avec le petit marteau ;) (l'icone)
Dans les propriétés du projet:
-> C/C++ Build:
Dans la configuration Default | Active:
......@@ -12,14 +14,46 @@ Dans les propriétés du projet:
on peut ensuite ajouter des configurations pour compiler ce que l'on veut
en changeant juste le Build directory:
CGoGNRelease: build/Release (compile la lib en release)
CGoGNDebug: build/Debug (compile la lib en debug)
Apps: build/Apps (compile les exemples et les tutos)
CGoGNRelease: build/Release (compile la lib en release)
CGoGNDebug: build/Debug (compile la lib en debug)
Apps: build/Apps (compile les exemples et les tutos)
Tuto: build/Apps/Tuto (compile les tutos)
etc..
On peut alors compiler avec le petit marteau ;) (l'icone) et choisir avec le bouton droit ce que l'on
veut compiler.
Ceci ajoute dans le repertoire de CGoGN un .project et un .cproject.
* Dépendances inter-projets et autocomplétion
Si le projet X dépend d'un autre projet, alors :
Projet X -> Properties -> Project references : cocher le projet dont il dépend.
* Dépendances de Qt :
Afin d'éviter qu'Eclipse ne rejette les syntaxes Qt (les includes de Qt, les Q_OBJECT, les callbacks) :
- Télécharger le plugin Qt "eclipse-integration" http://qt.nokia.com/developer/eclipse-integration/
- Décompresser l'archive et copier son contenu dans le répertoire d'installation d'Eclipse (plugins et features)
- Relancer Eclipse au moins une fois avec l'option --clean (relecture des répertoires locaux)
Normalement, dans Window->Preferences de Eclipse, Qt apparait dans le menu.
- Y ajouter le répertoire de Qt (/usr/bin sur Debian/Ubuntu) et le répertoire d'include (/usr/include/qt4).
Ensuite, pour chaque projet, ajouter les includes suivants dans Properties -> C/C++ general -> Paths and Symbols
parmi les includes de C++ :
- /usr/include/qt4
- /usr/include/qt4/Qt
- /usr/include/qt4/QtCore
- /usr/include/qt4/QtGui
- /usr/include/qt4/QtOpenGL
REMARQUE : en bas de cette fenêtre, le bouton "Export Settings" permet d'exporter en XML la configuration afin
de l'importer dans les autres projets.
- Pour finir, un petit clic-droit sur le projet -> Index -> Freshen all files et le tour est joué.
* Coloration syntaxique des shaders
- Télécharger et décompresser EclipseShaders : http://sourceforge.net/projects/glshaders/
- Copier les répertoires plugins et features dans le répertoire d'installation eclipse
- Relancer Eclipse au moins une fois avec l'option --clean (relecture des répertoires locaux)
Eclipse reconnaîtra désormais les fichiers .frag et .vert.
Pour associer d'autres fichiers au programme GLSLeditor :
- Preferences -> General -> Editors -> File Associations
Dans Preferences -> Shaders Preferences, on peut désormais configurer certaines options liées au shaders.
* Coloration syntaxique des fichiers CMake
- Installer CMakeEditor pour Eclipse en ajoutant l'URL dans Help -> Install New Software ... : http://cmakeed.sourceforge.net/eclipse/
- Installer et redémarrer
- Dans Preferences -> General -> Editors -> File Associations il est possible d'associer les CMakeLists.txt à ce logiciel d'édition
......@@ -85,8 +85,8 @@
#include "./img/multiple.hpp"
#include "./img/wrap.hpp"
#include "./virtrev/address.hpp"
#include "./virtrev/equal_operator.hpp"
//#include "./virtrev/address.hpp"
//#include "./virtrev/equal_operator.hpp"
//const float goldenRatio = 1.618033988749894848f;
//const float pi = 3.141592653589793238f;
......
......@@ -22,8 +22,12 @@
* *
*******************************************************************************/
#include "Algo/Filtering/functors.h"
#include "Algo/Selection/collector.h"
#ifndef __ALGO_BOOLEANOPERATOR_VERTICES_H__
#define __ALGO_BOOLEANOPERATOR_VERTICES_H__
#include "Geometry/basic.h"
#include "Geometry/inclusion.h"
#include "Geometry/orientation.h"
namespace CGoGN
{
......@@ -31,34 +35,21 @@ namespace CGoGN
namespace Algo
{
namespace Filtering
namespace BooleanOperator
{
template <typename PFP>
void filterAveragePositions(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select = SelectorTrue())
{
typedef typename PFP::VEC3 VEC3 ;
void mergeVertex(typename PFP::MAP& map, const typename PFP::TVEC3& positions, Dart d, Dart e);
FunctorAverage<typename PFP::MAP, typename PFP::VEC3> fa(map, position) ;
Algo::Selection::Collector_OneRing<PFP> c(map) ;
template <typename PFP>
void mergeVertices(typename PFP::MAP& map, const typename PFP::TVEC3& positions);
CellMarker markV(map, VERTEX);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(select(d) && !markV.isMarked(d))
{
markV.mark(d);
}
c.collectBorder(d) ;
fa.reset() ;
c.applyOnBorder(fa) ;
position2[d] = fa.getAverage() ;
}
}
}
} // namespace Filtering
}
} // namespace Algo
#include "mergeVertices.hpp"
} // namespace CGoGN
#endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
namespace Algo
{
namespace BooleanOperator
{
template <typename PFP>
void mergeVertex(typename PFP::MAP& map, const typename PFP::TVEC3& positions, Dart d, Dart e)
{
assert(Geom::arePointsEquals(positions[d],positions[e]) && !map.sameVertex(d,e));
Dart dd;
do
{
dd = map.alpha1(d);
map.removeEdgeFromVertex(dd);
Dart ee = e;
do
{
if(Geom::testOrientation2D(positions[map.phi1(dd)],positions[ee],positions[map.phi1(ee)])!=Geom::RIGHT
&& Geom::testOrientation2D(positions[map.phi1(dd)],positions[ee],positions[map.phi1(map.alpha1(ee))])==Geom::RIGHT)
{
break;
}
ee = map.alpha1(ee);
} while(ee != e);
map.insertEdgeInVertex(ee,dd);
} while(dd!=d);
}
template <typename PFP>
void mergeVertices(typename PFP::MAP& map, const typename PFP::TVEC3& positions)
{
for(Dart d = map.begin() ; d != map.end() ; map.next(d))
{
CellMarker vM(map,VERTEX);
vM.mark(d);
for(Dart dd = map.begin() ; dd != map.end() ; map.next(dd))
{
if(!vM.isMarked(dd))
{
vM.mark(dd);
if(Geom::arePointsEquals(positions[d],positions[dd]))
{
mergeVertex<PFP>(map,positions,d,dd);
}
}
}
}
}
}
}
}
......@@ -149,7 +149,7 @@ void decimate(
while(!finished)
{
CGoGNout << "Countdown : " ;
CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" /* flush */ ;
CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" << CGoGNflush ;
if(!selector->nextEdge(d)) {
CGoGNout << CGoGNendl << "out" << CGoGNendl ;
......
......@@ -74,15 +74,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
/**
* export the map into a PLYPTM file
* @param the_map map to be exported
* @param map map to be exported
* @param filename filename of ply file
* @param position the position container
* @param frame[3] table of 3 vectors representing the local frame
* @param colorPTM[6] function coefficients (6) for each color channel (3)
* @return true
*/
template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const typename PFP::TREAL errL2 = AttributeHandler<typename PFP::REAL>(), const typename PFP::TREAL errLmax = AttributeHandler<typename PFP::REAL>(), const typename PFP::TREAL stdDev = AttributeHandler<typename PFP::REAL>(), const FunctorSelect& good = SelectorTrue()) ;
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good = SelectorTrue()) ;
/**
......
This diff is collapsed.
......@@ -95,7 +95,7 @@ void exportMeshWire(std::ofstream& out, typename PFP::MAP& map, typename PFP::TV
if(position[dd][0]!=position[map.phi1(dd)][0] || position[dd][1]!=position[map.phi1(dd)][1] || position[dd][2]!=position[map.phi1(dd)][2]) {
out << "cylinder{ " << std::endl;
out << "<" << position[dd][0] << "," << position[dd][2] << "," << position[dd][1] << ">," << std::endl;
out << "<" << position[map.phi1(dd)][0] << "," << position[map.phi1(dd)][2] << "," << position[map.phi1(dd)][1] << ">, 0.5" << std::endl;
out << "<" << position[map.phi1(dd)][0] << "," << position[map.phi1(dd)][2] << "," << position[map.phi1(dd)][1] << ">, 1.5" << std::endl;
out << "}" << std::endl;
}
dd = map.phi1(dd);
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Algo/Filtering/functors.h"
#include "Algo/Selection/collector.h"
namespace CGoGN
{
namespace Algo
{
namespace Filtering
{
enum neighborhood { INSIDE = 1, BORDER = 2 };
template <typename PFP, typename T>
void filterAverageAttribute_OneRing(
typename PFP::MAP& map,
const AttributeHandler<T>& attIn,
AttributeHandler<T>& attOut,
int neigh,
const FunctorSelect& select = SelectorTrue())
{
FunctorAverage<T> fa(attIn) ;
Algo::Selection::Collector_OneRing<PFP> col(map) ;
CellMarker markV(map, VERTEX) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(select(d) && !markV.isMarked(d))
{
markV.mark(d) ;
if (neigh & INSIDE)
col.collectAll(d) ;
else
col.collectBorder(d) ;
fa.reset() ;
if (neigh & INSIDE)
{
switch (attIn.getOrbit())
{
case VERTEX :
col.applyOnInsideVertices(fa) ;
break;
case EDGE :
col.applyOnInsideEdges(fa) ;
break;
case FACE :
col.applyOnInsideFaces(fa) ;
break;
}
}
if (neigh & BORDER) col.applyOnBorder(fa) ;
attOut[d] = fa.getAverage() ;
}
}
}
template <typename PFP, typename T>
void filterAverageEdgesAttribute_WithinSphere(
typename PFP::MAP& map,
const AttributeHandler<T>& attIn,
AttributeHandler<T>& attOut,
int neigh,
typename PFP::TVEC3 & position,
typename PFP::REAL radius,
const FunctorSelect& select = SelectorTrue())
{
FunctorAverage<T> fa(attIn) ;
Algo::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
CellMarker markV(map, VERTEX) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(select(d) && !markV.isMarked(d))
{
markV.mark(d) ;
if (neigh & INSIDE)
col.collectAll(d) ;
else
col.collectBorder(d) ;
fa.reset() ;
if (neigh & INSIDE) col.applyOnInsideEdges(fa) ;
if (neigh & BORDER) col.applyOnBorder(fa) ;
attOut[d] = fa.getAverage() ;
}
}
}
template <typename PFP, typename T>
void filterAverageFacesAttribute_WithinSphere(
typename PFP::MAP& map,
const AttributeHandler<T>& attIn,
AttributeHandler<T>& attOut,
int neigh,
typename PFP::TVEC3 & position,
typename PFP::REAL radius,
const FunctorSelect& select = SelectorTrue())
{
FunctorAverage<T> fa(attIn) ;
Algo::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
CellMarker markV(map, VERTEX) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(select(d) && !markV.isMarked(d))