Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Body/BodyPair.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Physics/Body/BodyID.h>7#include <Jolt/Core/HashCombine.h>89JPH_NAMESPACE_BEGIN1011/// Structure that holds a body pair12struct alignas(uint64) BodyPair13{14JPH_OVERRIDE_NEW_DELETE1516/// Constructor17BodyPair() = default;18BodyPair(BodyID inA, BodyID inB) : mBodyA(inA), mBodyB(inB) { }1920/// Equals operator21bool operator == (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) == *reinterpret_cast<const uint64 *>(&inRHS); }2223/// Smaller than operator, used for consistently ordering body pairs24bool operator < (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) < *reinterpret_cast<const uint64 *>(&inRHS); }2526/// Get the hash value of this object27uint64 GetHash() const { return Hash64(*reinterpret_cast<const uint64 *>(this)); }2829BodyID mBodyA;30BodyID mBodyB;31};3233static_assert(sizeof(BodyPair) == sizeof(uint64), "Mismatch in class size");3435JPH_NAMESPACE_END363738