Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Float4.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
8
10class [[nodiscard]] Float4
11{
12public:
14
15 Float4() = default;
16 Float4(const Float4 &inRHS) = default;
17 Float4(float inX, float inY, float inZ, float inW) : x(inX), y(inY), z(inZ), w(inW) { }
18 Float4 & operator = (const Float4 &inRHS) = default;
19
20 float operator [] (int inCoordinate) const
21 {
22 JPH_ASSERT(inCoordinate < 4);
23 return *(&x + inCoordinate);
24 }
25
26 bool operator == (const Float4 &inRHS) const
27 {
28 return x == inRHS.x && y == inRHS.y && z == inRHS.z && w == inRHS.w;
29 }
30
31 bool operator != (const Float4 &inRHS) const
32 {
33 return x != inRHS.x || y != inRHS.y || z != inRHS.z || w != inRHS.w;
34 }
35
36 float x;
37 float y;
38 float z;
39 float w;
40};
41
42static_assert(std::is_trivial<Float4>(), "Is supposed to be a trivial type!");
43
#define JPH_NAMESPACE_END
Definition Core.h:419
#define JPH_NAMESPACE_BEGIN
Definition Core.h:413
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:43
Class that holds 4 float values. Convert to Vec4 to perform calculations.
Definition Float4.h:11
float x
Definition Float4.h:36
float y
Definition Float4.h:37
Float4(const Float4 &inRHS)=default
float z
Definition Float4.h:38
float w
Definition Float4.h:39
Float4(float inX, float inY, float inZ, float inW)
Definition Float4.h:17
JPH_OVERRIDE_NEW_DELETE Float4()=default
Intentionally not initialized for performance reasons.