rework API

This commit is contained in:
ohyzha
2024-11-06 09:48:53 +02:00
parent e2df88ca22
commit 3521ddeb1d
21 changed files with 296 additions and 230 deletions

View File

@@ -19,11 +19,15 @@
#include "Scene/MorphableCameraController.hpp"
#include "Scene/PlaneCameraController.hpp"
#include "Scene/UI/PerformanceInfo.hpp"
#include "Scene/SceneIntersectionTestController.hpp"
#include "Input/InputManager.hpp"
#include "Host/GraphicsAppManager.hpp"
#include "Base/EngineConfiguration.hpp"
#include "Base/Logger.hpp"
#include "Controller/FreeCamCameraController.hpp"
#include "Scene/Prefabs/LabelDrawable.hpp"
#include "Scene/SimpleDrawable.hpp"
#include "Scene/Ray.hpp"
#define USE_PLANE_CAM_CONTROL 0
@@ -54,6 +58,7 @@ namespace OpenVulkano
Scene::SimpleAnimationController m_simpleAnimationController;
Scene::SequenceAnimationController m_sequenceAnimationController;
Scene::SceneIntersectionTestController intersectionTestController;
Scene::UI::SimpleUi m_ui;
std::shared_ptr<Scene::UI::PerformanceInfo> m_perfInfo;
@@ -154,6 +159,10 @@ namespace OpenVulkano
m_shader.AddShaderProgram(ShaderProgramType::FRAGMENT, "Shader/basic");
m_shader.AddVertexInputDescription(Vertex::GetVertexInputDescription());
intersectionTestController.OnHit += EventHandler(this, &MovingCubeAppImpl::OnRayHit);
intersectionTestController.SetCamera(&m_camera);
intersectionTestController.SetDefaultKeybindings();
GetGraphicsAppManager()->GetRenderer()->SetScene(&m_scene);
#if USE_PLANE_CAM_CONTROL
m_cameraControl.Init(&m_camera, PLANE_NORMAL);
@@ -219,12 +228,23 @@ namespace OpenVulkano
anim->Reset();
}
void OnRayHit(const Scene::DrawableRayHit &hit)
{
using namespace Scene;
Drawable *d = hit.drawable;
if (SimpleDrawable *sd = dynamic_cast<SimpleDrawable *>(d))
{
Logger::APP->info("Ray intersects object {}", sd->GetMesh()->name);
}
}
void Tick() override
{
m_cameraControl.Tick();
m_morphableCameraControl.Tick();
m_simpleAnimationController.Tick();
m_sequenceAnimationController.Tick();
intersectionTestController.Tick();
}
void Close() override {}