A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
// SPDX-License-Identifier: MIT
#pragma once
#include <Jolt/Physics/Body/BodyID.h>
#include <Jolt/Core/HashCombine.h>
JPH_NAMESPACE_BEGIN
/// Structure that holds a body pair
struct alignas(uint64) BodyPair
{
JPH_OVERRIDE_NEW_DELETE
/// Constructor
BodyPair() = default;
BodyPair(BodyID inA, BodyID inB) : mBodyA(inA), mBodyB(inB) { }
/// Equals operator
bool operator == (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) == *reinterpret_cast<const uint64 *>(&inRHS); }
/// Smaller than operator, used for consistently ordering body pairs
bool operator < (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) < *reinterpret_cast<const uint64 *>(&inRHS); }
/// Get the hash value of this object
uint64 GetHash() const { return Hash64(*reinterpret_cast<const uint64 *>(this)); }
BodyID mBodyA;
BodyID mBodyB;
};
static_assert(sizeof(BodyPair) == sizeof(uint64), "Mismatch in class size");
JPH_NAMESPACE_END