2015-07-26 21:39:49 +00:00
|
|
|
#ifndef CWORLDEDITOR_H
|
|
|
|
#define CWORLDEDITOR_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QList>
|
|
|
|
|
2015-08-16 04:29:37 +00:00
|
|
|
#include "CGizmo.h"
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <Common/CRay.h>
|
|
|
|
#include <Common/CTimer.h>
|
|
|
|
#include <Common/EKeyInputs.h>
|
|
|
|
#include <Common/SRayIntersection.h>
|
2015-08-20 01:01:58 +00:00
|
|
|
#include <Common/ETransformSpace.h>
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <Core/CRenderer.h>
|
|
|
|
#include <Core/CSceneManager.h>
|
|
|
|
#include <Core/CToken.h>
|
|
|
|
#include <Resource/CGameArea.h>
|
|
|
|
#include <Resource/CWorld.h>
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class CWorldEditor;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CWorldEditor : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
CRenderer *mpRenderer;
|
|
|
|
CSceneManager *mpSceneManager;
|
2015-08-16 04:29:37 +00:00
|
|
|
CGizmo mGizmo;
|
2015-08-20 01:01:58 +00:00
|
|
|
ETransformSpace mTransformSpace;
|
2015-07-26 21:39:49 +00:00
|
|
|
CCamera mCamera;
|
|
|
|
CGameArea *mpArea;
|
|
|
|
CWorld *mpWorld;
|
|
|
|
CToken mAreaToken;
|
|
|
|
CToken mWorldToken;
|
|
|
|
CTimer mFrameTimer;
|
|
|
|
bool mDrawSky;
|
2015-08-16 04:29:37 +00:00
|
|
|
bool mShowGizmo;
|
2015-08-17 18:10:42 +00:00
|
|
|
bool mGizmoHovering;
|
2015-08-20 01:01:58 +00:00
|
|
|
bool mGizmoTransforming;
|
2015-08-24 01:02:14 +00:00
|
|
|
bool mGizmoUIOutdated;
|
2015-07-26 21:39:49 +00:00
|
|
|
|
|
|
|
CVector3f mHoverPoint;
|
|
|
|
CSceneNode *mpHoverNode;
|
|
|
|
std::list<CSceneNode*> mSelectedNodes;
|
|
|
|
CAABox mSelectionAABox;
|
|
|
|
|
|
|
|
CTimer mFPSTimer;
|
|
|
|
int mFrameCount;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit CWorldEditor(QWidget *parent = 0);
|
|
|
|
~CWorldEditor();
|
|
|
|
bool eventFilter(QObject *pObj, QEvent *pEvent);
|
|
|
|
void SetArea(CWorld *pWorld, CGameArea *pArea);
|
2015-08-24 01:02:14 +00:00
|
|
|
void ViewportRayCast();
|
2015-07-26 21:39:49 +00:00
|
|
|
CRenderer* Renderer();
|
|
|
|
CSceneManager* Scene();
|
|
|
|
CGameArea* ActiveArea();
|
|
|
|
|
|
|
|
// Selection
|
|
|
|
void SelectNode(CSceneNode *pNode);
|
|
|
|
void DeselectNode(CSceneNode *pNode);
|
|
|
|
void ClearSelection();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void ViewportPreRender();
|
|
|
|
void ViewportRender(CCamera& Camera);
|
|
|
|
void ViewportPostRender();
|
|
|
|
void ViewportMouseDrag(QMouseEvent *pEvent);
|
|
|
|
void ViewportMouseClick(QMouseEvent *pEvent);
|
2015-08-20 01:01:58 +00:00
|
|
|
void ViewportMouseRelease(QMouseEvent *pEvent);
|
2015-07-26 21:39:49 +00:00
|
|
|
void SetViewportSize(int Width, int Height);
|
2015-08-20 01:01:58 +00:00
|
|
|
void SetTransformSpace(int space);
|
2015-07-26 21:39:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::CWorldEditor *ui;
|
|
|
|
void RecalculateSelectionBounds();
|
|
|
|
void ResetHover();
|
|
|
|
void UpdateCursor();
|
|
|
|
|
|
|
|
// UI
|
|
|
|
void OnSidebarResize();
|
|
|
|
void UpdateSelectionUI();
|
|
|
|
void UpdateStatusBar();
|
2015-08-24 01:02:14 +00:00
|
|
|
void UpdateGizmoUI();
|
2015-07-26 21:39:49 +00:00
|
|
|
|
|
|
|
private slots:
|
2015-07-29 13:51:59 +00:00
|
|
|
void OnCameraSpeedChange(double speed);
|
2015-07-26 21:39:49 +00:00
|
|
|
void on_ActionDrawWorld_triggered();
|
|
|
|
void on_ActionDrawCollision_triggered();
|
|
|
|
void on_ActionDrawObjects_triggered();
|
|
|
|
void on_ActionDrawLights_triggered();
|
|
|
|
void on_ActionDrawSky_triggered();
|
|
|
|
void on_ActionNoLighting_triggered();
|
|
|
|
void on_ActionBasicLighting_triggered();
|
|
|
|
void on_ActionWorldLighting_triggered();
|
|
|
|
void on_ActionNoBloom_triggered();
|
|
|
|
void on_ActionBloomMaps_triggered();
|
2015-07-28 16:22:08 +00:00
|
|
|
void on_ActionFakeBloom_triggered();
|
2015-07-26 21:39:49 +00:00
|
|
|
void on_ActionBloom_triggered();
|
|
|
|
void on_ActionZoomOnSelection_triggered();
|
|
|
|
void on_ActionDisableBackfaceCull_triggered();
|
|
|
|
void on_ActionDisableAlpha_triggered();
|
|
|
|
void on_ActionEditLayers_triggered();
|
2015-08-16 04:29:37 +00:00
|
|
|
void on_ActionSelectObjects_triggered();
|
|
|
|
void on_ActionTranslate_triggered();
|
|
|
|
void on_ActionRotate_triggered();
|
|
|
|
void on_ActionScale_triggered();
|
|
|
|
void on_ActionIncrementGizmo_triggered();
|
|
|
|
void on_ActionDecrementGizmo_triggered();
|
2015-07-26 21:39:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CWORLDEDITOR_H
|