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

Commit b3b2463

Browse files
committed
Cleanup
1 parent ae0c363 commit b3b2463

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

demo/debug_camera.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +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_quat = false;
22+
m_use_quaternion = false;
2323
m_target_rotation_radians = roll_pitch_yaw;
2424
}
2525

@@ -40,7 +40,8 @@ class DebugCamera : public wr::CameraNode
4040
POINT cursor_pos;
4141
GetCursorPos(&cursor_pos);
4242

43-
if (m_rmb_down) {
43+
if (m_rmb_down)
44+
{
4445
// Translation
4546
m_right_axis = std::min(m_right_axis, 1.f);
4647
m_right_axis = std::max(m_right_axis, -1.f);

demo/spline_node.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,28 +140,11 @@ void SplineNode::UpdateSplineNode(float delta, std::shared_ptr<wr::Node> node)
140140
m_time += delta * m_speed;
141141
m_time = std::fmod(m_time, spline->getMaxT());
142142

143-
auto lerp_delta = m_time / spline->getMaxT();
144-
145-
auto mod = m_looping ? 0.f : 1.f;
146-
auto segment_i = lerp_delta * ((float)num_points - mod);
147-
auto alpha = (lerp_delta * ((float)num_points - mod)) - floor(segment_i);
148-
149-
float backback = std::fmod((std::fmod(floor(segment_i), num_points) + num_points), num_points);
150-
auto back_point = m_control_points[backback];
151-
auto prev_point = m_control_points[floor(segment_i)];
152-
auto next_point = m_control_points[fmod(ceil(segment_i), num_points)];
153-
auto end_point = m_control_points[fmod(ceil(segment_i + 1), num_points)];
154-
155-
auto rot_a = DirectX::XMQuaternionRotationRollPitchYawFromVector(prev_point.m_rotation);
156-
auto rot_b = DirectX::XMQuaternionRotationRollPitchYawFromVector(next_point.m_rotation);
157-
auto interp = DirectX::XMQuaternionSlerp(rot_a, rot_b, alpha);
158-
159143
auto new_pos = spline->getPosition(m_time);
160144
auto new_rot = quat_spline->getPosition(m_time);
161145

162146
node->SetPosition({ new_pos[0], new_pos[1], new_pos[2] });
163-
node->SetRotationQuat(interp);
164-
node->SetRotationQuat({ new_rot[0], new_rot[1], new_rot[2], new_rot[3] });
147+
node->SetRotationQuaternion({ new_rot[0], new_rot[1], new_rot[2], new_rot[3] });
165148
};
166149

167150
if (m_looping)

src/scene_graph/node.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ namespace wr
5656

5757
const std::type_info& m_type_info;
5858

59-
private:
59+
protected:
6060
bool m_use_quaternion = false;
6161

62+
private:
6263
std::bitset<3> m_requires_update;
6364
std::bitset<3> m_requires_transform_update;
6465

0 commit comments

Comments
 (0)