using the utils function (BBM vector3 -> RAY vector3)

This commit is contained in:
Clément Le Bihan
2021-05-26 16:50:52 +02:00
parent b2659c3272
commit 7da7e50f68
4 changed files with 35 additions and 4 deletions
+2 -1
View File
@@ -25,12 +25,13 @@ set(SOURCES
sources/Component/Drawable/Drawable2DComponent.hpp
sources/System/Renderer/Renderer3DSystem.hpp
sources/System/Renderer/Renderer2DSystem.hpp
sources/Util/Utils.cpp
)
add_executable(bomberman
sources/main.cpp
${SOURCES}
sources/System/Renderer/RenderScreenSystem.hpp)
sources/System/Renderer/RenderScreenSystem.hpp sources/Util/Utils.hpp)
target_include_directories(bomberman PUBLIC sources)
target_link_libraries(bomberman PUBLIC wal ray)
+2 -1
View File
@@ -9,6 +9,7 @@
#include "Entity/Entity.hpp"
#include "Component/Position/PositionComponent.hpp"
#include "Component/Drawable/Drawable3DComponent.hpp"
#include "Util/Utils.hpp"
#include "Window.hpp"
namespace BBM
@@ -35,7 +36,7 @@ namespace BBM
auto &comp = entity.getComponent<Drawable3DComponent<T>>();
auto &pos = entity.getComponent<PositionComponent>();
comp.member.setPosition({pos.getX(), pos.getY(), pos.getZ()});
comp.member.setPosition(Utils::toRAY(pos.position));
comp.member.drawOn(this->_window);
}
@@ -7,8 +7,12 @@
#include "Vector/Vector3.hpp"
#include "Models/Vector3.hpp"
#include "Utils.hpp"
RAY::Vector3 toRAY(const WAL::Vector3f &wal)
namespace BBM
{
return RAY::Vector3(wal.x, wal.y, wal.y);
RAY::Vector3 Utils::toRAY(const BBM::Vector3f &wal)
{
return RAY::Vector3(wal.x, wal.y, wal.y);
}
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by cbihan on 26/05/2021.
//
#pragma once
#include "Vector/Vector3.hpp"
#include "Models/Vector3.hpp"
namespace BBM
{
struct Utils
{
static RAY::Vector3 toRAY(const BBM::Vector3f &wal);
//! @brief default ctor
Utils() = default;
//! @brief Default copy ctor
Utils(const Utils &) = default;
//! @brief Default dtor
~Utils() = default;
//! @brief Default assignment operator
Utils &operator=(const Utils &) = default;
};
}