From 5d5b63ae333bd5326c1f9f94a8d90242c0f6b3bd Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Fri, 21 May 2021 15:20:21 +0200 Subject: [PATCH] try explicit conversion --- lib/Ray/sources/Vector.hpp | 1 + sources/Util/vector.cpp | 14 ++++++++++++++ sources/main.cpp | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 sources/Util/vector.cpp diff --git a/lib/Ray/sources/Vector.hpp b/lib/Ray/sources/Vector.hpp index 2308ec2d..4923d36c 100644 --- a/lib/Ray/sources/Vector.hpp +++ b/lib/Ray/sources/Vector.hpp @@ -11,6 +11,7 @@ #include namespace RAY { + typedef ::Vector2 Vector2; typedef ::Vector3 Vector3; typedef ::Vector4 Vector4; diff --git a/sources/Util/vector.cpp b/sources/Util/vector.cpp new file mode 100644 index 00000000..8ae2669a --- /dev/null +++ b/sources/Util/vector.cpp @@ -0,0 +1,14 @@ +/* +** EPITECH PROJECT, 2021 +** Bomberman +** File description: +** Vector +*/ + +#include "Vector.hpp" +#include "Models/Vector3.hpp" + +RAY::Vector3 toRAY(const WAL::Vector3 &wal) +{ + return (RAY::Vector3){wal.x, wal.y, wal.y}; +} \ No newline at end of file diff --git a/sources/main.cpp b/sources/main.cpp index da372dab..b0159f84 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -25,8 +25,8 @@ int main() RAY::Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 }; RAY::Window &window = RAY::Window::getInstance(screenWidth, screenHeight, "Ta mère en slip"); - RAY::Camera::Camera3D camera((Vector3){ 30.0f, 20.0f, 30.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, - (Vector3){ 0.0f, 1.0f, 0.0f }, 70.0, CAMERA_PERSPECTIVE); + RAY::Camera::Camera3D camera((RAY::Vector3){ 30.0f, 20.0f, 30.0f }, (RAY::Vector3){ 0.0f, 0.0f, 0.0f }, + (RAY::Vector3){ 0.0f, 1.0f, 0.0f }, 70.0, CAMERA_PERSPECTIVE); RAY::Drawables::Drawables3D::Grid grid(10, 5.0f); RAY::Drawables::Drawables3D::Cube cube({0}, {0}, {0}); @@ -75,7 +75,7 @@ int main() float scatter = sinf(blockScale*20.0f + (float)(time*4.0f)); // Calculate the cube position - cube.setPosition({ + cube.setPosition((RAY::Vector3){ (float)(x - numBlocks/2)*(scale*3.0f) + scatter, (float)(y - numBlocks/2)*(scale*2.0f) + scatter, (float)(z - numBlocks/2)*(scale*3.0f) + scatter