Commit e8672e4d authored by Sylvain Thery's avatar Sylvain Thery

add test of surface plane cutting to Sandbox

parent 8ce878a4
...@@ -36,6 +36,11 @@ add_executable(test_traversor2 test_traversor2.cpp ${test_traversor2_ui} ${test ...@@ -36,6 +36,11 @@ add_executable(test_traversor2 test_traversor2.cpp ${test_traversor2_ui} ${test
target_link_libraries(test_traversor2 ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS}) target_link_libraries(test_traversor2 ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
QT4_WRAP_UI( testPlaneCutting_ui testPlaneCutting.ui )
QT4_WRAP_CPP(testPlaneCutting_moc testPlaneCutting.h)
add_executable(testPlaneCutting testPlaneCutting.cpp ${testPlaneCutting_ui} ${testPlaneCutting_moc})
target_link_libraries(testPlaneCutting ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
# Example with Qt # Example with Qt
# #
#QT4_WRAP_CPP(tuto1_moc tuto1.h) #QT4_WRAP_CPP(tuto1_moc tuto1.h)
......
This diff is collapsed.
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, 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.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include "Utils/Qt/qtQGLV.h"
#include "ui_testPlaneCutting.h"
#include "Utils/Qt/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Algo/Render/GL2/topoRender.h"
#include "Utils/Shaders/shaderPhong.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/pointSprite.h"
#include "Utils/text3d.h"
#include "Utils/vbo.h"
#include "Utils/Qt/qtInputs.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Geometry/convexity.h"
using namespace CGoGN ;
struct PFP: public PFP_STANDARD
{
// definition of the map
typedef EmbeddedMap2 MAP ;
};
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
class Viewer : public Utils::QT::SimpleQGLV
{
Q_OBJECT
public:
MAP myMap ;
Utils::QT::uiDockInterface dock ;
enum renderMode { FLAT, PHONG } ;
Geom::Vec4f colDif ;
Geom::Vec4f colSpec ;
Geom::Vec4f colClear ;
Geom::Vec4f colNormal ;
float shininess ;
Geom::BoundingBox<PFP::VEC3> bb ;
float normalBaseSize ;
float normalScaleFactor ;
float vertexBaseSize ;
float vertexScaleFactor ;
float faceShrinkage ;
int m_renderStyle ;
bool m_drawVertices ;
bool m_drawEdges ;
bool m_drawFaces ;
bool m_drawNormals ;
bool m_drawTopo ;
bool m_drawBoundaryTopo;
VertexAttribute<VEC3> position ;
VertexAttribute<VEC3> normal ;
Algo::Render::GL2::MapRender* m_render ;
Algo::Render::GL2::TopoRender* m_topoRender ;
Utils::VBO* m_positionVBO ;
Utils::VBO* m_normalVBO;
Utils::ShaderPhong* m_phongShader ;
Utils::ShaderFlat* m_flatShader ;
Utils::ShaderVectorPerVertex* m_vectorShader ;
Utils::ShaderSimpleColor* m_simpleColorShader ;
Utils::PointSprite* m_pointSprite ;
Viewer() ;
void initGUI() ;
void cb_initGL() ;
void cb_redraw() ;
void cb_Open() ;
void cb_Save() ;
void cb_keyPress(int keycode);
void importMesh(std::string& filename) ;
void exportMesh(std::string& filename, bool askExportMode = true);
public slots:
void slot_drawVertices(bool b) ;
void slot_verticesSize(int i) ;
void slot_drawEdges(bool b) ;
void slot_drawFaces(bool b) ;
void slot_faceLighting(int i) ;
void slot_drawTopo(bool b) ;
void slot_drawNormals(bool b) ;
void slot_normalsSize(int i) ;
};
<?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>174</width>
<height>393</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>174</width>
<height>393</height>
</size>
</property>
<property name="windowTitle">
<string>Commands</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Visu</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="check_drawVertices">
<property name="text">
<string>draw vertices</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_verticesSize">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="check_drawEdges">
<property name="text">
<string>draw edges</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="check_drawFaces">
<property name="text">
<string>draw faces</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_faceLighting">
<item>
<property name="text">
<string>FLAT</string>
</property>
</item>
<item>
<property name="text">
<string>PHONG</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="check_drawTopo">
<property name="text">
<string>draw topo</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="check_drawNormals">
<property name="text">
<string>draw normals</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_normalsSize">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>check_drawFaces</sender>
<signal>toggled(bool)</signal>
<receiver>combo_faceLighting</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>65</x>
<y>98</y>
</hint>
<hint type="destinationlabel">
<x>65</x>
<y>127</y>
</hint>
</hints>
</connection>
<connection>
<sender>check_drawNormals</sender>
<signal>toggled(bool)</signal>
<receiver>slider_normalsSize</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>75</x>
<y>191</y>
</hint>
<hint type="destinationlabel">
<x>75</x>
<y>222</y>
</hint>
</hints>
</connection>
<connection>
<sender>check_drawVertices</sender>
<signal>toggled(bool)</signal>
<receiver>slider_verticesSize</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>75</x>
<y>44</y>
</hint>
<hint type="destinationlabel">
<x>75</x>
<y>75</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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