1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPrerequisitesUtil.h"
6
7namespace bs
8{
9 /** @addtogroup Math
10 * @{
11 */
12
13 /** A three dimensional vector with integer coordinates. */
14 struct BS_SCRIPT_EXPORT(m:Math,pl:true) Vector3I
15 {
16 INT32 x = 0;
17 INT32 y = 0;
18 INT32 z = 0;
19
20 constexpr Vector3I() = default;
21
22 constexpr Vector3I(INT32 x, INT32 y, INT32 z)
23 :x(x), y(y), z(z)
24 { }
25
26 INT32 operator[] (size_t i) const
27 {
28 assert(i < 3);
29
30 switch (i)
31 {
32 case 0: return x;
33 case 1: return y;
34 case 2: return z;
35 default: return 0;
36 }
37 }
38
39 INT32& operator[] (size_t i)
40 {
41 assert(i < 3);
42
43 switch (i)
44 {
45 case 0: return x;
46 case 1: return y;
47 case 2: return z;
48 default: return x;
49 }
50 }
51
52 bool operator== (const Vector3I& rhs) const
53 {
54 return x == rhs.x && y == rhs.y && z == rhs.z;
55 }
56
57 bool operator!= (const Vector3I& rhs) const
58 {
59 return !operator==(rhs);
60 }
61 };
62
63 /** @} */
64
65 BS_ALLOW_MEMCPY_SERIALIZATION(Vector3I)
66}
67