From b749a80a25ed295e37c7ebef802c9a93af1679a7 Mon Sep 17 00:00:00 2001 From: Wellinator Date: Thu, 8 Apr 2021 08:33:06 -0300 Subject: [PATCH] Add rotation function --- .gitignore | 1 + src/samples/cube/objects/cube.cpp | 9 +++++++++ src/samples/cube/objects/cube.hpp | 1 + 3 files changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index d1350e8..489b289 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode/ +.idea/ # --- diff --git a/src/samples/cube/objects/cube.cpp b/src/samples/cube/objects/cube.cpp index 60a660b..cb1f8ab 100644 --- a/src/samples/cube/objects/cube.cpp +++ b/src/samples/cube/objects/cube.cpp @@ -25,6 +25,7 @@ Cube::Cube( TextureRepository *t_texRepo ) void Cube::update(const Pad &t_pad, const Camera &t_camera) { + rotate(t_pad); Vector3 *nextPos = getNextPosition(t_pad, t_camera); } @@ -55,4 +56,12 @@ Vector3 *Cube::getNextPosition(const Pad &t_pad, const Camera &t_camera) result->z += -normalizedCamera.x; } return result; +} + +void Cube::rotate(const Pad &t_pad){ + //if (t_pad.rJoyH >= 200) + //else if (t_pad.rJoyH <= 100) + mesh.rotation.x += 0.01; + mesh.rotation.y += 0.01; + mesh.rotation.z += 0.01; } \ No newline at end of file diff --git a/src/samples/cube/objects/cube.hpp b/src/samples/cube/objects/cube.hpp index 22abe35..e8350bf 100644 --- a/src/samples/cube/objects/cube.hpp +++ b/src/samples/cube/objects/cube.hpp @@ -20,6 +20,7 @@ class Cube private: TextureRepository *texRepo; Vector3 *getNextPosition(const Pad &t_pad, const Camera &t_camera); + void rotate(const Pad &t_pad); float speed; };