2023-02-24 22:09:07 +01:00
|
|
|
#include "PlayView.h"
|
2025-07-12 13:50:31 +02:00
|
|
|
#include "Graphics/Enums.h"
|
|
|
|
|
#include "MinimalEngine.h"
|
2025-01-29 21:55:11 +01:00
|
|
|
#include "Window/Window.h"
|
2026-04-12 20:49:02 +02:00
|
|
|
#include <iostream>
|
2023-02-24 22:09:07 +01:00
|
|
|
|
|
|
|
|
using namespace Seele;
|
|
|
|
|
using namespace Seele::Editor;
|
|
|
|
|
|
2025-04-11 13:49:37 +02:00
|
|
|
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath)
|
2024-06-09 12:20:04 +02:00
|
|
|
: GameView(graphics, window, createInfo, dllPath) {}
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
PlayView::~PlayView() {}
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void PlayView::beginUpdate() { GameView::beginUpdate(); }
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void PlayView::update() { GameView::update(); }
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void PlayView::commitUpdate() { GameView::commitUpdate(); }
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void PlayView::prepareRender() { GameView::prepareRender(); }
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void PlayView::render() { GameView::render(); }
|
2024-07-05 12:02:46 +02:00
|
|
|
|
2026-04-12 20:49:02 +02:00
|
|
|
void PlayView::keyCallback(KeyCode code, InputAction action, KeyModifierFlags modifier) {
|
2024-07-05 12:02:46 +02:00
|
|
|
GameView::keyCallback(code, action, modifier);
|
|
|
|
|
if (code == KeyCode::KEY_P && action == InputAction::RELEASE) {
|
|
|
|
|
getGlobals().usePositionOnly = !getGlobals().usePositionOnly;
|
|
|
|
|
std::cout << "Use Pos only " << getGlobals().usePositionOnly << std::endl;
|
|
|
|
|
}
|
|
|
|
|
if (code == KeyCode::KEY_O && action == InputAction::RELEASE) {
|
|
|
|
|
getGlobals().useDepthCulling = !getGlobals().useDepthCulling;
|
|
|
|
|
std::cout << "Use Depth Culling " << getGlobals().useDepthCulling << std::endl;
|
|
|
|
|
}
|
|
|
|
|
if (code == KeyCode::KEY_L && action == InputAction::RELEASE) {
|
|
|
|
|
getGlobals().useLightCulling = !getGlobals().useLightCulling;
|
|
|
|
|
std::cout << "Use Light Culling " << getGlobals().useLightCulling << std::endl;
|
|
|
|
|
}
|
2025-07-12 13:50:31 +02:00
|
|
|
if(code == KeyCode::KEY_K && action == InputAction::RELEASE) {
|
|
|
|
|
getGlobals().useImagebasedLighting = !getGlobals().useImagebasedLighting;
|
|
|
|
|
std::cout << "Use IBL " << getGlobals().useImagebasedLighting << std::endl;
|
|
|
|
|
}
|
2024-07-05 12:02:46 +02:00
|
|
|
if (code == KeyCode::KEY_G && action == InputAction::RELEASE) {
|
|
|
|
|
Component::Camera cam;
|
|
|
|
|
Component::Transform tra;
|
|
|
|
|
scene->view<Component::Camera, Component::Transform>([&cam, &tra](Component::Camera& c, Component::Transform& t) {
|
|
|
|
|
if (c.mainCamera) {
|
|
|
|
|
tra = t;
|
|
|
|
|
cam = c;
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-04-11 23:13:19 +02:00
|
|
|
std::cout << tra.getPosition() << std::endl;
|
2024-07-05 12:02:46 +02:00
|
|
|
std::cout << tra.getRotation() << std::endl;
|
|
|
|
|
}
|
2024-12-25 14:59:08 +01:00
|
|
|
if (code == KeyCode::KEY_R && action == InputAction::RELEASE) {
|
|
|
|
|
getGlobals().useRayTracing = !getGlobals().useRayTracing;
|
|
|
|
|
}
|
2025-03-20 20:15:38 +01:00
|
|
|
if (code == KeyCode::KEY_H && action == InputAction::RELEASE) {
|
|
|
|
|
MemoryManager::printAllocations();
|
|
|
|
|
}
|
2024-07-05 12:02:46 +02:00
|
|
|
}
|