SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Vector3.h
1#pragma once
2
3namespace spark::math
4{
5 template <typename T>
7 : details::Vector<Vector3, T, 3>({std::ref(x), std::ref(y), std::ref(z)}) {}
8
9 template <typename T>
10 constexpr Vector3<T>::Vector3(T x_value, T y_value, T z_value) noexcept
11 : details::Vector<Vector3, T, 3>({std::ref(x), std::ref(y), std::ref(z)}), x(std::move(x_value)), y(std::move(y_value)), z(std::move(z_value)) {}
12
13 template <typename T>
14 constexpr Vector3<T>::Vector3(const Vector3& other)
15 : details::Vector<Vector3, T, 3>({std::ref(x), std::ref(y), std::ref(z)}), x(other.x), y(other.y), z(other.z) {}
17 template <typename T>
18 constexpr Vector3<T>::Vector3(Vector3&& other) noexcept
19 : details::Vector<Vector3, T, 3>({std::ref(x), std::ref(y), std::ref(z)}), x(std::move(other.x)), y(std::move(other.y)), z(std::move(other.z)) {}
20
21 template <typename T>
22 constexpr Vector3<T>& Vector3<T>::operator=(const Vector3& other)
23 {
24 x = other.x;
25 y = other.y;
26 z = other.z;
27 return *this;
28 }
29
30 template <typename T>
31 constexpr Vector3<T>& Vector3<T>::operator=(Vector3&& other) noexcept
32 {
33 x = std::move(other.x);
34 y = std::move(other.y);
35 z = std::move(other.z);
36 return *this;
37 }
39 template <typename T>
40 template <typename To>
41 constexpr Vector3<To> Vector3<T>::castTo() const noexcept
42 {
43 return {static_cast<To>(x), static_cast<To>(y), static_cast<To>(z)};
44 }
45}
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