SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Vector3.h
1#pragma once
2
3#include "spark/math/details/Vector.h"
4
5namespace spark::math
6{
11 template <typename T>
12 class Vector3 final : public details::Vector<Vector3, T, 3>
13 {
14 public:
16 constexpr Vector3();
17
24 constexpr Vector3(T x_value, T y_value, T z_value) noexcept;
25 ~Vector3() = default;
26
27 constexpr Vector3(const Vector3& other);
28 constexpr Vector3(Vector3&& other) noexcept;
29 constexpr Vector3& operator=(const Vector3& other);
30 constexpr Vector3& operator=(Vector3&& other) noexcept;
31
37 template <typename To>
38 [[nodiscard]] constexpr Vector3<To> castTo() const noexcept;
39
40 public:
41 T x {};
42 T y {};
43 T z {};
44 };
45}
46
47#include "spark/math/impl/Vector3.h"
48
49template <typename T>
50struct std::hash<spark::math::Vector3<T>>
51{
52 std::size_t operator()(const spark::math::Vector3<T>& vec) const
53 {
54 return std::hash<T> {}(vec.x) ^ std::hash<T> {}(vec.y) ^ std::hash<T> {}(vec.z);
55 }
56};
A vector with three components.
Definition Vector3.h:13
constexpr Vector3()
Initializes a new Vector3 with all components to their default value.
Definition Vector3.h:6
constexpr Vector3< To > castTo() const noexcept
Casts all components of the Vector3 to the type To.
Definition Vector3.h:41
Definition Vector.h:12