2015-09-01 17:05:48 +00:00
|
|
|
#ifndef CSCENEVIEWPORT_H
|
|
|
|
#define CSCENEVIEWPORT_H
|
|
|
|
|
|
|
|
#include "CBasicViewport.h"
|
|
|
|
#include "INodeEditor.h"
|
|
|
|
|
|
|
|
class CSceneViewport : public CBasicViewport
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
INodeEditor *mpEditor;
|
2016-01-06 10:19:06 +00:00
|
|
|
CScene *mpScene;
|
2015-09-01 17:05:48 +00:00
|
|
|
CRenderer *mpRenderer;
|
2016-01-15 23:36:58 +00:00
|
|
|
bool mRenderingMergedWorld;
|
2015-09-01 17:05:48 +00:00
|
|
|
|
|
|
|
// Scene interaction
|
|
|
|
bool mGizmoHovering;
|
|
|
|
bool mGizmoTransforming;
|
|
|
|
CSceneNode *mpHoverNode;
|
|
|
|
CVector3f mHoverPoint;
|
|
|
|
|
2016-01-05 14:54:16 +00:00
|
|
|
// Context Menu
|
|
|
|
QMenu *mpContextMenu;
|
2016-01-09 23:52:01 +00:00
|
|
|
QAction *mpToggleSelectAction;
|
|
|
|
QAction *mpHideSelectionSeparator;
|
|
|
|
QAction *mpHideSelectionAction;
|
|
|
|
QAction *mpHideUnselectedAction;
|
|
|
|
QAction *mpHideHoverSeparator;
|
|
|
|
QAction *mpHideHoverNodeAction;
|
|
|
|
QAction *mpHideHoverTypeAction;
|
|
|
|
QAction *mpHideHoverLayerAction;
|
|
|
|
QAction *mpUnhideSeparator;
|
2016-01-05 14:54:16 +00:00
|
|
|
QAction *mpUnhideAllAction;
|
|
|
|
CSceneNode *mpMenuNode;
|
|
|
|
|
2015-09-01 17:05:48 +00:00
|
|
|
public:
|
|
|
|
CSceneViewport(QWidget *pParent = 0);
|
|
|
|
~CSceneViewport();
|
2016-01-06 10:19:06 +00:00
|
|
|
void SetScene(INodeEditor *pEditor, CScene *pScene);
|
2016-01-06 10:42:07 +00:00
|
|
|
void SetShowFlag(EShowFlag Flag, bool Visible);
|
2016-01-15 23:36:58 +00:00
|
|
|
void SetShowWorld(bool Visible);
|
|
|
|
void SetRenderMergedWorld(bool b);
|
2016-01-09 16:39:43 +00:00
|
|
|
FShowFlags ShowFlags() const;
|
2015-09-01 17:05:48 +00:00
|
|
|
CRenderer* Renderer();
|
|
|
|
CSceneNode* HoverNode();
|
|
|
|
CVector3f HoverPoint();
|
|
|
|
void CheckGizmoInput(const CRay& ray);
|
|
|
|
void SceneRayCast(const CRay& ray);
|
|
|
|
void ResetHover();
|
|
|
|
bool IsHoveringGizmo();
|
|
|
|
|
2015-11-26 07:47:02 +00:00
|
|
|
void keyPressEvent(QKeyEvent* pEvent);
|
|
|
|
void keyReleaseEvent(QKeyEvent* pEvent);
|
|
|
|
|
2016-01-05 14:54:16 +00:00
|
|
|
protected:
|
|
|
|
void CreateContextMenu();
|
|
|
|
|
2015-09-01 17:05:48 +00:00
|
|
|
signals:
|
2016-01-16 08:13:27 +00:00
|
|
|
void ViewportClick(CSceneNode *pNode, QMouseEvent *pEvent);
|
2015-09-01 17:05:48 +00:00
|
|
|
void GizmoMoved();
|
2015-11-27 21:18:22 +00:00
|
|
|
void CameraOrbit();
|
2015-09-01 17:05:48 +00:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void CheckUserInput();
|
|
|
|
void Paint();
|
|
|
|
void ContextMenu(QContextMenuEvent *pEvent);
|
|
|
|
void OnResize();
|
|
|
|
void OnMouseClick(QMouseEvent *pEvent);
|
|
|
|
void OnMouseRelease(QMouseEvent *pEvent);
|
2016-01-05 14:54:16 +00:00
|
|
|
|
2016-01-09 23:52:01 +00:00
|
|
|
// Menu Actions
|
|
|
|
void OnToggleSelect();
|
|
|
|
void OnHideSelection();
|
|
|
|
void OnHideUnselected();
|
2016-01-05 14:54:16 +00:00
|
|
|
void OnHideNode();
|
|
|
|
void OnHideType();
|
|
|
|
void OnHideLayer();
|
|
|
|
void OnUnhideAll();
|
|
|
|
void OnContextMenuClose();
|
2015-09-01 17:05:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CSCENEVIEWPORT_H
|