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 float x;
27 float y;
28 float z;
29 float w;
30};
31
32static_assert(std::is_trivial<Float4>(), "Is supposed to be a trivial type!");
33
#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:26
float y
Definition Float4.h:27
Float4(const Float4 &inRHS)=default
float z
Definition Float4.h:28
float w
Definition Float4.h:29
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.