rework API
This commit is contained in:
@@ -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 {}
|
||||
|
||||
@@ -19,8 +19,6 @@ using namespace OpenVulkano;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GraphicsAppManager manager;
|
||||
|
||||
std::vector<std::string> examples;
|
||||
for (const auto& e : EXAMPLE_APPS)
|
||||
{
|
||||
@@ -38,7 +36,8 @@ int main(int argc, char** argv)
|
||||
if (selectedExample >= examples.size()) throw std::runtime_error("Invalid menu selection!");
|
||||
|
||||
std::unique_ptr<IGraphicsApp> app( EXAMPLE_APPS[selectedExample].second() );
|
||||
manager.SetApp(app.get());
|
||||
|
||||
GraphicsAppManager manager(app.get());
|
||||
manager.Run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user