adding a true user-defined conversion operator

This commit is contained in:
Clément Le Bihan
2021-05-26 18:40:18 +02:00
parent 6bd7a46ea9
commit 07e2d5bc35
3 changed files with 5 additions and 4 deletions
+1 -2
View File
@@ -30,8 +30,7 @@ set(SOURCES
add_executable(bomberman
sources/main.cpp
${SOURCES}
sources/Models/Vector3.cpp)
${SOURCES})
target_include_directories(bomberman PUBLIC sources)
target_link_libraries(bomberman PUBLIC wal ray)
+3 -1
View File
@@ -153,13 +153,15 @@ namespace BBM
{
return (point * this) / std::pow(this->magnitude(), 2) * this;
}
explicit operator RAY::Vector3() const { return {this->x, this->y, this->z };}
};
typedef Vector3<float> Vector3f;
typedef Vector3<unsigned> Vector3u;
typedef Vector3<int> Vector3i;
RAY::Vector3 operator*(const Vector3f &v);
}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace BBM
auto &comp = entity.getComponent<Drawable3DComponent<T>>();
auto &pos = entity.getComponent<PositionComponent>();
comp.member.setPosition(*pos.position);
comp.member.setPosition(static_cast<RAY::Vector3>(pos.position));
comp.member.drawOn(this->_window);
}