viewer.h 5.1 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
#include "Utils/cgognStream.h"
46 47 48 49
//#include "Utils/Qt/qtSimple.h"

#include "Utils/Qt/qtQGLV.h"

pitiot's avatar
init  
pitiot committed
50 51 52 53
#include "Utils/frameManipulator.h"
 ///// UI
#include "ui_Volusion.h"
#include "Utils/Qt/qtui.h"
54

Thomas Jund's avatar
Thomas Jund committed
55

Pierre Kraemer's avatar
Pierre Kraemer committed
56

Thomas Jund's avatar
Thomas Jund committed
57

pitiot's avatar
pitiot committed
58

pitiot's avatar
init  
pitiot committed
59
//#include "Utils/chrono.h"   // chrono
pitiot's avatar
pitiot committed
60

pitiot's avatar
init  
pitiot committed
61 62
//// application
#include "simulator.h"
pitiot's avatar
pitiot committed
63

Thomas Jund's avatar
Thomas Jund committed
64

Pierre Kraemer's avatar
Pierre Kraemer committed
65 66
using namespace CGoGN ;

pitiot's avatar
init  
pitiot committed
67 68 69 70 71 72 73
/**
 * 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)
 */
74
class Volusion: public Utils::QT::SimpleQGLV
Pierre Kraemer's avatar
Pierre Kraemer committed
75
{
Pierre Kraemer's avatar
Pierre Kraemer committed
76 77
	Q_OBJECT

pitiot's avatar
init  
pitiot committed
78 79 80
    bool render_volumes;
	bool render_edges;
    bool render_topo;
pitiot's avatar
pitiot committed
81
    bool render_MovingObject;
pitiot's avatar
init  
pitiot committed
82
    bool render_topoTemp;
83 84
//    bool clip_volume;
//    bool hide_clipping;
pitiot's avatar
pitiot committed
85 86 87 88 89 90
    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
91

pitiot's avatar
init  
pitiot committed
92 93
	Algo::Render::GL2::Topo3RenderMap<PFP>* m_topo_render;
	Algo::Render::GL2::ExplodeVolumeRender* m_explode_render;
Thomas Jund's avatar
Thomas Jund committed
94

pitiot's avatar
pitiot committed
95

Thomas Pitiot 's avatar
Thomas Pitiot committed
96

pitiot's avatar
pitiot committed
97 98
    unsigned int dartSlider;

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

Thomas Jund's avatar
Thomas Jund committed
110

pitiot's avatar
init  
pitiot committed
111
	// for clipping plane manipulation
112 113 114 115 116 117 118 119 120 121 122
//	Utils::Pickable* m_PlanePick;
//	Utils::FrameManipulator* m_frame;
//	unsigned int m_pickedAxis;
//	int m_begX;
//	int m_begY;
//	int clip_id1;
//	int clip_id2;

//	// shader of toporender3
//	Utils::ClippingShader* m_sh1;
//	Utils::ClippingShader* m_sh2;
pitiot's avatar
merging  
pitiot committed
123

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

pitiot's avatar
init  
pitiot committed
130 131
public:
	Volusion():
Thomas Pitiot 's avatar
Thomas Pitiot committed
132
        render_volumes(false),
pitiot's avatar
init  
pitiot committed
133 134
		render_edges(true),
		render_topo(false),
pitiot's avatar
pitiot committed
135
        render_MovingObject(true),
pitiot's avatar
init  
pitiot committed
136
		render_topoTemp(false),
137 138
//		clip_volume(false),
//		hide_clipping(true),
pitiot's avatar
pitiot committed
139 140 141 142 143 144 145 146 147
        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
148 149 150 151 152 153 154 155 156
	{}

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
157
    void cb_keyPress(int code);
pitiot's avatar
init  
pitiot committed
158
	void cb_Open();
Arash HABIBI's avatar
Arash HABIBI committed
159

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

pitiot's avatar
init  
pitiot committed
179 180 181
};

#endif // VIEWER