Merge branch 'master' of https://git.epicsparrow.com/epicsparrow/PixelWars
This commit is contained in:
commit
e35cdd3b15
@ -14,11 +14,11 @@
|
|||||||
DrawWidget::DrawWidget(QWidget *parent) :
|
DrawWidget::DrawWidget(QWidget *parent) :
|
||||||
QOpenGLWidget(parent),
|
QOpenGLWidget(parent),
|
||||||
m_Qt_fbo(NULL),
|
m_Qt_fbo(NULL),
|
||||||
m_pipeline(NULL),
|
m_pipeline(NULL)
|
||||||
m_map(NULL)
|
|
||||||
{
|
{
|
||||||
new_simulation = false;
|
new_simulation = false;
|
||||||
update_needed = false;
|
update_needed = false;
|
||||||
|
m_map = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawWidget::~DrawWidget()
|
DrawWidget::~DrawWidget()
|
||||||
@ -32,7 +32,7 @@ DrawWidget::~DrawWidget()
|
|||||||
void DrawWidget::initializeGL()
|
void DrawWidget::initializeGL()
|
||||||
{
|
{
|
||||||
renderer.initGL(width(), height());
|
renderer.initGL(width(), height());
|
||||||
renderer.setScene(m_map);
|
stopSimulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawWidget::paintGL()
|
void DrawWidget::paintGL()
|
||||||
@ -43,6 +43,8 @@ void DrawWidget::paintGL()
|
|||||||
delete m_pipeline;
|
delete m_pipeline;
|
||||||
m_map->initDraw();
|
m_map->initDraw();
|
||||||
m_pipeline = new PixelPipeline(m_map);
|
m_pipeline = new PixelPipeline(m_map);
|
||||||
|
if(m_map == m_dummyMap)
|
||||||
|
m_pipeline->setShowToreiller(false);
|
||||||
m_pipeline->setTargetFBO(m_Qt_fbo);
|
m_pipeline->setTargetFBO(m_Qt_fbo);
|
||||||
m_pipeline->resizeGL(m_width, m_height);
|
m_pipeline->resizeGL(m_width, m_height);
|
||||||
renderer.setScene(m_map);
|
renderer.setScene(m_map);
|
||||||
@ -69,7 +71,7 @@ void DrawWidget::resizeGL(int w, int h)
|
|||||||
if(m_Qt_fbo != NULL && m_Qt_fbo != FrameBuffer::screen)
|
if(m_Qt_fbo != NULL && m_Qt_fbo != FrameBuffer::screen)
|
||||||
delete(m_Qt_fbo);
|
delete(m_Qt_fbo);
|
||||||
m_Qt_fbo = new FrameBuffer(defaultFramebufferObject());
|
m_Qt_fbo = new FrameBuffer(defaultFramebufferObject());
|
||||||
if(m_map != NULL)
|
if(m_pipeline != NULL)
|
||||||
m_pipeline->setTargetFBO(m_Qt_fbo);
|
m_pipeline->setTargetFBO(m_Qt_fbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +79,14 @@ void DrawWidget::startSimulation(MapScene *map)
|
|||||||
{
|
{
|
||||||
m_map = map;
|
m_map = map;
|
||||||
new_simulation = true;
|
new_simulation = true;
|
||||||
|
m_dummyMap = NULL;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawWidget::stopSimulation()
|
||||||
|
{
|
||||||
|
m_map = m_dummyMap = new MapScene();
|
||||||
|
new_simulation = true;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ class DrawWidget : public QOpenGLWidget
|
|||||||
QPoint lastMousePos;
|
QPoint lastMousePos;
|
||||||
bool grabbedMouse;
|
bool grabbedMouse;
|
||||||
MapScene *m_map;
|
MapScene *m_map;
|
||||||
|
MapScene *m_dummyMap;
|
||||||
FrameBuffer *m_Qt_fbo;
|
FrameBuffer *m_Qt_fbo;
|
||||||
PixelPipeline *m_pipeline;
|
PixelPipeline *m_pipeline;
|
||||||
int m_width;
|
int m_width;
|
||||||
@ -48,6 +49,7 @@ class DrawWidget : public QOpenGLWidget
|
|||||||
DrawWidget(QWidget *parent = 0);
|
DrawWidget(QWidget *parent = 0);
|
||||||
~DrawWidget();
|
~DrawWidget();
|
||||||
void startSimulation(MapScene *map);
|
void startSimulation(MapScene *map);
|
||||||
|
void stopSimulation();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateDudesBehavior();
|
void updateDudesBehavior();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QErrorMessage>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@ -20,14 +21,17 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
m_simuTimer = new QTimer(this);
|
m_simuTimer = new QTimer(this);
|
||||||
connect(m_simuTimer,SIGNAL(timeout()),this, SLOT(updateSimu()));
|
connect(m_simuTimer,SIGNAL(timeout()),this, SLOT(updateSimu()));
|
||||||
m_simuTimer->start(m_simSpeed);
|
m_simuTimer->start(m_simSpeed);
|
||||||
connect(ui->startButton, SIGNAL(pressed()), this, SLOT(openSimuDialog()));
|
connect(ui->actionCreate_new_simulation, SIGNAL(triggered(bool)), this, SLOT(openSimuDialog()));
|
||||||
connect(ui->simSpeedSlider, SIGNAL(valueChanged(int)), this, SLOT(changeSimSpeed(int)));
|
connect(ui->simSpeedSlider, SIGNAL(valueChanged(int)), this, SLOT(changeSimSpeed(int)));
|
||||||
connect(ui->flatSphereSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(setFlatSphere(int)));
|
connect(ui->flatSphereSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(setFlatSphere(int)));
|
||||||
connect(ui->surfaceRatioSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(setSurfaceRatio(int)));
|
connect(ui->surfaceRatioSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(setSurfaceRatio(int)));
|
||||||
connect(ui->flatSphereSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(repaint()));
|
connect(ui->flatSphereSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(repaint()));
|
||||||
connect(ui->surfaceRatioSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(repaint()));
|
connect(ui->surfaceRatioSlider, SIGNAL(valueChanged(int)), ui->drawWidget, SLOT(repaint()));
|
||||||
connect(ui->pauseButton, SIGNAL(toggled(bool)), this, SLOT(pauseSimu(bool)));
|
connect(ui->actionPlayPause, SIGNAL(toggled(bool)), this, SLOT(pauseSimu(bool)));
|
||||||
|
connect(ui->actionAction_step, SIGNAL(triggered(bool)), this, SLOT(stepSimu()));
|
||||||
|
connect(ui->actionStop, SIGNAL(triggered(bool)), this, SLOT(stopSimu()));
|
||||||
changeSimSpeed(ui->simSpeedSlider->value());
|
changeSimSpeed(ui->simSpeedSlider->value());
|
||||||
|
ui->advancedGroupBox->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -40,7 +44,8 @@ void MainWindow::openSimuDialog()
|
|||||||
pauseSimu(true);
|
pauseSimu(true);
|
||||||
SimulationDialog *dialog = new SimulationDialog(this);
|
SimulationDialog *dialog = new SimulationDialog(this);
|
||||||
dialog->setWindowTitle("Starting a new Simulation");
|
dialog->setWindowTitle("Starting a new Simulation");
|
||||||
connect(dialog, SIGNAL(sendError(QString, int)), ui->statusBar, SLOT(showMessage(QString, int)));
|
QErrorMessage *err = new QErrorMessage(dialog);
|
||||||
|
connect(dialog, SIGNAL(sendError(QString)), err, SLOT(showMessage(QString)));
|
||||||
int ret = dialog->exec();
|
int ret = dialog->exec();
|
||||||
if(ret == QDialog::Accepted)
|
if(ret == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
@ -51,6 +56,7 @@ void MainWindow::openSimuDialog()
|
|||||||
m_date = 0;
|
m_date = 0;
|
||||||
}
|
}
|
||||||
pauseSimu(false);
|
pauseSimu(false);
|
||||||
|
delete dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::changeSimSpeed(int newSpeed)
|
void MainWindow::changeSimSpeed(int newSpeed)
|
||||||
@ -80,19 +86,27 @@ void MainWindow::updateSimu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::stepSimu()
|
||||||
|
{
|
||||||
|
m_paused = false;
|
||||||
|
updateSimu();
|
||||||
|
pauseSimu(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::stopSimu()
|
||||||
|
{
|
||||||
|
pauseSimu(true);
|
||||||
|
ui->drawWidget->stopSimulation();
|
||||||
|
delete p_simu;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::pauseSimu(bool pause)
|
void MainWindow::pauseSimu(bool pause)
|
||||||
{
|
{
|
||||||
m_paused = pause;
|
m_paused = pause;
|
||||||
ui->pauseButton->setChecked(m_paused);
|
ui->actionPlayPause->setChecked(m_paused);
|
||||||
if(m_paused)
|
if(m_paused)
|
||||||
{
|
|
||||||
m_simuTimer->stop();
|
m_simuTimer->stop();
|
||||||
ui->pauseButton->setText("RESUME");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_simuTimer->start(m_simSpeed);
|
m_simuTimer->start(m_simSpeed);
|
||||||
ui->pauseButton->setText("PAUSE");
|
|
||||||
}
|
|
||||||
m_simSpeedChanged = false;
|
m_simSpeedChanged = false;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ private slots:
|
|||||||
void openSimuDialog();
|
void openSimuDialog();
|
||||||
void changeSimSpeed(int newSpeed);
|
void changeSimSpeed(int newSpeed);
|
||||||
void updateSimu();
|
void updateSimu();
|
||||||
|
void stepSimu();
|
||||||
|
void stopSimu();
|
||||||
void pauseSimu(bool);
|
void pauseSimu(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,25 +35,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>744</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<widget class="QMenu" name="menuMenu">
|
|
||||||
<property name="title">
|
|
||||||
<string>Menu</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionControl_Panel"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionQuit"/>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menuMenu"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QDockWidget" name="dockWidget">
|
<widget class="QDockWidget" name="dockWidget">
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@ -74,7 +55,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
@ -88,16 +69,77 @@
|
|||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>8</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="4" column="0">
|
<item row="6" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="dateLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Simulation Speed</string>
|
<string>0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0" colspan="3">
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Population</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="populationLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="3">
|
||||||
|
<widget class="QSlider" name="simSpeedSlider">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>980</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>980</number>
|
||||||
|
</property>
|
||||||
|
<property name="sliderPosition">
|
||||||
|
<number>980</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="invertedControls">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="tickPosition">
|
||||||
|
<enum>QSlider::TicksBelow</enum>
|
||||||
|
</property>
|
||||||
|
<property name="tickInterval">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Date</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="0" colspan="3">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -110,16 +152,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Simulation Speed</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="9" column="0" colspan="3">
|
<item row="9" column="0" colspan="3">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="0" colspan="3">
|
||||||
|
<widget class="QGroupBox" name="advancedGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Advanced</string>
|
<string>Advanced Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@ -210,125 +266,10 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1" colspan="2">
|
<item row="10" column="0">
|
||||||
<widget class="QLabel" name="populationLabel">
|
<widget class="QCheckBox" name="advancedCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0</string>
|
<string>Advanced</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1" colspan="2">
|
|
||||||
<widget class="QSlider" name="simSpeedSlider">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>980</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>980</number>
|
|
||||||
</property>
|
|
||||||
<property name="sliderPosition">
|
|
||||||
<number>980</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="invertedAppearance">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="invertedControls">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="tickPosition">
|
|
||||||
<enum>QSlider::TicksBelow</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tickInterval">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1" colspan="2">
|
|
||||||
<widget class="QLabel" name="dateLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Population</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Date</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0" colspan="3">
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="startButton">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>START</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pauseButton">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>PAUSE</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Space</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -338,12 +279,34 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QToolBar" name="toolBar">
|
||||||
<action name="actionQuit">
|
<property name="windowTitle">
|
||||||
<property name="text">
|
<string>toolBar</string>
|
||||||
<string>Quit</string>
|
|
||||||
</property>
|
</property>
|
||||||
</action>
|
<property name="movable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="allowedAreas">
|
||||||
|
<set>Qt::TopToolBarArea</set>
|
||||||
|
</property>
|
||||||
|
<property name="floatable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<addaction name="actionCreate_new_simulation"/>
|
||||||
|
<addaction name="actionStop"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionPlayPause"/>
|
||||||
|
<addaction name="actionAction_step"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionControl_Panel"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="actionControl_Panel">
|
<action name="actionControl_Panel">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -352,7 +315,65 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Control Panel</string>
|
<string>Toggle Control Panel</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPlayPause">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/qss_icons/rc/pause.png</normaloff>
|
||||||
|
<normalon>:/qss_icons/rc/play.png</normalon>:/qss_icons/rc/pause.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>PlayPause</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Play / Pause</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Space</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionStop">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/qss_icons/rc/stop.png</normaloff>:/qss_icons/rc/stop.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Stop this simulation</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionCreate_new_simulation">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/qss_icons/rc/PixelWars.png</normaloff>:/qss_icons/rc/PixelWars.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create new simulation</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new simulation</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionAction_step">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources.qrc">
|
||||||
|
<normaloff>:/qss_icons/rc/step.png</normaloff>:/qss_icons/rc/step.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Action step</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>performs only one turn of simulation</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Right</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
@ -362,26 +383,23 @@
|
|||||||
<class>DrawWidget</class>
|
<class>DrawWidget</class>
|
||||||
<extends>QOpenGLWidget</extends>
|
<extends>QOpenGLWidget</extends>
|
||||||
<header>drawwidget.h</header>
|
<header>drawwidget.h</header>
|
||||||
|
<slots>
|
||||||
|
<signal>pauseEvent()</signal>
|
||||||
|
<signal>updateFPS(double,double)</signal>
|
||||||
|
<slot>addParticles()</slot>
|
||||||
|
<slot>addMesh()</slot>
|
||||||
|
<slot>resetScene()</slot>
|
||||||
|
<slot>setPaused(bool)</slot>
|
||||||
|
<slot>resetCamera()</slot>
|
||||||
|
<slot>setTimeRate(int)</slot>
|
||||||
|
<slot>setNbIterations(int)</slot>
|
||||||
|
</slots>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../resources.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>actionQuit</sender>
|
|
||||||
<signal>triggered()</signal>
|
|
||||||
<receiver>MainWindow</receiver>
|
|
||||||
<slot>close()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>-1</x>
|
|
||||||
<y>-1</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>371</x>
|
|
||||||
<y>244</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>actionControl_Panel</sender>
|
<sender>actionControl_Panel</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
@ -414,5 +432,21 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>advancedCheckBox</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>advancedGroupBox</receiver>
|
||||||
|
<slot>setVisible(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>54</x>
|
||||||
|
<y>183</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>102</x>
|
||||||
|
<y>240</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -32,7 +32,8 @@ PixelPipeline::PixelPipeline(MapScene *map) :
|
|||||||
m_map(map),
|
m_map(map),
|
||||||
m_mapWidth(map->getWidth()),
|
m_mapWidth(map->getWidth()),
|
||||||
m_mapHeight(map->getHeight()),
|
m_mapHeight(map->getHeight()),
|
||||||
m_camera(0, 0, 1)
|
m_camera(0, 0, 1),
|
||||||
|
m_showToreiller(true)
|
||||||
{
|
{
|
||||||
m_width = 256;
|
m_width = 256;
|
||||||
m_height = 256;
|
m_height = 256;
|
||||||
@ -76,6 +77,9 @@ PixelPipeline::~PixelPipeline()
|
|||||||
delete m_texMapShader;
|
delete m_texMapShader;
|
||||||
delete m_renderShader;
|
delete m_renderShader;
|
||||||
delete m_map;
|
delete m_map;
|
||||||
|
delete m_skyboxShader;
|
||||||
|
delete m_skyTexBack;
|
||||||
|
delete m_skyTexFront;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelPipeline::updateChanges()
|
void PixelPipeline::updateChanges()
|
||||||
@ -116,18 +120,21 @@ void PixelPipeline::renderGL(Scene *scene)
|
|||||||
m_toreiller->draw(m_skyboxShader);
|
m_toreiller->draw(m_skyboxShader);
|
||||||
|
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
m_renderShader->bind();
|
if(m_showToreiller)
|
||||||
m_renderShader->bindVec3(m_renderShader->getLocation("camera"), m_camera);
|
{
|
||||||
m_renderShader->bindVec2(m_renderShader->getLocation("worldSize"), glm::vec2(m_mapWidth, m_mapHeight));
|
m_renderShader->bind();
|
||||||
m_renderShader->bindVec2(m_renderShader->getLocation("screenSize"), glm::vec2(m_width, m_height));
|
m_renderShader->bindVec3(m_renderShader->getLocation("camera"), m_camera);
|
||||||
m_renderShader->bindFloat(m_renderShader->getLocation("surfaceRatio"), m_surfaceRatio);
|
m_renderShader->bindVec2(m_renderShader->getLocation("worldSize"), glm::vec2(m_mapWidth, m_mapHeight));
|
||||||
m_renderShader->bindFloat(m_renderShader->getLocation("flatSphere"), m_flatSphere);
|
m_renderShader->bindVec2(m_renderShader->getLocation("screenSize"), glm::vec2(m_width, m_height));
|
||||||
m_mapTex->bind(0);
|
m_renderShader->bindFloat(m_renderShader->getLocation("surfaceRatio"), m_surfaceRatio);
|
||||||
m_renderShader->bindInteger(m_renderShader->getLocation("colorMap"), 0);
|
m_renderShader->bindFloat(m_renderShader->getLocation("flatSphere"), m_flatSphere);
|
||||||
|
m_mapTex->bind(0);
|
||||||
glm::mat4 mvp = m_proj * m_view;
|
m_renderShader->bindInteger(m_renderShader->getLocation("colorMap"), 0);
|
||||||
m_renderShader->bindMat4(m_renderShader->getLocation("mvp"), mvp);
|
|
||||||
m_toreiller->draw(m_renderShader);
|
glm::mat4 mvp = m_proj * m_view;
|
||||||
|
m_renderShader->bindMat4(m_renderShader->getLocation("mvp"), mvp);
|
||||||
|
m_toreiller->draw(m_renderShader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelPipeline::resizeGL(int w, int h)
|
void PixelPipeline::resizeGL(int w, int h)
|
||||||
|
@ -30,6 +30,7 @@ private:
|
|||||||
float m_surfaceRatio;
|
float m_surfaceRatio;
|
||||||
float m_flatSphere;
|
float m_flatSphere;
|
||||||
glm::vec3 m_camera;
|
glm::vec3 m_camera;
|
||||||
|
bool m_showToreiller;
|
||||||
|
|
||||||
Mesh *m_toreiller;
|
Mesh *m_toreiller;
|
||||||
glm::mat4 m_proj;
|
glm::mat4 m_proj;
|
||||||
@ -50,6 +51,7 @@ public:
|
|||||||
|
|
||||||
void setSurfaceRatio(float surfaceRatio) { m_surfaceRatio = surfaceRatio; }
|
void setSurfaceRatio(float surfaceRatio) { m_surfaceRatio = surfaceRatio; }
|
||||||
void setFlatSphere(float flatSphere) { m_flatSphere = flatSphere; }
|
void setFlatSphere(float flatSphere) { m_flatSphere = flatSphere; }
|
||||||
|
void setShowToreiller(bool showToreiller) { m_showToreiller = showToreiller; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PIXELPIPELINE_H
|
#endif // PIXELPIPELINE_H
|
||||||
|
@ -70,7 +70,7 @@ void SimulationDialog::refreshBehaviors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
emit sendError(QString("ERROR : can't open the teams folder.\n"), 5000);
|
emit sendError(QString("ERROR : can't open the teams folder.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulationDialog::refreshGenerators()
|
void SimulationDialog::refreshGenerators()
|
||||||
@ -100,7 +100,7 @@ void SimulationDialog::refreshGenerators()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
emit sendError(QString("ERROR : can't open the generators folder.\n"), 5000);
|
emit sendError(QString("ERROR : can't open the generators folder.\n"));
|
||||||
bool canGenerate = !m_genList.empty();
|
bool canGenerate = !m_genList.empty();
|
||||||
if(canGenerate)
|
if(canGenerate)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ private:
|
|||||||
void updatePreviewPixmap();
|
void updatePreviewPixmap();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendError(QString, int);
|
void sendError(QString);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIMULATIONDIALOG_H
|
#endif // SIMULATIONDIALOG_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user