viewer.h 4.02 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
/*******************************************************************************
pitiot's avatar
init  
pitiot committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009-2012, 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                                        *
*                                                                              *
*******************************************************************************/

#ifndef VIEWER
#define VIEWER
Pierre Kraemer's avatar
Pierre Kraemer committed
27 28 29

#include <iostream>

pitiot's avatar
init  
pitiot committed
30
#include "Geometry/vector_gen.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
31
#include "Algo/Geometry/boundingbox.h"
pitiot's avatar
init  
pitiot committed
32 33 34 35 36 37 38 39 40
#include "Algo/Render/GL2/topo3Render.h"
#include "Algo/Render/GL2/explodeVolumeRender.h"

#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/frameManipulator.h"
 ///// UI
#include "ui_Volusion.h"
#include "Utils/Qt/qtui.h"
41

Thomas Jund's avatar
Thomas Jund committed
42

Pierre Kraemer's avatar
Pierre Kraemer committed
43

Thomas Jund's avatar
Thomas Jund committed
44

pitiot's avatar
init  
pitiot committed
45
//#include "Utils/chrono.h"   // chrono
pitiot's avatar
pitiot committed
46

pitiot's avatar
init  
pitiot committed
47 48
//// application
#include "simulator.h"
pitiot's avatar
pitiot committed
49

Thomas Jund's avatar
Thomas Jund committed
50

Pierre Kraemer's avatar
Pierre Kraemer committed
51 52
using namespace CGoGN ;

pitiot's avatar
init  
pitiot committed
53 54 55 56 57 58 59 60
/**
 * Utilisation de designer-qt4:
 * Faire un DockWiget (laisser le nom par defaut
 * dans le Contents ajouter le layout choisi (vertical classiquement)
 * Ajouter les widgets necessaires, mettre des noms clairs pour
 * les utiliser dans le .cpp (pour les call back principalement)
 */
class Volusion: public Utils::QT::SimpleQT
Pierre Kraemer's avatar
Pierre Kraemer committed
61
{
Pierre Kraemer's avatar
Pierre Kraemer committed
62 63
	Q_OBJECT

pitiot's avatar
init  
pitiot committed
64 65 66 67 68 69
    bool render_volumes;
	bool render_edges;
    bool render_topo;
    bool render_topoTemp;
    bool clip_volume;
    bool hide_clipping;
Thomas Jund's avatar
Thomas Jund committed
70

pitiot's avatar
init  
pitiot committed
71 72
	Algo::Render::GL2::Topo3RenderMap<PFP>* m_topo_render;
	Algo::Render::GL2::ExplodeVolumeRender* m_explode_render;
Thomas Jund's avatar
Thomas Jund committed
73

pitiot's avatar
init  
pitiot committed
74 75
	float m_explode_factor;
	float m_explode_factorf;
Thomas Jund's avatar
Thomas Jund committed
76

pitiot's avatar
init  
pitiot committed
77 78 79 80 81 82 83 84
	// for clipping plane manipulation
	Utils::Pickable* m_PlanePick;
	Utils::FrameManipulator* m_frame;
	unsigned int m_pickedAxis;
	int m_begX;
	int m_begY;
	int clip_id1;
	int clip_id2;
pitiot's avatar
merging  
pitiot committed
85

pitiot's avatar
init  
pitiot committed
86 87 88
	// shader of toporender3
	Utils::ClippingShader* m_sh1;
	Utils::ClippingShader* m_sh2;
pitiot's avatar
merging  
pitiot committed
89

pitiot's avatar
init  
pitiot committed
90 91 92 93
public:
	float m_WidthObj;
	Geom::Vec3f m_PosObj;
	Simulator simul;
David Cazier's avatar
David Cazier committed
94

pitiot's avatar
init  
pitiot committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
public:
	Volusion():
		render_volumes(true),
		render_edges(true),
		render_topo(false),
		render_topoTemp(false),
		clip_volume(false),
		hide_clipping(true),
		m_topo_render(NULL),
		m_explode_render(NULL),
		m_explode_factor(1.0f)
	{}

protected:

	void cb_redraw();
	void cb_initGL();
	void cb_mouseMove(int buttons, int x, int y);
	void cb_mousePress(int button, int x, int y);
	void cb_mouseRelease(int button, int x, int y);
	void cb_Open();
Arash HABIBI's avatar
Arash HABIBI committed
116

Pierre Kraemer's avatar
Pierre Kraemer committed
117
	void animate() ;
pitiot's avatar
init  
pitiot committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131
// slots locaux
public slots:
	void volumes_onoff(bool x);
	void edges_onoff(bool x);
	void topo_onoff(bool x);
	void clipping_onoff(bool x);
	void hide_onoff(bool x);
	void slider_explode(int x);
	void slider_pressed();
	void slider_released();
	void slider_explodeF(int x);
};

#endif // VIEWER