Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
EngineWindow.h
1/*
2Copyright (C) 2016-2019,2021,2022,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGAMES_ENGINEWINDOW_H
17#define AEONGAMES_ENGINEWINDOW_H
18#include <QWindow>
19#include <QTimer>
20#include <QElapsedTimer>
21#include <QQuaternion>
22#include <QVector3D>
23#include <QVector4D>
24#include <QMatrix4x4>
25#include <QPoint>
26#include <QCloseEvent>
27
28#include "WorldEditor.h"
29#include "aeongames/AeonEngine.hpp"
30#include "aeongames/Scene.hpp"
31#include "aeongames/Node.hpp"
33
34namespace AeonGames
35{
36 class Renderer;
37 class Scene;
38 class Node;
39 class Window;
41 class EngineWindow : public QWindow
42 {
43 Q_OBJECT
44 public:
49 EngineWindow ( QWindow *parent = nullptr );
53 void stop();
55 void start();
60 void setScene ( const Scene* aScene );
65 void SetFieldOfView ( float aFieldOfView );
70 void SetNear ( float aNear );
75 void SetFar ( float aFar );
76 private:
77 const QVector3D right
78 {
79 1.0f, 0.0f, 0.0f
80 };
81 const QVector3D forward{ 0.0f, 1.0f, 0.0f };
82 void resizeEvent ( QResizeEvent *aResizeEvent ) final;
83 void exposeEvent ( QExposeEvent *aExposeEvent ) final;
84 void keyPressEvent ( QKeyEvent * event ) final;
85 void keyReleaseEvent ( QKeyEvent * event ) final;
86 void mouseMoveEvent ( QMouseEvent * event ) final;
87 void mousePressEvent ( QMouseEvent * event ) final;
88 void mouseReleaseEvent ( QMouseEvent * event ) final;
89 void wheelEvent ( QWheelEvent *event ) final;
90 bool event ( QEvent* aEvent ) final;
91 void updateViewMatrix();
92 void* mWinId{ nullptr };
93 const Scene* mScene{nullptr};
94 QPointF mLastCursorPosition;
95 QTimer mTimer;
96 QElapsedTimer mStopWatch;
97 float mFrustumVerticalHalfAngle;
98 float mAspectRatio{1.0f};
99 float mStep;
100 float mFieldOfView{};
101 float mNear{};
102 float mFar{};
103 bool mIsClosing{ false };
104 /* Settings Cache */
105 uint32_t mHorizontalSpacing{};
106 uint32_t mVerticalSpacing{};
107 /* We're using QT classes for now... */
108 QQuaternion mCameraRotation;
109 QVector3D mCameraLocation;
110 QMatrix4x4 mViewMatrix;
111 };
112}
113#endif
Header for 4x4 matrix class.
Header for the Scene class.
EngineWindow(QWindow *parent=nullptr)
Construct the engine window.
void SetNear(float aNear)
Set the near clipping plane distance.
void start()
Start the rendering loop.
void SetFieldOfView(float aFieldOfView)
Set the camera field of view.
void stop()
Stop the rendering loop.
void setScene(const Scene *aScene)
Set the scene to render.
void SetFar(float aFar)
Set the far clipping plane distance.
Scene graph node representing an entity in the game world.
Definition Node.hpp:54
Abstract base class for rendering backends.
Definition Renderer.hpp:44
Scene class. Scene is the container for all elements in a game level, takes care of collision,...
Definition Scene.hpp:40
<- This is here just for the literals
Definition AABB.hpp:31