MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_vector4.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_VECTOR4_H_1614659262
12#define INCGUARD_MGL_VECTOR4_H_1614659262
13
14namespace MGL
15{
17struct Vector4
18{
19 float x;
20 float y;
21 float z;
22 float w;
23
24 /* ------------------------------------------------------------------------- */
28 /* ------------------------------------------------------------------------- */
29 constexpr Vector4() noexcept
30 : x(0.0f)
31 , y(0.0f)
32 , z(0.0f)
33 , w(0.0f)
34 {}
35
36 /* ------------------------------------------------------------------------- */
44 /* ------------------------------------------------------------------------- */
45 constexpr Vector4(float inX, float inY, float inZ, float inW) noexcept
46 : x(inX)
47 , y(inY)
48 , z(inZ)
49 , w(inW)
50 {}
51};
52
53/* ------------------------------------------------------------------------- */
60/* ------------------------------------------------------------------------- */
61constexpr Vector4 operator+(const Vector4 &lhs, const Vector4 &rhs) noexcept
62{
63 return Vector4(lhs.x + rhs.x,
64 lhs.y + rhs.y,
65 lhs.z + rhs.z,
66 lhs.w + rhs.w);
67}
68
69/* ------------------------------------------------------------------------- */
76/* ------------------------------------------------------------------------- */
77constexpr Vector4 operator-(const Vector4 &lhs, const Vector4 &rhs) noexcept
78{
79 return Vector4(lhs.x - rhs.x,
80 lhs.y - rhs.y,
81 lhs.z - rhs.z,
82 lhs.w - rhs.w);
83}
84} // namespace MGL
85
86#endif // INCGUARD_MGL_VECTOR4_H_1614659262
87
88// vim: et ts=4 sw=4 sts=4
constexpr Vector2 operator-(const Vector2 &lhs, const Vector2 &rhs) noexcept
Vector2の減算
Definition mgl_vector2.h:270
constexpr Vector2 operator+(const Vector2 &lhs, const Vector2 &rhs) noexcept
Vector2の加算
Definition mgl_vector2.h:257
4Dベクトル
Definition mgl_vector4.h:18
float z
Z成分
Definition mgl_vector4.h:21
constexpr Vector4(float inX, float inY, float inZ, float inW) noexcept
成分を指定して初期化
Definition mgl_vector4.h:45
float x
X成分
Definition mgl_vector4.h:19
constexpr Vector4() noexcept
ゼロ初期化
Definition mgl_vector4.h:29
float w
W成分
Definition mgl_vector4.h:22
float y
Y成分
Definition mgl_vector4.h:20