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