Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Commit 4db39c1

Browse files
authored
Merge pull request #253 from TeamWisp/feature_splines
Feature splines
2 parents 0373eb4 + c4be3b9 commit 4db39c1

32 files changed

+5518
-95
lines changed

demo/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
file(GLOB SOURCES CONFIGURE_DEPENDS "*.cpp")
3-
file(GLOB HEADERS CONFIGURE_DEPENDS "*.hpp")
2+
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "*.cpp")
3+
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS "*.hpp")
44

55
add_executable(WispDemo WIN32 ${HEADERS} ${SOURCES})
66
target_include_directories(WispDemo PUBLIC ../src/)

demo/debug_camera.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class DebugCamera : public wr::CameraNode
1919
virtual void SetRotation(DirectX::XMVECTOR roll_pitch_yaw) override
2020
{
2121
m_rotation_radians = roll_pitch_yaw;
22+
m_use_quaternion = false;
2223
m_target_rotation_radians = roll_pitch_yaw;
2324
}
2425

@@ -39,7 +40,8 @@ class DebugCamera : public wr::CameraNode
3940
POINT cursor_pos;
4041
GetCursorPos(&cursor_pos);
4142

42-
if (m_rmb_down) {
43+
if (m_rmb_down)
44+
{
4345
// Translation
4446
m_right_axis = std::min(m_right_axis, 1.f);
4547
m_right_axis = std::max(m_right_axis, -1.f);
@@ -60,7 +62,7 @@ class DebugCamera : public wr::CameraNode
6062

6163
// Rotation
6264
DirectX::XMVECTOR new_rot{ cursor_pos.y - m_last_cursor_pos.y, cursor_pos.x - m_last_cursor_pos.x };
63-
m_target_rotation_radians = DirectX::XMVectorSubtract(m_target_rotation_radians, DirectX::XMVectorScale(new_rot, m_sensitivity));
65+
SetRotation(DirectX::XMVectorSubtract(m_target_rotation_radians, DirectX::XMVectorScale(new_rot, m_sensitivity)));
6466
}
6567
else
6668
{
@@ -70,7 +72,7 @@ class DebugCamera : public wr::CameraNode
7072
}
7173

7274
m_position = DirectX::XMVectorLerp(m_position, m_target_position, delta * m_position_lerp_speed);
73-
m_rotation_radians = DirectX::XMVectorLerp(m_rotation_radians, m_target_rotation_radians, delta * m_rotation_lerp_speed);
75+
SetRotation(DirectX::XMVectorLerp(m_rotation_radians, m_target_rotation_radians, delta * m_rotation_lerp_speed));
7476
SignalTransformChange();
7577

7678
m_last_cursor_pos = cursor_pos;

demo/scene_viknell.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "scene_graph/scene_graph.hpp"
77
#include "imgui/imgui.hpp"
88
#include "debug_camera.hpp"
9+
#include "spline_node.hpp"
910

1011
namespace viknell_scene
1112
{
@@ -82,6 +83,7 @@ namespace viknell_scene
8283

8384

8485
static std::shared_ptr<DebugCamera> camera;
86+
static std::shared_ptr<SplineNode> camera_spline_node;
8587
static std::shared_ptr<wr::LightNode> directional_light_node;
8688
static std::shared_ptr<wr::MeshNode> test_model;
8789
static float t = 0;
@@ -92,6 +94,8 @@ namespace viknell_scene
9294
camera->SetPosition({0, 0, 2});
9395
camera->SetSpeed(10);
9496

97+
camera_spline_node = scene_graph->CreateChild<SplineNode>(nullptr, "Camera Spline", false);
98+
9599
scene_graph->m_skybox = resources::equirectangular_environment_map;
96100
auto skybox = scene_graph->CreateChild<wr::SkyboxNode>(nullptr, resources::equirectangular_environment_map);
97101

@@ -125,10 +129,8 @@ namespace viknell_scene
125129
test_model->SetRotation({0, 180_deg, 0});
126130
test_model->SetScale({0.01f,0.01f,0.01f});
127131

128-
129132
// Lights
130-
auto point_light_0 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::DIRECTIONAL, DirectX::XMVECTOR{1, 1, 1});
131-
//point_light_0->SetRadius(3.0f);
133+
auto point_light_0 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::DIRECTIONAL, DirectX::XMVECTOR{ 1, 1, 1 });
132134
point_light_0->SetRotation({20.950, 0.98, 0});
133135
point_light_0->SetPosition({-0.002, 0.080, 1.404});
134136

@@ -152,5 +154,6 @@ namespace viknell_scene
152154
//test_model->SetPosition(pos);
153155

154156
camera->Update(ImGui::GetIO().DeltaTime);
157+
camera_spline_node->UpdateSplineNode(ImGui::GetIO().DeltaTime, camera);
155158
}
156159
} /* cube_scene */

0 commit comments

Comments
 (0)