Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
EditorCamera.hpp
1#pragma once
2
3#include <glm/glm.hpp>
4#include <glm/gtc/quaternion.hpp>
5
6#include "GridRenderer.hpp"
7#include "GizmoRenderer.hpp"
8
9namespace Grindstone {
10 class BaseRenderer;
11 struct TransformComponent;
12 struct CameraComponent;
13
14 namespace GraphicsAPI {
15 class Framebuffer;
16 class Image;
17 class Sampler;
18 class CommandBuffer;
19 class DescriptorSet;
21 class RenderPass;
22 }
23
24 namespace Editor {
25 class EditorCamera {
26 public:
27 EditorCamera();
28 ~EditorCamera();
29 uint64_t GetRenderOutput();
30 void Render(GraphicsAPI::CommandBuffer* commandBuffer);
31 void RenderPlayModeCamera(GraphicsAPI::CommandBuffer* commandBuffer);
32 void OffsetRotation(float pitch, float yaw);
33 void OffsetPosition(float x, float y, float z);
34 void ResizeViewport(uint32_t width, uint32_t height);
35 void UpdateProjectionMatrix();
36 void UpdateViewMatrix();
37 glm::mat4& GetProjectionMatrix();
38 glm::mat4& GetViewMatrix();
39 BaseRenderer* GetRenderer() const;
40
41 bool isGridEnabled = true;
42 bool isBoundingSphereGizmoEnabled = false;
43 bool isBoundingBoxGizmoEnabled = false;
44 bool isColliderGizmoEnabled = true;
45 private:
46 glm::vec3 GetForward() const;
47 glm::vec3 GetRight() const;
48 glm::vec3 GetUp() const;
49
50 GizmoRenderer gizmoRenderer;
51 GridRenderer gridRenderer;
52 GraphicsAPI::Image* renderTarget = nullptr;
53 GraphicsAPI::Image* depthTarget = nullptr;
54 GraphicsAPI::Sampler* sampler = nullptr;
55 GraphicsAPI::RenderPass* renderPass = nullptr;
56 GraphicsAPI::RenderPass* gizmoRenderPass = nullptr;
57 GraphicsAPI::DescriptorSetLayout* descriptorSetLayout = nullptr;
58 GraphicsAPI::Framebuffer* framebuffer = nullptr;
59 GraphicsAPI::DescriptorSet* descriptorSet = nullptr;
60 BaseRenderer* renderer = nullptr;
61 glm::mat4 projection;
62 glm::mat4 view;
63 glm::vec3 position = glm::vec3();
64 glm::vec3 eulerAngles = glm::vec3();
65 glm::quat rotation = glm::quat();
66 uint32_t width = 800;
67 uint32_t height = 600;
68 float fieldOfView = glm::radians(80.0f);
69 float nearPlaneDistance = 0.1f;
70 float farPlaneDistance = 150.f;
71 };
72 }
73}
Definition BaseRenderer.hpp:17
Definition CameraComponent.cs:2
Definition GizmoRenderer.hpp:21
Definition GridRenderer.hpp:20
Definition CommandBuffer.hpp:59
Definition DescriptorSetLayout.hpp:13
Definition DescriptorSet.hpp:15
Definition Framebuffer.hpp:16
Definition Image.hpp:48
Definition RenderPass.hpp:27
Definition Sampler.hpp:31
Definition TransformComponent.cs:7