Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/jolt_physics/Jolt/Math/Float4.h
9913 views
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
7
JPH_NAMESPACE_BEGIN
8
9
/// Class that holds 4 float values. Convert to Vec4 to perform calculations.
10
class [[nodiscard]] Float4
11
{
12
public:
13
JPH_OVERRIDE_NEW_DELETE
14
15
Float4() = default; ///< Intentionally not initialized for performance reasons
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
31
static_assert(std::is_trivial<Float4>(), "Is supposed to be a trivial type!");
32
33
JPH_NAMESPACE_END
34
35