feat: move editor to project / add post processing etc

This commit is contained in:
2026-10-23 20:54:12 +02:00
parent f7e7c56392
commit a3d3da4a67
104 changed files with 11750 additions and 2675 deletions
+14 -61
View File
@@ -1,83 +1,36 @@
#ifndef LIGHTKEEPER_H
#define LIGHTKEEPER_H
#include <optional>
#include <string>
#include <memory>
#include <string_view>
#include <destrum/App.h>
#include <destrum/Scene/SceneManager.h>
#include <destrum/Graphics/RenderResources.h>
#include <destrum/Util/RectGizmo.h>
#include <destrum/Util/TransformGizmo.h>
#include <destrum/Graphics/Camera.h>
#include <destrum/Graphics/Resources/Cubemap.h>
#include "destrum/Graphics/Resources/Cubemap.h"
#include "destrum/ObjectModel/GameObject.h"
#include <scenes/MainScene.h>
class CameraComponent;
class FirstPersonController;
class LightKeeper final : public App {
public:
LightKeeper();
virtual ~LightKeeper();
static constexpr std::string_view MainScenePath = "game://scenes/main.scene";
void customInit() override;
void customUpdate(float dt) override;
void customDraw() override;
void customCleanup() override;
void customFixedUpdate(float dt) override;
void onViewportResize(int newWidth, int newHeight) override;
void drawViewportOverlay() override;
void onViewportAssetDropped(std::string_view path) override;
void customWindowsMenu() override;
void onPlayModeChanged(bool nowPlaying) override;
void onPlayModeChanged(bool playing) override;
[[nodiscard]] Camera* gameCamera() override;
private:
void setupSkybox();
void updateViewMode();
void focusSelection();
void updateFocus(float dt);
[[nodiscard]] CameraComponent* getSceneCamera() const;
[[nodiscard]] Camera& getViewCamera();
[[nodiscard]] bool isPlayerViewActive() const;
// LightkeeperDebugUi.cpp
void updateDebugUi();
void drawDebugMenuBar();
void drawWindowMenu();
void findPlayer();
void drawTestWindow();
void spawnBall();
void saveCurrentScene();
void loadScene();
void createEmptyScene();
void saveSelectedPrefab();
void instantiatePrefab();
void findPlayer();
void submitDebugDraws();
void submitColliderDebugLines();
Camera camera{glm::vec3(0.f, 0.f, -5.f), glm::vec3(0, 1, 0)};
std::optional<Camera> editorCamera;
std::optional<glm::vec3> focusTarget;
std::unique_ptr<CubeMap> skyboxCubemap;
MainSceneObjects mainScene{};
ImageID debug2DTexture{NULL_IMAGE_ID};
TransformGizmo transformGizmo;
RectGizmo rectGizmo;
char scenePath[512]{"scenes/debug_scene.json"};
char newSceneName[128]{"EmptyScene"};
char prefabPath[512]{"prefabs/selected.prefab"};
std::string sceneStatus;
bool renderColliders{false};
bool render2DShapes{true};
bool renderDebugLines{true};
bool showTransformGizmo{true};
bool showTestWindow{true};
bool useFreeCamera{false};
Camera playerCamera{glm::vec3{0.0f}, glm::vec3{0.0f, 1.0f, 0.0f}};
FirstPersonController* playerController{nullptr};
bool showTestWindow{false};
};
#endif //LIGHTKEEPER_H
#endif // LIGHTKEEPER_H
-25
View File
@@ -1,25 +0,0 @@
#ifndef LIGHTKEEPER_MAINSCENE_H
#define LIGHTKEEPER_MAINSCENE_H
#include <destrum/Graphics/ids.h>
class FirstPersonController;
class GameObject;
class GfxDevice;
class RenderResources;
class Scene;
// What the app keeps a hold of after building the scene
struct MainSceneObjects {
GameObject* player{nullptr};
FirstPersonController* playerController{nullptr};
// Used by the debug "Spawn ball" button
MeshID sphereMesh{};
MaterialID sphereMaterial{};
};
// Sun, ground, parkour course, models, trigger zone, the player and the HUD
MainSceneObjects BuildMainScene(Scene& scene, GfxDevice& gfxDevice, RenderResources& resources);
#endif // LIGHTKEEPER_MAINSCENE_H