1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-19 08:52:33 +02:00
openrw/rwviewer/ViewerWidget.hpp

73 lines
1.3 KiB
C++
Raw Normal View History

2014-02-10 13:41:05 +01:00
#pragma once
#ifndef _VIEWERWIDGET_HPP_
#define _VIEWERWIDGET_HPP_
2014-02-11 06:46:29 +01:00
#include <engine/GameData.hpp>
#include <engine/GameWorld.hpp>
2014-02-10 13:41:05 +01:00
#include <QGLWidget>
2014-02-10 18:22:07 +01:00
#include <QTimer>
2014-03-01 12:19:33 +01:00
#include <loaders/LoaderIFP.hpp>
2014-02-10 13:41:05 +01:00
2014-02-11 14:40:56 +01:00
class Model;
2014-02-10 13:41:05 +01:00
class ViewerWidget : public QGLWidget
{
2014-02-10 18:22:07 +01:00
Q_OBJECT
2014-02-11 06:46:29 +01:00
QString currentFile;
2014-02-10 18:22:07 +01:00
QTimer timer;
2014-02-11 06:46:29 +01:00
GameWorld* gworld;
2014-03-01 12:19:33 +01:00
GameObject* dummyObject;
2014-06-10 01:46:48 +02:00
quint16 currentObjectID;
2014-02-11 14:40:56 +01:00
2014-06-10 17:47:44 +02:00
Model* _lastModel;
2014-03-01 12:19:33 +01:00
Animation* canimation;
2014-02-11 14:40:56 +01:00
float viewDistance;
2014-02-11 16:45:45 +01:00
glm::vec2 viewAngles;
bool dragging;
QPointF dstart;
glm::vec2 dastart;
2014-02-10 13:41:05 +01:00
public:
2014-06-08 02:58:49 +02:00
2014-02-11 06:46:29 +01:00
ViewerWidget(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0);
2014-02-10 13:41:05 +01:00
virtual void initializeGL();
virtual void resizeGL(int w, int h);
virtual void paintGL();
2014-06-08 02:58:49 +02:00
2014-06-10 17:47:44 +02:00
Model *currentModel() const;
2014-02-12 07:42:07 +01:00
2014-06-08 02:58:49 +02:00
// TODO: Move this into the main window or elsewhere, doesn't really belong here.
void setGamePath(const std::string& path);
2014-02-11 06:46:29 +01:00
GameWorld* world();
2014-02-10 18:22:07 +01:00
public slots:
2014-06-08 02:58:49 +02:00
void showItem(qint16 item);
2014-02-11 06:46:29 +01:00
2014-03-01 12:19:33 +01:00
void showAnimation(Animation* anim);
2014-06-10 01:46:48 +02:00
void exportModel();
2014-02-11 06:46:29 +01:00
signals:
2014-06-08 02:58:49 +02:00
void dataLoaded(GameWorld* world);
2014-02-11 06:46:29 +01:00
void fileOpened(const QString& file);
2014-06-10 17:47:44 +02:00
void modelChanged(Model* model);
2014-02-11 16:45:45 +01:00
protected:
virtual void mousePressEvent(QMouseEvent*);
virtual void mouseReleaseEvent(QMouseEvent*);
virtual void mouseMoveEvent(QMouseEvent*);
virtual void wheelEvent(QWheelEvent*);
2014-02-10 13:41:05 +01:00
};
2014-03-01 12:19:33 +01:00
#endif