PlaneCameraController class & using it in MovingCubeApp example if USE_PLANE_CAM_CONTROL is nonzero
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "Scene/SimpleAnimationController.hpp"
|
||||
#include "Scene/SequenceAnimationController.hpp"
|
||||
#include "Scene/MorphableCameraController.hpp"
|
||||
#include "Scene/PlaneCameraController.hpp"
|
||||
#include "Scene/UI/PerformanceInfo.hpp"
|
||||
#include "Input/InputManager.hpp"
|
||||
#include "Host/GraphicsAppManager.hpp"
|
||||
@@ -24,6 +25,8 @@
|
||||
#include "Base/Logger.hpp"
|
||||
#include "Controller/FreeCamCameraController.hpp"
|
||||
|
||||
#define USE_PLANE_CAM_CONTROL 0
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
namespace
|
||||
@@ -34,13 +37,18 @@ namespace OpenVulkano
|
||||
Scene::SimpleDrawable m_drawable;
|
||||
Scene::Node m_node;
|
||||
};
|
||||
const Math::Vector3f PLANE_NORMAL(1, 0, 0);
|
||||
}
|
||||
class MovingCubeAppImpl final : public MovingCubeApp
|
||||
{
|
||||
Scene::Scene m_scene;
|
||||
Scene::MorphableCamera m_camera;
|
||||
Scene::MorphableCameraController m_morphableCameraControl;
|
||||
#if USE_PLANE_CAM_CONTROL
|
||||
Scene::PlaneCameraController m_cameraControl;
|
||||
#else
|
||||
FreeCamCameraController m_cameraControl;
|
||||
#endif
|
||||
Scene::Material m_material;
|
||||
Scene::Shader m_shader;
|
||||
|
||||
@@ -117,7 +125,11 @@ namespace OpenVulkano
|
||||
MovingCubeAppImpl() : m_camera(90, 16, 9, 0.1, 1000)
|
||||
{
|
||||
m_morphableCameraControl.Init(&m_camera);
|
||||
#if USE_PLANE_CAM_CONTROL
|
||||
m_cameraControl.Init(&m_camera, PLANE_NORMAL);
|
||||
#else
|
||||
m_cameraControl.Init(&m_camera);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Init() override
|
||||
@@ -133,7 +145,11 @@ namespace OpenVulkano
|
||||
m_shader.AddVertexInputDescription(Vertex::GetVertexInputDescription());
|
||||
|
||||
GetGraphicsAppManager()->GetRenderer()->SetScene(&m_scene);
|
||||
#if USE_PLANE_CAM_CONTROL
|
||||
m_cameraControl.Init(&m_camera, PLANE_NORMAL);
|
||||
#else
|
||||
m_cameraControl.Init(&m_camera);
|
||||
#endif
|
||||
m_cameraControl.SetDefaultKeybindings();
|
||||
|
||||
CreateSceneElement(&m_whiteBox, Math::Vector4f(1, 1, 1, 1), 1);
|
||||
|
||||
Reference in New Issue
Block a user