PrimeWorldEditor/src/Editor/CSceneViewport.h

98 lines
2.5 KiB
C
Raw Normal View History

#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;
CRenderer *mpRenderer;
bool mRenderingMergedWorld;
// Scene interaction
bool mGizmoHovering;
bool mGizmoTransforming;
SRayIntersection mRayIntersection;
CSceneNode *mpHoverNode;
CVector3f mHoverPoint;
2016-01-05 14:54:16 +00:00
// Context Menu
QMenu *mpContextMenu;
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;
// Link Line
bool mLinkLineEnabled;
CVector3f mLinkLinePoints[2];
public:
CSceneViewport(QWidget *pParent = 0);
~CSceneViewport();
2016-01-06 10:19:06 +00:00
void SetScene(INodeEditor *pEditor, CScene *pScene);
void SetShowFlag(EShowFlag Flag, bool Visible);
void SetShowWorld(bool Visible);
void SetRenderMergedWorld(bool b);
FShowFlags ShowFlags() const;
CRenderer* Renderer();
CSceneNode* HoverNode();
CVector3f HoverPoint();
void CheckGizmoInput(const CRay& ray);
void SceneRayCast(const CRay& ray);
void ResetHover();
bool IsHoveringGizmo();
void keyPressEvent(QKeyEvent* pEvent);
void keyReleaseEvent(QKeyEvent* pEvent);
inline void SetLinkLineEnabled(bool Enable) { mLinkLineEnabled = Enable; }
inline void SetLinkLine(const CVector3f& rkPointA, const CVector3f& rkPointB)
{
mLinkLinePoints[0] = rkPointA;
mLinkLinePoints[1] = rkPointB;
}
2016-01-05 14:54:16 +00:00
protected:
void CreateContextMenu();
QMouseEvent CreateMouseEvent();
2016-01-05 14:54:16 +00:00
signals:
void InputProcessed(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
void ViewportClick(const SRayIntersection& rkIntersect, QMouseEvent *pEvent);
void GizmoMoved();
2015-11-27 21:18:22 +00:00
void CameraOrbit();
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
// 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();
};
#endif // CSCENEVIEWPORT_H