2014-09-18 15:38:37 +00:00
|
|
|
#ifndef MODELERCAMERAS_H
|
|
|
|
#define MODELERCAMERAS_H
|
|
|
|
|
|
|
|
#include "modeler_global.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
2015-09-21 21:12:43 +00:00
|
|
|
#include "DefinitionWatcher.h"
|
2014-09-18 15:38:37 +00:00
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace modeler {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Storage for modeler cameras.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class ModelerCameras : public QObject, public DefinitionWatcher {
|
2014-09-18 15:38:37 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
public:
|
2014-09-18 15:38:37 +00:00
|
|
|
ModelerCameras(MainModelerWindow *parent);
|
|
|
|
~ModelerCameras();
|
|
|
|
|
2014-09-26 15:46:39 +00:00
|
|
|
/**
|
|
|
|
* Process a zoom request.
|
|
|
|
*/
|
|
|
|
void processZoom(double value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process a scroll request.
|
|
|
|
*/
|
|
|
|
void processScroll(double xvalue, double yvalue);
|
|
|
|
|
2015-07-22 16:05:24 +00:00
|
|
|
/**
|
|
|
|
* Process a panning rotation.
|
|
|
|
*/
|
|
|
|
void processPanning(double xvalue, double yvalue);
|
|
|
|
|
2015-09-21 21:12:43 +00:00
|
|
|
/**
|
|
|
|
* Start a sun tool, the camera will follow the sun.
|
2015-12-30 19:14:16 +00:00
|
|
|
*
|
2016-01-06 18:55:49 +00:00
|
|
|
* 'duration' is the duration in milliseconds before calling endTool() automatically (0 to disable to wait for
|
2015-12-30 19:14:16 +00:00
|
|
|
*manual call).
|
2015-09-21 21:12:43 +00:00
|
|
|
*/
|
2015-12-30 19:14:16 +00:00
|
|
|
void startSunTool(unsigned long duration = 0);
|
2015-09-21 21:12:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* End the tool mode.
|
|
|
|
*/
|
|
|
|
void endTool();
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
protected:
|
2015-12-30 19:14:16 +00:00
|
|
|
virtual void timerEvent(QTimerEvent *event) override;
|
2014-09-18 15:38:37 +00:00
|
|
|
|
2015-09-21 21:12:43 +00:00
|
|
|
virtual void nodeChanged(const DefinitionNode *node, const DefinitionDiff *diff) override;
|
|
|
|
|
2015-07-22 16:05:24 +00:00
|
|
|
/**
|
|
|
|
* Validate current camera, pushing it to rendered scenery if needed.
|
|
|
|
*/
|
|
|
|
void validate();
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
public slots:
|
2014-09-18 15:38:37 +00:00
|
|
|
void changeActiveCamera(const QString &name);
|
2015-09-21 21:12:43 +00:00
|
|
|
void toolChanged(const QString &tool);
|
2014-09-18 15:38:37 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2014-09-18 15:38:37 +00:00
|
|
|
MainModelerWindow *parent;
|
|
|
|
CameraDefinition *active;
|
|
|
|
CameraDefinition *current;
|
|
|
|
CameraDefinition *render;
|
|
|
|
CameraDefinition *topdown;
|
2015-09-21 21:12:43 +00:00
|
|
|
CameraDefinition *tool;
|
2015-09-21 21:17:47 +00:00
|
|
|
CameraDefinition *previous;
|
2015-09-21 21:12:43 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
typedef enum { TOOL_NONE, TOOL_SUN } CameraToolMode;
|
2015-09-21 21:12:43 +00:00
|
|
|
CameraToolMode tool_mode;
|
2015-12-30 19:14:16 +00:00
|
|
|
unsigned long tool_auto_end;
|
2014-09-18 15:38:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MODELERCAMERAS_H
|