viewer.h 5 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 37 38 39 40 41 42 43


#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
44 45 46 47 48 49
#include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/frameManipulator.h"
 ///// UI
#include "ui_Volusion.h"
#include "Utils/Qt/qtui.h"
50

Thomas Jund's avatar
Thomas Jund committed
51

Pierre Kraemer's avatar
Pierre Kraemer committed
52

Thomas Jund's avatar
Thomas Jund committed
53

pitiot's avatar
pitiot committed
54

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

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

Thomas Jund's avatar
Thomas Jund committed
60

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

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

pitiot's avatar
init  
pitiot committed
74 75 76
    bool render_volumes;
	bool render_edges;
    bool render_topo;
pitiot's avatar
pitiot committed
77
    bool render_MovingObject;
pitiot's avatar
init  
pitiot committed
78 79 80
    bool render_topoTemp;
    bool clip_volume;
    bool hide_clipping;
pitiot's avatar
pitiot committed
81 82 83 84 85 86
    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
87

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

pitiot's avatar
pitiot committed
91 92 93

    unsigned int dartSlider;

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

Thomas Jund's avatar
Thomas Jund committed
105

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

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

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

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

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
153

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

pitiot's avatar
init  
pitiot committed
173 174 175
};

#endif // VIEWER