viewer.h 3.88 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 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, 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: https://iggservis.u-strasbg.fr/CGoGN/                              *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#include <iostream>

Pierre Kraemer's avatar
Pierre Kraemer committed
27
#include "Utils/Qt/qtSimple.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
28
#include "ui_socialAgents.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
29
#include "Utils/Qt/qtui.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
30 31 32

#include "simulator.h"
#include "env_render.h"
Thomas's avatar
Thomas committed
33
#include "exportObstacles.h"
34
#include "gl2ps.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
35

Pierre Kraemer's avatar
Pierre Kraemer committed
36
#include "Algo/Geometry/boundingbox.h"
37

Pierre Kraemer's avatar
Pierre Kraemer committed
38
#include "Algo/Export/exportPov.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
39
#include "Utils/GLSLShader.h"
Pierre Kraemer's avatar
yeah  
Pierre Kraemer committed
40
#include "Utils/colorMaps.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
41 42 43 44 45 46 47
#include "Algo/Render/GL1/map_glRender.h"
#include "Algo/Render/GL1/topo_render.h"

using namespace CGoGN ;

typedef PFP::MAP MAP;

Pierre Kraemer's avatar
Pierre Kraemer committed
48
class SocialAgents : public Utils::QT::SimpleQT
Pierre Kraemer's avatar
Pierre Kraemer committed
49
{
Pierre Kraemer's avatar
Pierre Kraemer committed
50 51
	Q_OBJECT

Pierre Kraemer's avatar
Pierre Kraemer committed
52
public:
Pierre Kraemer's avatar
Pierre Kraemer committed
53
	SocialAgents() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
54

Pierre Kraemer's avatar
Pierre Kraemer committed
55 56 57 58
	void initGUI() ;

	void cb_initGL() ;
	void cb_redraw() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
59

Pierre Kraemer's avatar
Pierre Kraemer committed
60
#ifndef SPATIAL_HASHING
Thomas's avatar
Thomas committed
61
	void exportInfoFace(std::ofstream& out, Dart d);
62
	bool exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::string& filename, PFP::VEC3 cameraPos, PFP::VEC3 cameraLook, PFP::VEC3 translate, float angle_X, float angle_Y, float angle_Z,const FunctorSelect& good = SelectorTrue());
Pierre Kraemer's avatar
Pierre Kraemer committed
63
#endif
Pierre Kraemer's avatar
Pierre Kraemer committed
64
	
Pierre Kraemer's avatar
Pierre Kraemer committed
65 66 67 68 69
	void cb_keyPress(int keycode) ;

    Utils::QT::uiDockInterface dock ;

    QTimer* timer;
Pierre Kraemer's avatar
Pierre Kraemer committed
70 71 72

	// to count fps
	int frames;
73
	float nextUpdate;
Pierre Kraemer's avatar
Pierre Kraemer committed
74 75 76 77 78 79 80 81 82 83
	bool displayFps;
	float fps;
	
	Simulator sim;
	SelectorTrue allDarts;

	bool render_anim;
	int visu;
	int nbGenerated;

Pierre Kraemer's avatar
Pierre Kraemer committed
84 85 86 87 88 89 90 91
	bool drawEnvLines ;
	bool drawEnvFaces ;
	bool drawEnvTopo ;
	bool drawObstacles ;
	bool drawAgents ;
	bool drawAgentsNeighborDist ;
	bool drawAgentsObstacleDist ;
	bool drawAgentsPredictionTri ;
Pierre Kraemer's avatar
Pierre Kraemer committed
92 93 94

public slots:
	void animate() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
95 96 97 98 99 100 101 102 103 104

	void slot_timer(bool b) { b ? timer->start() : timer->stop() ; }
	void slot_drawEnvLines(bool b) { drawEnvLines = b ; updateGL() ; }
	void slot_drawEnvFaces(bool b) { drawEnvFaces = b ; updateGL() ; }
	void slot_drawEnvTopo(bool b) { drawEnvTopo = b ; updateGL() ; }
	void slot_drawObstacles(bool b) { drawObstacles = b ; updateGL() ; }
	void slot_drawAgents(bool b) { drawAgents = b ; updateGL() ; }
	void slot_drawAgentsPredictionTri(bool b) { drawAgentsPredictionTri = b ; updateGL() ; }
	void slot_drawAgentsNeighborDist(bool b) { drawAgentsNeighborDist = b ; updateGL() ; }
	void slot_drawAgentsObstacleDist(bool b) { drawAgentsObstacleDist = b ; updateGL() ; }
Pierre Kraemer's avatar
Pierre Kraemer committed
105
} ;