1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-23 19:02:39 +01:00
openrw/rwviewer/ViewerWidget.hpp
2014-12-11 18:09:41 +00:00

76 lines
1.4 KiB
C++

#pragma once
#ifndef _VIEWERWIDGET_HPP_
#define _VIEWERWIDGET_HPP_
#include <engine/GameData.hpp>
#include <engine/GameWorld.hpp>
#include <QGLWidget>
#include <QTimer>
#include <loaders/LoaderIFP.hpp>
#include <render/DrawBuffer.hpp>
#include <render/GeometryBuffer.hpp>
#include <glm/glm.hpp>
class Model;
class ViewerWidget : public QGLWidget
{
Q_OBJECT
QString currentFile;
QTimer timer;
GameWorld* gworld;
GameObject* dummyObject;
quint16 currentObjectID;
Model* _lastModel;
Animation* canimation;
float viewDistance;
glm::vec2 viewAngles;
bool dragging;
QPointF dstart;
glm::vec2 dastart;
DrawBuffer* _frameWidgetDraw;
GeometryBuffer* _frameWidgetGeom;
void drawFrameWidget(ModelFrame* f, const glm::mat4& = {});
public:
ViewerWidget(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0);
virtual void initializeGL();
virtual void resizeGL(int w, int h);
virtual void paintGL();
Model *currentModel() const;
GameWorld* world();
public slots:
void showItem(qint16 item);
void exportModel();
void dataLoaded(GameWorld* world);
signals:
void fileOpened(const QString& file);
void modelChanged(Model* model);
protected:
virtual void mousePressEvent(QMouseEvent*);
virtual void mouseReleaseEvent(QMouseEvent*);
virtual void mouseMoveEvent(QMouseEvent*);
virtual void wheelEvent(QWheelEvent*);
};
#endif