Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Vector4.cpp
1/*
2Copyright (C) 2015-2018,2025 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#include <iostream>
17#include "aeongames/Vector4.hpp"
18#include "3DMath.h"
19
20namespace AeonGames
21{
23 {
24 memset ( mVector, 0, sizeof ( float ) * 4 );
25 }
26
27 Vector4::Vector4 ( const float* const aVector4 )
28 {
29 memcpy ( mVector, aVector4, sizeof ( float ) * 4 );
30 }
31
32 Vector4::Vector4 ( float aX, float aY, float aZ, float aW )
33 {
34 mVector[0] = aX;
35 mVector[1] = aY;
36 mVector[2] = aZ;
37 mVector[3] = aW;
38 }
39
41 = default;
42
43 const float* const Vector4::GetVector4() const
44 {
45 return mVector;
46 }
47
48 const float& Vector4::GetX() const
49 {
50 return mVector[0];
51 }
52
53 const float& Vector4::GetY() const
54 {
55 return mVector[1];
56 }
57
58 const float& Vector4::GetZ() const
59 {
60 return mVector[2];
61 }
62
63 const float& Vector4::GetW() const
64 {
65 return mVector[3];
66 }
67 bool operator== ( const Vector4 & aLhs, const Vector4 & aRhs )
68 {
69 return memcmp ( aLhs.GetVector4(), aRhs.GetVector4(), sizeof ( float ) * 4 ) == 0;
70 }
71}
Inline functions related to 3D Math.
Header for the 4D vector class.
4D vector class.
Definition Vector4.hpp:31
DLL const float *const GetVector4() const
Get a pointer to the internal vector data.
Definition Vector4.cpp:43
DLL const float & GetZ() const
Get the Z component.
Definition Vector4.cpp:58
DLL const float & GetW() const
Get the W component.
Definition Vector4.cpp:63
DLL ~Vector4()
destructor.
DLL Vector4()
Default constructor.
Definition Vector4.cpp:22
DLL const float & GetY() const
Get the Y component.
Definition Vector4.cpp:53
DLL const float & GetX() const
Get the X component.
Definition Vector4.cpp:48
float mVector[4]
X, Y, Z and W components.
Definition Vector4.hpp:70
<- This is here just for the literals
Definition AABB.hpp:31
DLL const bool operator==(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Compare two 3x3 matrices for equality.