Files
Seele/src/Editor/Window/PlayView.cpp
T

62 lines
2.4 KiB
C++

#include "PlayView.h"
#include "Graphics/Enums.h"
#include "MinimalEngine.h"
#include "Window/Window.h"
#include <iostream>
using namespace Seele;
using namespace Seele::Editor;
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::filesystem::path dllPath)
: GameView(graphics, window, createInfo, dllPath) {}
PlayView::~PlayView() {}
void PlayView::beginUpdate() { GameView::beginUpdate(); }
void PlayView::update() { GameView::update(); }
void PlayView::commitUpdate() { GameView::commitUpdate(); }
void PlayView::prepareRender() { GameView::prepareRender(); }
void PlayView::render() { GameView::render(); }
void PlayView::keyCallback(KeyCode code, InputAction action, KeyModifierFlags modifier) {
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;
}
if(code == KeyCode::KEY_K && action == InputAction::RELEASE) {
getGlobals().useImagebasedLighting = !getGlobals().useImagebasedLighting;
std::cout << "Use IBL " << getGlobals().useImagebasedLighting << std::endl;
}
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;
}
});
std::cout << tra.getPosition() << std::endl;
std::cout << tra.getRotation() << std::endl;
}
if (code == KeyCode::KEY_R && action == InputAction::RELEASE) {
getGlobals().useRayTracing = !getGlobals().useRayTracing;
}
if (code == KeyCode::KEY_H && action == InputAction::RELEASE) {
MemoryManager::printAllocations();
}
}