SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
MapViewerApp.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
10 #include "Lutefisk3D/Engine/Application.h"
11 #include <unordered_map>
12 #include <memory>
13 #include <QObject>
14 
15 class SideWindow; // Qt side window
16 
17 namespace Urho3D
18 {
19  class Node;
20  class Scene;
21  class StaticModel;
22  class Vector3;
23  class Drawable;
24 }
25 
26 
29 
30 class MapViewerApp : public QObject, public Urho3D::Application
31 {
32  Q_OBJECT
33 public:
34  MapViewerApp(Urho3D::Context *ctx);
35  ~MapViewerApp() override;
36  // Application interface
37 public:
38  void Setup() override;
39  void Start() override;
40 public slots:
41  void loadSelectedSceneGraph(const QString &path);
42  void onDisplayNode(SEGS::SceneNode *n, bool rootnode);
43  void onDisplayRef(SEGS::RootNode *root, bool show_all);
44  void onNodeSelected(SEGS::SceneNode *n);
45 signals:
46  void cameraLocationChanged(float x,float y,float z);
47  void nodeSelected(SEGS::SceneNode *def,Urho3D::Node *n);
48  void modelSelected(SEGS::SceneNode *def,SEGS::Model *model,Urho3D::Drawable*m);
49  void scenegraphLoaded(const SEGS::SceneGraph &);
50 private:
51  void CreateBaseScene();
52  void SetupViewport();
53  void CreateConsoleAndDebugHud();
54  void prepareSideWindow();
55  void prepareCursor();
56  bool Raycast(float maxDistance);
57  void HandlePostRenderUpdate(float ts);
58  void HandleKeyUp(int key, int scancode, unsigned buttons, int qualifiers);
59  void HandleKeyDown(int key, int scancode, unsigned buttons, int qualifiers, bool repeat);
60  void HandleUpdate(float ts);
61 
62  Urho3D::SharedPtr<Urho3D::Node> m_camera_node;
63  Urho3D::SharedPtr<Urho3D::Node> m_currently_shown_node;
64  SEGS::SceneNode *m_current_selected_node=nullptr;
65  Urho3D::SharedPtr<Urho3D::Scene> m_scene;
66  // Camera params
67  float yaw_=0;
68  float pitch_=0;
69  // conversion results
70  std::unique_ptr<SEGS::SceneGraph> m_coh_scene;
71  std::unordered_map<void *,Urho3D::Node *> m_converted_nodes;
72  // UI helper variables
73  SideWindow *m_sidewindow=nullptr;
74  Urho3D::Drawable *m_selected_drawable=nullptr;
75 };
Definition: CohModelConverter.h:20
Definition: Model.h:88
Definition: MapViewerApp.h:30
Definition: SideWindow.h:38
Definition: SceneGraph.h:42
Definition: SceneGraph.h:88
Definition: SceneGraph.h:95