viewer.h 5.04 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
#include "Algo/Render/GL2/topo3Render.h"
#include "Algo/Render/GL2/explodeVolumeRender.h"

pitiot's avatar
pitiot committed
35 36


Thomas Pitiot 's avatar
Thomas Pitiot committed
37

pitiot's avatar
pitiot committed
38 39 40 41 42 43 44
#include "Utils/colorMaps.h"
#include "Utils/vbo.h"
#include "Utils/fbo.h"
#include "Utils/drawer.h"
#include "Utils/pointSprite.h"


pitiot's avatar
init  
pitiot committed
45 46 47 48 49 50
#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/frameManipulator.h"
 ///// UI
#include "ui_Volusion.h"
#include "Utils/Qt/qtui.h"
51

Thomas Jund's avatar
Thomas Jund committed
52

Pierre Kraemer's avatar
Pierre Kraemer committed
53

Thomas Jund's avatar
Thomas Jund committed
54

pitiot's avatar
pitiot committed
55

pitiot's avatar
init  
pitiot committed
56
//#include "Utils/chrono.h"   // chrono
pitiot's avatar
pitiot committed
57

pitiot's avatar
init  
pitiot committed
58 59
//// application
#include "simulator.h"
pitiot's avatar
pitiot committed
60

Thomas Jund's avatar
Thomas Jund committed
61

Pierre Kraemer's avatar
Pierre Kraemer committed
62 63
using namespace CGoGN ;

pitiot's avatar
init  
pitiot committed
64 65 66 67 68 69 70 71
/**
 * 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
72
{
Pierre Kraemer's avatar
Pierre Kraemer committed
73 74
	Q_OBJECT

pitiot's avatar
init  
pitiot committed
75 76 77
    bool render_volumes;
	bool render_edges;
    bool render_topo;
pitiot's avatar
pitiot committed
78
    bool render_MovingObject;
pitiot's avatar
init  
pitiot committed
79 80 81
    bool render_topoTemp;
    bool clip_volume;
    bool hide_clipping;
pitiot's avatar
pitiot committed
82 83 84 85 86 87
    bool draw_dart;
    float m_explode_factor;
    float m_explode_factorf;
    bool render_belonging;
    bool render_neighbors;
    int val_comboEdge;
Thomas Jund's avatar
Thomas Jund committed
88

pitiot's avatar
init  
pitiot committed
89 90
	Algo::Render::GL2::Topo3RenderMap<PFP>* m_topo_render;
	Algo::Render::GL2::ExplodeVolumeRender* m_explode_render;
Thomas Jund's avatar
Thomas Jund committed
91

pitiot's avatar
pitiot committed
92

Thomas Pitiot 's avatar
Thomas Pitiot committed
93

pitiot's avatar
pitiot committed
94 95
    unsigned int dartSlider;

pitiot's avatar
pitiot committed
96 97
    //MovingObject
    Utils::VBO* m_MovingObjectVBO;
pitiot's avatar
pitiot committed
98 99 100
    Utils::PointSprite* m_sprite;
    Utils::Drawer* m_ds;
//    Utils::Pickable* cylinder;
pitiot's avatar
pitiot committed
101
    Utils::FrameManipulator* m_frame_MovingObject;
pitiot's avatar
pitiot committed
102 103 104 105 106
    unsigned int m_picked_part;
    int startX;
    int startY;
    VEC3 oldPosSprite;

Thomas Jund's avatar
Thomas Jund committed
107

pitiot's avatar
init  
pitiot committed
108 109 110 111 112 113 114 115
	// 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
116

pitiot's avatar
init  
pitiot committed
117 118 119
	// shader of toporender3
	Utils::ClippingShader* m_sh1;
	Utils::ClippingShader* m_sh2;
pitiot's avatar
merging  
pitiot committed
120

pitiot's avatar
init  
pitiot committed
121 122 123 124
public:
	float m_WidthObj;
	Geom::Vec3f m_PosObj;
	Simulator simul;
pitiot's avatar
pitiot committed
125
    Utils::QT::uiDockInterface dock;
David Cazier's avatar
David Cazier committed
126

pitiot's avatar
init  
pitiot committed
127 128
public:
	Volusion():
Thomas Pitiot 's avatar
Thomas Pitiot committed
129
        render_volumes(false),
pitiot's avatar
init  
pitiot committed
130 131
		render_edges(true),
		render_topo(false),
pitiot's avatar
pitiot committed
132
        render_MovingObject(true),
pitiot's avatar
init  
pitiot committed
133 134 135
		render_topoTemp(false),
		clip_volume(false),
		hide_clipping(true),
pitiot's avatar
pitiot committed
136 137 138 139 140 141 142 143 144
        draw_dart(false),
        m_explode_factor(1.0f),
        render_belonging(false),
        render_neighbors(false),
        val_comboEdge(0),
        m_topo_render(NULL),
        m_explode_render(NULL),
        dartSlider(0)

pitiot's avatar
init  
pitiot committed
145 146 147 148 149 150 151 152 153
	{}

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);
pitiot's avatar
up  
pitiot committed
154
    void cb_keyPress(int code);
pitiot's avatar
init  
pitiot committed
155
	void cb_Open();
Arash HABIBI's avatar
Arash HABIBI committed
156

Pierre Kraemer's avatar
Pierre Kraemer committed
157
	void animate() ;
pitiot's avatar
init  
pitiot committed
158 159 160 161 162
// slots locaux
public slots:
	void volumes_onoff(bool x);
	void edges_onoff(bool x);
	void topo_onoff(bool x);
pitiot's avatar
pitiot committed
163
    void MovingObject_onoff(bool x);
pitiot's avatar
pitiot committed
164 165 166
    void belonging_onoff(bool x);
    void neighbors_onoff(bool x);
    void comboEdge(int x);
pitiot's avatar
init  
pitiot committed
167 168 169 170 171 172
	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);
pitiot's avatar
pitiot committed
173 174 175
    void slot_slide(int i);
    void dart_onoff(bool x);

pitiot's avatar
init  
pitiot committed
176 177 178
};

#endif // VIEWER