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
19 float operator [] (int inCoordinate) const
20 {
21 JPH_ASSERT(inCoordinate < 4);
22 return *(&x + inCoordinate);
23 }
24
25 float x;
26 float y;
27 float z;
28 float w;
29};
30
31static_assert(is_trivial<Float4>(), "Is supposed to be a trivial type!");
32
#define JPH_NAMESPACE_END
Definition: Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:234
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
Class that holds 4 float values. Convert to Vec4 to perform calculations.
Definition: Float4.h:11
float x
Definition: Float4.h:25
float y
Definition: Float4.h:26
Float4(const Float4 &inRHS)=default
float z
Definition: Float4.h:27
float w
Definition: Float4.h:28
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.