Path: blob/master/thirdparty/jolt_physics/Jolt/Math/Float4.h
21382 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56JPH_NAMESPACE_BEGIN78/// Class that holds 4 float values. Convert to Vec4 to perform calculations.9class [[nodiscard]] Float410{11public:12JPH_OVERRIDE_NEW_DELETE1314Float4() = default; ///< Intentionally not initialized for performance reasons15Float4(const Float4 &inRHS) = default;16Float4(float inX, float inY, float inZ, float inW) : x(inX), y(inY), z(inZ), w(inW) { }17Float4 & operator = (const Float4 &inRHS) = default;1819float operator [] (int inCoordinate) const20{21JPH_ASSERT(inCoordinate < 4);22return *(&x + inCoordinate);23}2425bool operator == (const Float4 &inRHS) const26{27return x == inRHS.x && y == inRHS.y && z == inRHS.z && w == inRHS.w;28}2930bool operator != (const Float4 &inRHS) const31{32return x != inRHS.x || y != inRHS.y || z != inRHS.z || w != inRHS.w;33}3435float x;36float y;37float z;38float w;39};4041static_assert(std::is_trivial<Float4>(), "Is supposed to be a trivial type!");4243JPH_NAMESPACE_END444546