├── .github └── workflows │ └── build.yml ├── .gitignore ├── JoltPhysicsC ├── CMakeLists.txt ├── Jolt │ ├── AABBTree │ │ ├── AABBTreeBuilder.cpp │ │ ├── AABBTreeBuilder.h │ │ ├── AABBTreeToBuffer.h │ │ ├── NodeCodec │ │ │ └── NodeCodecQuadTreeHalfFloat.h │ │ └── TriangleCodec │ │ │ └── TriangleCodecIndexed8BitPackSOA4Flags.h │ ├── ConfigurationString.h │ ├── Core │ │ ├── ARMNeon.h │ │ ├── Atomics.h │ │ ├── ByteBuffer.h │ │ ├── Color.cpp │ │ ├── Color.h │ │ ├── Core.h │ │ ├── FPControlWord.h │ │ ├── FPException.h │ │ ├── FPFlushDenormals.h │ │ ├── Factory.cpp │ │ ├── Factory.h │ │ ├── FixedSizeFreeList.h │ │ ├── FixedSizeFreeList.inl │ │ ├── HashCombine.h │ │ ├── InsertionSort.h │ │ ├── IssueReporting.cpp │ │ ├── IssueReporting.h │ │ ├── JobSystem.h │ │ ├── JobSystem.inl │ │ ├── JobSystemThreadPool.cpp │ │ ├── JobSystemThreadPool.h │ │ ├── JobSystemWithBarrier.cpp │ │ ├── JobSystemWithBarrier.h │ │ ├── LinearCurve.cpp │ │ ├── LinearCurve.h │ │ ├── LockFreeHashMap.h │ │ ├── LockFreeHashMap.inl │ │ ├── Memory.cpp │ │ ├── Memory.h │ │ ├── Mutex.h │ │ ├── MutexArray.h │ │ ├── NonCopyable.h │ │ ├── Profiler.cpp │ │ ├── Profiler.h │ │ ├── Profiler.inl │ │ ├── QuickSort.h │ │ ├── RTTI.cpp │ │ ├── RTTI.h │ │ ├── Reference.h │ │ ├── Result.h │ │ ├── STLAlignedAllocator.h │ │ ├── STLAllocator.h │ │ ├── STLTempAllocator.h │ │ ├── Semaphore.cpp │ │ ├── Semaphore.h │ │ ├── StaticArray.h │ │ ├── StreamIn.h │ │ ├── StreamOut.h │ │ ├── StreamWrapper.h │ │ ├── StringTools.cpp │ │ ├── StringTools.h │ │ ├── TempAllocator.h │ │ ├── TickCounter.cpp │ │ ├── TickCounter.h │ │ ├── UnorderedMap.h │ │ └── UnorderedSet.h │ ├── Geometry │ │ ├── AABox.h │ │ ├── AABox4.h │ │ ├── ClipPoly.h │ │ ├── ClosestPoint.h │ │ ├── ConvexHullBuilder.cpp │ │ ├── ConvexHullBuilder.h │ │ ├── ConvexHullBuilder2D.cpp │ │ ├── ConvexHullBuilder2D.h │ │ ├── ConvexSupport.h │ │ ├── EPAConvexHullBuilder.h │ │ ├── EPAPenetrationDepth.h │ │ ├── Ellipse.h │ │ ├── GJKClosestPoint.h │ │ ├── IndexedTriangle.h │ │ ├── Indexify.cpp │ │ ├── Indexify.h │ │ ├── MortonCode.h │ │ ├── OrientedBox.cpp │ │ ├── OrientedBox.h │ │ ├── Plane.h │ │ ├── RayAABox.h │ │ ├── RayAABox8.h │ │ ├── RayCapsule.h │ │ ├── RayCylinder.h │ │ ├── RaySphere.h │ │ ├── RayTriangle.h │ │ ├── RayTriangle8.h │ │ ├── Sphere.h │ │ └── Triangle.h │ ├── Jolt.cmake │ ├── Jolt.h │ ├── Math │ │ ├── DMat44.h │ │ ├── DMat44.inl │ │ ├── DVec3.h │ │ ├── DVec3.inl │ │ ├── Double3.h │ │ ├── DynMatrix.h │ │ ├── EigenValueSymmetric.h │ │ ├── FindRoot.h │ │ ├── Float2.h │ │ ├── Float3.h │ │ ├── Float4.h │ │ ├── GaussianElimination.h │ │ ├── HalfFloat.h │ │ ├── Mat44.h │ │ ├── Mat44.inl │ │ ├── Math.h │ │ ├── MathTypes.h │ │ ├── Matrix.h │ │ ├── Quat.h │ │ ├── Quat.inl │ │ ├── Real.h │ │ ├── Swizzle.h │ │ ├── Trigonometry.h │ │ ├── UVec4.cpp │ │ ├── UVec4.h │ │ ├── UVec4.inl │ │ ├── UVec8.h │ │ ├── UVec8.inl │ │ ├── Vec3.cpp │ │ ├── Vec3.h │ │ ├── Vec3.inl │ │ ├── Vec4.h │ │ ├── Vec4.inl │ │ ├── Vec8.h │ │ ├── Vec8.inl │ │ └── Vector.h │ ├── ObjectStream │ │ ├── GetPrimitiveTypeOfType.h │ │ ├── ObjectStream.cpp │ │ ├── ObjectStream.h │ │ ├── ObjectStreamBinaryIn.cpp │ │ ├── ObjectStreamBinaryIn.h │ │ ├── ObjectStreamBinaryOut.cpp │ │ ├── ObjectStreamBinaryOut.h │ │ ├── ObjectStreamIn.cpp │ │ ├── ObjectStreamIn.h │ │ ├── ObjectStreamOut.cpp │ │ ├── ObjectStreamOut.h │ │ ├── ObjectStreamTextIn.cpp │ │ ├── ObjectStreamTextIn.h │ │ ├── ObjectStreamTextOut.cpp │ │ ├── ObjectStreamTextOut.h │ │ ├── ObjectStreamTypes.h │ │ ├── SerializableAttribute.h │ │ ├── SerializableAttributeEnum.h │ │ ├── SerializableAttributeTyped.h │ │ ├── SerializableObject.cpp │ │ ├── SerializableObject.h │ │ ├── TypeDeclarations.cpp │ │ └── TypeDeclarations.h │ ├── Physics │ │ ├── Body │ │ │ ├── Body.cpp │ │ │ ├── Body.h │ │ │ ├── Body.inl │ │ │ ├── BodyAccess.cpp │ │ │ ├── BodyAccess.h │ │ │ ├── BodyActivationListener.h │ │ │ ├── BodyCreationSettings.cpp │ │ │ ├── BodyCreationSettings.h │ │ │ ├── BodyFilter.h │ │ │ ├── BodyID.h │ │ │ ├── BodyInterface.cpp │ │ │ ├── BodyInterface.h │ │ │ ├── BodyLock.h │ │ │ ├── BodyLockInterface.h │ │ │ ├── BodyLockMulti.h │ │ │ ├── BodyManager.cpp │ │ │ ├── BodyManager.h │ │ │ ├── BodyPair.h │ │ │ ├── MassProperties.cpp │ │ │ ├── MassProperties.h │ │ │ ├── MotionProperties.cpp │ │ │ ├── MotionProperties.h │ │ │ ├── MotionProperties.inl │ │ │ ├── MotionQuality.h │ │ │ └── MotionType.h │ │ ├── Character │ │ │ ├── Character.cpp │ │ │ ├── Character.h │ │ │ ├── CharacterBase.cpp │ │ │ ├── CharacterBase.h │ │ │ ├── CharacterVirtual.cpp │ │ │ └── CharacterVirtual.h │ │ ├── Collision │ │ │ ├── AABoxCast.h │ │ │ ├── ActiveEdgeMode.h │ │ │ ├── ActiveEdges.h │ │ │ ├── BackFaceMode.h │ │ │ ├── BroadPhase │ │ │ │ ├── BroadPhase.cpp │ │ │ │ ├── BroadPhase.h │ │ │ │ ├── BroadPhaseBruteForce.cpp │ │ │ │ ├── BroadPhaseBruteForce.h │ │ │ │ ├── BroadPhaseLayer.h │ │ │ │ ├── BroadPhaseQuadTree.cpp │ │ │ │ ├── BroadPhaseQuadTree.h │ │ │ │ ├── BroadPhaseQuery.h │ │ │ │ ├── QuadTree.cpp │ │ │ │ └── QuadTree.h │ │ │ ├── CastConvexVsTriangles.cpp │ │ │ ├── CastConvexVsTriangles.h │ │ │ ├── CastResult.h │ │ │ ├── CastSphereVsTriangles.cpp │ │ │ ├── CastSphereVsTriangles.h │ │ │ ├── CollectFacesMode.h │ │ │ ├── CollideConvexVsTriangles.cpp │ │ │ ├── CollideConvexVsTriangles.h │ │ │ ├── CollidePointResult.h │ │ │ ├── CollideShape.h │ │ │ ├── CollideSphereVsTriangles.cpp │ │ │ ├── CollideSphereVsTriangles.h │ │ │ ├── CollisionCollector.h │ │ │ ├── CollisionCollectorImpl.h │ │ │ ├── CollisionDispatch.cpp │ │ │ ├── CollisionDispatch.h │ │ │ ├── CollisionGroup.cpp │ │ │ ├── CollisionGroup.h │ │ │ ├── ContactListener.h │ │ │ ├── EstimateCollisionResponse.cpp │ │ │ ├── EstimateCollisionResponse.h │ │ │ ├── GroupFilter.cpp │ │ │ ├── GroupFilter.h │ │ │ ├── GroupFilterTable.cpp │ │ │ ├── GroupFilterTable.h │ │ │ ├── ManifoldBetweenTwoFaces.cpp │ │ │ ├── ManifoldBetweenTwoFaces.h │ │ │ ├── NarrowPhaseQuery.cpp │ │ │ ├── NarrowPhaseQuery.h │ │ │ ├── NarrowPhaseStats.cpp │ │ │ ├── NarrowPhaseStats.h │ │ │ ├── ObjectLayer.h │ │ │ ├── PhysicsMaterial.cpp │ │ │ ├── PhysicsMaterial.h │ │ │ ├── PhysicsMaterialSimple.cpp │ │ │ ├── PhysicsMaterialSimple.h │ │ │ ├── RayCast.h │ │ │ ├── Shape │ │ │ │ ├── BoxShape.cpp │ │ │ │ ├── BoxShape.h │ │ │ │ ├── CapsuleShape.cpp │ │ │ │ ├── CapsuleShape.h │ │ │ │ ├── CompoundShape.cpp │ │ │ │ ├── CompoundShape.h │ │ │ │ ├── CompoundShapeVisitors.h │ │ │ │ ├── ConvexHullShape.cpp │ │ │ │ ├── ConvexHullShape.h │ │ │ │ ├── ConvexShape.cpp │ │ │ │ ├── ConvexShape.h │ │ │ │ ├── CylinderShape.cpp │ │ │ │ ├── CylinderShape.h │ │ │ │ ├── DecoratedShape.cpp │ │ │ │ ├── DecoratedShape.h │ │ │ │ ├── GetTrianglesContext.h │ │ │ │ ├── HeightFieldShape.cpp │ │ │ │ ├── HeightFieldShape.h │ │ │ │ ├── MeshShape.cpp │ │ │ │ ├── MeshShape.h │ │ │ │ ├── MutableCompoundShape.cpp │ │ │ │ ├── MutableCompoundShape.h │ │ │ │ ├── OffsetCenterOfMassShape.cpp │ │ │ │ ├── OffsetCenterOfMassShape.h │ │ │ │ ├── PolyhedronSubmergedVolumeCalculator.h │ │ │ │ ├── RotatedTranslatedShape.cpp │ │ │ │ ├── RotatedTranslatedShape.h │ │ │ │ ├── ScaleHelpers.h │ │ │ │ ├── ScaledShape.cpp │ │ │ │ ├── ScaledShape.h │ │ │ │ ├── Shape.cpp │ │ │ │ ├── Shape.h │ │ │ │ ├── SphereShape.cpp │ │ │ │ ├── SphereShape.h │ │ │ │ ├── StaticCompoundShape.cpp │ │ │ │ ├── StaticCompoundShape.h │ │ │ │ ├── SubShapeID.h │ │ │ │ ├── SubShapeIDPair.h │ │ │ │ ├── TaperedCapsuleShape.cpp │ │ │ │ ├── TaperedCapsuleShape.gliffy │ │ │ │ ├── TaperedCapsuleShape.h │ │ │ │ ├── TriangleShape.cpp │ │ │ │ └── TriangleShape.h │ │ │ ├── ShapeCast.h │ │ │ ├── ShapeFilter.h │ │ │ ├── SortReverseAndStore.h │ │ │ ├── TransformedShape.cpp │ │ │ └── TransformedShape.h │ │ ├── Constraints │ │ │ ├── ConeConstraint.cpp │ │ │ ├── ConeConstraint.h │ │ │ ├── Constraint.cpp │ │ │ ├── Constraint.h │ │ │ ├── ConstraintManager.cpp │ │ │ ├── ConstraintManager.h │ │ │ ├── ConstraintPart │ │ │ │ ├── AngleConstraintPart.h │ │ │ │ ├── AxisConstraintPart.h │ │ │ │ ├── DualAxisConstraintPart.h │ │ │ │ ├── GearConstraintPart.h │ │ │ │ ├── HingeRotationConstraintPart.h │ │ │ │ ├── IndependentAxisConstraintPart.h │ │ │ │ ├── PointConstraintPart.h │ │ │ │ ├── RackAndPinionConstraintPart.h │ │ │ │ ├── RotationEulerConstraintPart.h │ │ │ │ ├── RotationQuatConstraintPart.h │ │ │ │ ├── SpringPart.h │ │ │ │ └── SwingTwistConstraintPart.h │ │ │ ├── ContactConstraintManager.cpp │ │ │ ├── ContactConstraintManager.h │ │ │ ├── DistanceConstraint.cpp │ │ │ ├── DistanceConstraint.h │ │ │ ├── FixedConstraint.cpp │ │ │ ├── FixedConstraint.h │ │ │ ├── GearConstraint.cpp │ │ │ ├── GearConstraint.h │ │ │ ├── HingeConstraint.cpp │ │ │ ├── HingeConstraint.h │ │ │ ├── MotorSettings.cpp │ │ │ ├── MotorSettings.h │ │ │ ├── PathConstraint.cpp │ │ │ ├── PathConstraint.h │ │ │ ├── PathConstraintPath.cpp │ │ │ ├── PathConstraintPath.h │ │ │ ├── PathConstraintPathHermite.cpp │ │ │ ├── PathConstraintPathHermite.h │ │ │ ├── PointConstraint.cpp │ │ │ ├── PointConstraint.h │ │ │ ├── PulleyConstraint.cpp │ │ │ ├── PulleyConstraint.h │ │ │ ├── RackAndPinionConstraint.cpp │ │ │ ├── RackAndPinionConstraint.h │ │ │ ├── SixDOFConstraint.cpp │ │ │ ├── SixDOFConstraint.h │ │ │ ├── SliderConstraint.cpp │ │ │ ├── SliderConstraint.h │ │ │ ├── SwingTwistConstraint.cpp │ │ │ ├── SwingTwistConstraint.h │ │ │ ├── TwoBodyConstraint.cpp │ │ │ └── TwoBodyConstraint.h │ │ ├── DeterminismLog.cpp │ │ ├── DeterminismLog.h │ │ ├── EActivation.h │ │ ├── EPhysicsUpdateError.h │ │ ├── IslandBuilder.cpp │ │ ├── IslandBuilder.h │ │ ├── LargeIslandSplitter.cpp │ │ ├── LargeIslandSplitter.h │ │ ├── PhysicsLock.cpp │ │ ├── PhysicsLock.h │ │ ├── PhysicsScene.cpp │ │ ├── PhysicsScene.h │ │ ├── PhysicsSettings.h │ │ ├── PhysicsStepListener.h │ │ ├── PhysicsSystem.cpp │ │ ├── PhysicsSystem.h │ │ ├── PhysicsUpdateContext.cpp │ │ ├── PhysicsUpdateContext.h │ │ ├── Ragdoll │ │ │ ├── Ragdoll.cpp │ │ │ └── Ragdoll.h │ │ ├── StateRecorder.h │ │ ├── StateRecorderImpl.cpp │ │ ├── StateRecorderImpl.h │ │ └── Vehicle │ │ │ ├── MotorcycleController.cpp │ │ │ ├── MotorcycleController.h │ │ │ ├── TrackedVehicleController.cpp │ │ │ ├── TrackedVehicleController.h │ │ │ ├── VehicleAntiRollBar.cpp │ │ │ ├── VehicleAntiRollBar.h │ │ │ ├── VehicleCollisionTester.cpp │ │ │ ├── VehicleCollisionTester.h │ │ │ ├── VehicleConstraint.cpp │ │ │ ├── VehicleConstraint.h │ │ │ ├── VehicleController.cpp │ │ │ ├── VehicleController.h │ │ │ ├── VehicleDifferential.cpp │ │ │ ├── VehicleDifferential.h │ │ │ ├── VehicleEngine.cpp │ │ │ ├── VehicleEngine.h │ │ │ ├── VehicleTrack.cpp │ │ │ ├── VehicleTrack.h │ │ │ ├── VehicleTransmission.cpp │ │ │ ├── VehicleTransmission.h │ │ │ ├── Wheel.cpp │ │ │ ├── Wheel.h │ │ │ ├── WheeledVehicleController.cpp │ │ │ └── WheeledVehicleController.h │ ├── RegisterTypes.cpp │ ├── RegisterTypes.h │ ├── Renderer │ │ ├── DebugRenderer.cpp │ │ ├── DebugRenderer.h │ │ ├── DebugRendererPlayback.cpp │ │ ├── DebugRendererPlayback.h │ │ ├── DebugRendererRecorder.cpp │ │ └── DebugRendererRecorder.h │ ├── Skeleton │ │ ├── SkeletalAnimation.cpp │ │ ├── SkeletalAnimation.h │ │ ├── Skeleton.cpp │ │ ├── Skeleton.h │ │ ├── SkeletonMapper.cpp │ │ ├── SkeletonMapper.h │ │ ├── SkeletonPose.cpp │ │ └── SkeletonPose.h │ ├── TriangleGrouper │ │ ├── TriangleGrouper.h │ │ ├── TriangleGrouperClosestCentroid.cpp │ │ ├── TriangleGrouperClosestCentroid.h │ │ ├── TriangleGrouperMorton.cpp │ │ └── TriangleGrouperMorton.h │ └── TriangleSplitter │ │ ├── TriangleSplitter.cpp │ │ ├── TriangleSplitter.h │ │ ├── TriangleSplitterBinning.cpp │ │ ├── TriangleSplitterBinning.h │ │ ├── TriangleSplitterFixedLeafSize.cpp │ │ ├── TriangleSplitterFixedLeafSize.h │ │ ├── TriangleSplitterLongestAxis.cpp │ │ ├── TriangleSplitterLongestAxis.h │ │ ├── TriangleSplitterMean.cpp │ │ ├── TriangleSplitterMean.h │ │ ├── TriangleSplitterMorton.cpp │ │ └── TriangleSplitterMorton.h ├── JoltC │ ├── JoltPhysicsC.cpp │ ├── JoltPhysicsC.h │ └── JoltPhysicsC_Extensions.cpp └── README.md ├── LICENSE ├── README.md ├── build-logic ├── build.gradle.kts ├── settings.gradle.kts └── src │ └── main │ └── kotlin │ ├── Extensions.kt │ ├── Globals.kt │ ├── NativesExtension.kt │ ├── base-conventions.gradle.kts │ ├── java-conventions.gradle.kts │ ├── natives-conventions.gradle.kts │ ├── natives-linux-conventions.gradle.kts │ ├── natives-macos-conventions.gradle.kts │ ├── natives-windows-conventions.gradle.kts │ ├── parent-conventions.gradle.kts │ └── publishing-conventions.gradle.kts ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.yml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jolt-java-headers ├── build.gradle.kts └── src │ └── main │ └── java │ └── jolt │ ├── cheaders │ ├── Constants$root.java │ ├── JPC_RRayCast.java │ ├── JPC_RayCast.java │ └── RuntimeHelper.java │ ├── headers │ ├── Constants$root.java │ ├── JPC_AABox.java │ ├── JPC_AABoxCast.java │ ├── JPC_AlignedAllocateFunction.java │ ├── JPC_AlignedFreeFunction.java │ ├── JPC_AllocateFunction.java │ ├── JPC_Body.java │ ├── JPC_BodyActivationListenerVTable.java │ ├── JPC_BodyCreationSettings.java │ ├── JPC_BodyFilterVTable.java │ ├── JPC_BodyLockRead.java │ ├── JPC_BodyLockWrite.java │ ├── JPC_BroadPhaseCastResult.java │ ├── JPC_BroadPhaseLayerFilterVTable.java │ ├── JPC_BroadPhaseLayerInterfaceVTable.java │ ├── JPC_CastRayCollectorVTable.java │ ├── JPC_CastShapeBodyCollectorVTable.java │ ├── JPC_CastShapeCollectorVTable.java │ ├── JPC_CollidePointCollectorVTable.java │ ├── JPC_CollidePointResult.java │ ├── JPC_CollideSettingsBase.java │ ├── JPC_CollideShapeBodyCollectorVTable.java │ ├── JPC_CollideShapeCollectorVTable.java │ ├── JPC_CollideShapeResult.java │ ├── JPC_CollideShapeSettings.java │ ├── JPC_CollisionCollector.java │ ├── JPC_CollisionGroup.java │ ├── JPC_ConstraintSettings.java │ ├── JPC_ContactListenerVTable.java │ ├── JPC_ContactManifold.java │ ├── JPC_ContactSettings.java │ ├── JPC_FixedConstraintSettings.java │ ├── JPC_FreeFunction.java │ ├── JPC_GJKClosestPoint.java │ ├── JPC_MassProperties.java │ ├── JPC_MotionProperties.java │ ├── JPC_MotorSettings.java │ ├── JPC_ObjectLayerFilterVTable.java │ ├── JPC_ObjectLayerPairFilterVTable.java │ ├── JPC_ObjectVsBroadPhaseLayerFilterVTable.java │ ├── JPC_OrientedBox.java │ ├── JPC_PhysicsSettings.java │ ├── JPC_PhysicsStepListenerVTable.java │ ├── JPC_PointConvexSupport.java │ ├── JPC_RRayCast.java │ ├── JPC_RayCast.java │ ├── JPC_RayCastBodyCollectorVTable.java │ ├── JPC_RayCastResult.java │ ├── JPC_RayCastSettings.java │ ├── JPC_ShapeCastResult.java │ ├── JPC_ShapeCastSettings.java │ ├── JPC_ShapeFilterVTable.java │ ├── JPC_ShapeResult.java │ ├── JPC_SubShapeIDCreator.java │ ├── JPC_SubShapeIDPair.java │ ├── JPC_SupportBuffer.java │ ├── JPC_TransformedShape.java │ ├── JPC_TransformedShapeCollectorVTable.java │ ├── JPC_TwoBodyConstraintSettings.java │ ├── JPJ_BodyActivationListener.java │ ├── JPJ_BodyFilter.java │ ├── JPJ_BroadPhaseLayerFilter.java │ ├── JPJ_BroadPhaseLayerInterface.java │ ├── JPJ_CastRayCollector.java │ ├── JPJ_CastShapeBodyCollector.java │ ├── JPJ_CastShapeCollector.java │ ├── JPJ_CollidePointCollector.java │ ├── JPJ_CollideShapeBodyCollector.java │ ├── JPJ_CollideShapeCollector.java │ ├── JPJ_ContactListener.java │ ├── JPJ_ObjectLayerFilter.java │ ├── JPJ_ObjectLayerPairFilter.java │ ├── JPJ_ObjectVsBroadPhaseLayerFilter.java │ ├── JPJ_PhysicsStepListener.java │ ├── JPJ_RayCastBodyCollector.java │ ├── JPJ_ShapeFilter.java │ ├── JPJ_TransformedShapeCollector.java │ ├── JoltPhysicsC.java │ ├── JoltPhysicsC_1.java │ ├── RuntimeHelper.java │ ├── __atomic_wide_counter.java │ ├── __compar_fn_t.java │ ├── __fsid_t.java │ ├── __once_flag.java │ ├── __pthread_cond_s.java │ ├── __pthread_internal_list.java │ ├── __pthread_internal_slist.java │ ├── __pthread_list_t.java │ ├── __pthread_mutex_s.java │ ├── __pthread_rwlock_arch_t.java │ ├── __pthread_slist_t.java │ ├── __sigset_t.java │ ├── at_quick_exit$__func.java │ ├── atexit$__func.java │ ├── constants$0.java │ ├── constants$1.java │ ├── constants$10.java │ ├── constants$100.java │ ├── constants$101.java │ ├── constants$102.java │ ├── constants$103.java │ ├── constants$104.java │ ├── constants$105.java │ ├── constants$106.java │ ├── constants$107.java │ ├── constants$108.java │ ├── constants$109.java │ ├── constants$11.java │ ├── constants$110.java │ ├── constants$111.java │ ├── constants$112.java │ ├── constants$113.java │ ├── constants$114.java │ ├── constants$115.java │ ├── constants$116.java │ ├── constants$117.java │ ├── constants$118.java │ ├── constants$119.java │ ├── constants$12.java │ ├── constants$120.java │ ├── constants$121.java │ ├── constants$122.java │ ├── constants$123.java │ ├── constants$124.java │ ├── constants$125.java │ ├── constants$126.java │ ├── constants$127.java │ ├── constants$128.java │ ├── constants$129.java │ ├── constants$13.java │ ├── constants$130.java │ ├── constants$131.java │ ├── constants$132.java │ ├── constants$133.java │ ├── constants$134.java │ ├── constants$135.java │ ├── constants$136.java │ ├── constants$14.java │ ├── constants$15.java │ ├── constants$16.java │ ├── constants$17.java │ ├── constants$18.java │ ├── constants$19.java │ ├── constants$2.java │ ├── constants$20.java │ ├── constants$21.java │ ├── constants$22.java │ ├── constants$23.java │ ├── constants$24.java │ ├── constants$25.java │ ├── constants$26.java │ ├── constants$27.java │ ├── constants$28.java │ ├── constants$29.java │ ├── constants$3.java │ ├── constants$30.java │ ├── constants$31.java │ ├── constants$32.java │ ├── constants$33.java │ ├── constants$34.java │ ├── constants$35.java │ ├── constants$36.java │ ├── constants$37.java │ ├── constants$38.java │ ├── constants$39.java │ ├── constants$4.java │ ├── constants$40.java │ ├── constants$41.java │ ├── constants$42.java │ ├── constants$43.java │ ├── constants$44.java │ ├── constants$45.java │ ├── constants$46.java │ ├── constants$47.java │ ├── constants$48.java │ ├── constants$49.java │ ├── constants$5.java │ ├── constants$50.java │ ├── constants$51.java │ ├── constants$52.java │ ├── constants$53.java │ ├── constants$54.java │ ├── constants$55.java │ ├── constants$56.java │ ├── constants$57.java │ ├── constants$58.java │ ├── constants$59.java │ ├── constants$6.java │ ├── constants$60.java │ ├── constants$61.java │ ├── constants$62.java │ ├── constants$63.java │ ├── constants$64.java │ ├── constants$65.java │ ├── constants$66.java │ ├── constants$67.java │ ├── constants$68.java │ ├── constants$69.java │ ├── constants$7.java │ ├── constants$70.java │ ├── constants$71.java │ ├── constants$72.java │ ├── constants$73.java │ ├── constants$74.java │ ├── constants$75.java │ ├── constants$76.java │ ├── constants$77.java │ ├── constants$78.java │ ├── constants$79.java │ ├── constants$8.java │ ├── constants$80.java │ ├── constants$81.java │ ├── constants$82.java │ ├── constants$83.java │ ├── constants$84.java │ ├── constants$85.java │ ├── constants$86.java │ ├── constants$87.java │ ├── constants$88.java │ ├── constants$89.java │ ├── constants$9.java │ ├── constants$90.java │ ├── constants$91.java │ ├── constants$92.java │ ├── constants$93.java │ ├── constants$94.java │ ├── constants$95.java │ ├── constants$96.java │ ├── constants$97.java │ ├── constants$98.java │ ├── constants$99.java │ ├── div_t.java │ ├── drand48_data.java │ ├── fd_set.java │ ├── fsid_t.java │ ├── ldiv_t.java │ ├── lldiv_t.java │ ├── on_exit$__func.java │ ├── pthread_attr_t.java │ ├── pthread_barrier_t.java │ ├── pthread_barrierattr_t.java │ ├── pthread_cond_t.java │ ├── pthread_condattr_t.java │ ├── pthread_mutex_t.java │ ├── pthread_mutexattr_t.java │ ├── pthread_rwlock_t.java │ ├── pthread_rwlockattr_t.java │ ├── random_data.java │ ├── sigset_t.java │ ├── timespec.java │ └── timeval.java │ ├── headers_d │ ├── Constants$root.java │ ├── JPC_AABox.java │ ├── JPC_AABoxCast.java │ ├── JPC_AlignedAllocateFunction.java │ ├── JPC_AlignedFreeFunction.java │ ├── JPC_AllocateFunction.java │ ├── JPC_Body.java │ ├── JPC_BodyActivationListenerVTable.java │ ├── JPC_BodyCreationSettings.java │ ├── JPC_BodyFilterVTable.java │ ├── JPC_BodyLockRead.java │ ├── JPC_BodyLockWrite.java │ ├── JPC_BroadPhaseCastResult.java │ ├── JPC_BroadPhaseLayerFilterVTable.java │ ├── JPC_BroadPhaseLayerInterfaceVTable.java │ ├── JPC_CastRayCollectorVTable.java │ ├── JPC_CastShapeBodyCollectorVTable.java │ ├── JPC_CastShapeCollectorVTable.java │ ├── JPC_CollidePointCollectorVTable.java │ ├── JPC_CollidePointResult.java │ ├── JPC_CollideSettingsBase.java │ ├── JPC_CollideShapeBodyCollectorVTable.java │ ├── JPC_CollideShapeCollectorVTable.java │ ├── JPC_CollideShapeResult.java │ ├── JPC_CollideShapeSettings.java │ ├── JPC_CollisionCollector.java │ ├── JPC_CollisionGroup.java │ ├── JPC_ConstraintSettings.java │ ├── JPC_ContactListenerVTable.java │ ├── JPC_ContactManifold.java │ ├── JPC_ContactSettings.java │ ├── JPC_FixedConstraintSettings.java │ ├── JPC_FreeFunction.java │ ├── JPC_GJKClosestPoint.java │ ├── JPC_MassProperties.java │ ├── JPC_MotionProperties.java │ ├── JPC_MotorSettings.java │ ├── JPC_ObjectLayerFilterVTable.java │ ├── JPC_ObjectLayerPairFilterVTable.java │ ├── JPC_ObjectVsBroadPhaseLayerFilterVTable.java │ ├── JPC_OrientedBox.java │ ├── JPC_PhysicsSettings.java │ ├── JPC_PhysicsStepListenerVTable.java │ ├── JPC_PointConvexSupport.java │ ├── JPC_RRayCast.java │ ├── JPC_RayCast.java │ ├── JPC_RayCastBodyCollectorVTable.java │ ├── JPC_RayCastResult.java │ ├── JPC_RayCastSettings.java │ ├── JPC_ShapeCastResult.java │ ├── JPC_ShapeCastSettings.java │ ├── JPC_ShapeFilterVTable.java │ ├── JPC_ShapeResult.java │ ├── JPC_SubShapeIDCreator.java │ ├── JPC_SubShapeIDPair.java │ ├── JPC_SupportBuffer.java │ ├── JPC_TransformedShape.java │ ├── JPC_TransformedShapeCollectorVTable.java │ ├── JPC_TwoBodyConstraintSettings.java │ ├── JPJ_BodyActivationListener.java │ ├── JPJ_BodyFilter.java │ ├── JPJ_BroadPhaseLayerFilter.java │ ├── JPJ_BroadPhaseLayerInterface.java │ ├── JPJ_CastRayCollector.java │ ├── JPJ_CastShapeBodyCollector.java │ ├── JPJ_CastShapeCollector.java │ ├── JPJ_CollidePointCollector.java │ ├── JPJ_CollideShapeBodyCollector.java │ ├── JPJ_CollideShapeCollector.java │ ├── JPJ_ContactListener.java │ ├── JPJ_ObjectLayerFilter.java │ ├── JPJ_ObjectLayerPairFilter.java │ ├── JPJ_ObjectVsBroadPhaseLayerFilter.java │ ├── JPJ_PhysicsStepListener.java │ ├── JPJ_RayCastBodyCollector.java │ ├── JPJ_ShapeFilter.java │ ├── JPJ_TransformedShapeCollector.java │ ├── JoltPhysicsC.java │ ├── JoltPhysicsC_1.java │ ├── RuntimeHelper.java │ ├── __atomic_wide_counter.java │ ├── __compar_fn_t.java │ ├── __fsid_t.java │ ├── __once_flag.java │ ├── __pthread_cond_s.java │ ├── __pthread_internal_list.java │ ├── __pthread_internal_slist.java │ ├── __pthread_list_t.java │ ├── __pthread_mutex_s.java │ ├── __pthread_rwlock_arch_t.java │ ├── __pthread_slist_t.java │ ├── __sigset_t.java │ ├── at_quick_exit$__func.java │ ├── atexit$__func.java │ ├── constants$0.java │ ├── constants$1.java │ ├── constants$10.java │ ├── constants$100.java │ ├── constants$101.java │ ├── constants$102.java │ ├── constants$103.java │ ├── constants$104.java │ ├── constants$105.java │ ├── constants$106.java │ ├── constants$107.java │ ├── constants$108.java │ ├── constants$109.java │ ├── constants$11.java │ ├── constants$110.java │ ├── constants$111.java │ ├── constants$112.java │ ├── constants$113.java │ ├── constants$114.java │ ├── constants$115.java │ ├── constants$116.java │ ├── constants$117.java │ ├── constants$118.java │ ├── constants$119.java │ ├── constants$12.java │ ├── constants$120.java │ ├── constants$121.java │ ├── constants$122.java │ ├── constants$123.java │ ├── constants$124.java │ ├── constants$125.java │ ├── constants$126.java │ ├── constants$127.java │ ├── constants$128.java │ ├── constants$129.java │ ├── constants$13.java │ ├── constants$130.java │ ├── constants$131.java │ ├── constants$132.java │ ├── constants$133.java │ ├── constants$134.java │ ├── constants$135.java │ ├── constants$136.java │ ├── constants$14.java │ ├── constants$15.java │ ├── constants$16.java │ ├── constants$17.java │ ├── constants$18.java │ ├── constants$19.java │ ├── constants$2.java │ ├── constants$20.java │ ├── constants$21.java │ ├── constants$22.java │ ├── constants$23.java │ ├── constants$24.java │ ├── constants$25.java │ ├── constants$26.java │ ├── constants$27.java │ ├── constants$28.java │ ├── constants$29.java │ ├── constants$3.java │ ├── constants$30.java │ ├── constants$31.java │ ├── constants$32.java │ ├── constants$33.java │ ├── constants$34.java │ ├── constants$35.java │ ├── constants$36.java │ ├── constants$37.java │ ├── constants$38.java │ ├── constants$39.java │ ├── constants$4.java │ ├── constants$40.java │ ├── constants$41.java │ ├── constants$42.java │ ├── constants$43.java │ ├── constants$44.java │ ├── constants$45.java │ ├── constants$46.java │ ├── constants$47.java │ ├── constants$48.java │ ├── constants$49.java │ ├── constants$5.java │ ├── constants$50.java │ ├── constants$51.java │ ├── constants$52.java │ ├── constants$53.java │ ├── constants$54.java │ ├── constants$55.java │ ├── constants$56.java │ ├── constants$57.java │ ├── constants$58.java │ ├── constants$59.java │ ├── constants$6.java │ ├── constants$60.java │ ├── constants$61.java │ ├── constants$62.java │ ├── constants$63.java │ ├── constants$64.java │ ├── constants$65.java │ ├── constants$66.java │ ├── constants$67.java │ ├── constants$68.java │ ├── constants$69.java │ ├── constants$7.java │ ├── constants$70.java │ ├── constants$71.java │ ├── constants$72.java │ ├── constants$73.java │ ├── constants$74.java │ ├── constants$75.java │ ├── constants$76.java │ ├── constants$77.java │ ├── constants$78.java │ ├── constants$79.java │ ├── constants$8.java │ ├── constants$80.java │ ├── constants$81.java │ ├── constants$82.java │ ├── constants$83.java │ ├── constants$84.java │ ├── constants$85.java │ ├── constants$86.java │ ├── constants$87.java │ ├── constants$88.java │ ├── constants$89.java │ ├── constants$9.java │ ├── constants$90.java │ ├── constants$91.java │ ├── constants$92.java │ ├── constants$93.java │ ├── constants$94.java │ ├── constants$95.java │ ├── constants$96.java │ ├── constants$97.java │ ├── constants$98.java │ ├── constants$99.java │ ├── div_t.java │ ├── drand48_data.java │ ├── fd_set.java │ ├── fsid_t.java │ ├── ldiv_t.java │ ├── lldiv_t.java │ ├── on_exit$__func.java │ ├── pthread_attr_t.java │ ├── pthread_barrier_t.java │ ├── pthread_barrierattr_t.java │ ├── pthread_cond_t.java │ ├── pthread_condattr_t.java │ ├── pthread_mutex_t.java │ ├── pthread_mutexattr_t.java │ ├── pthread_rwlock_t.java │ ├── pthread_rwlockattr_t.java │ ├── random_data.java │ ├── sigset_t.java │ ├── timespec.java │ └── timeval.java │ └── headers_f │ ├── Constants$root.java │ ├── JPC_AABox.java │ ├── JPC_AABoxCast.java │ ├── JPC_AlignedAllocateFunction.java │ ├── JPC_AlignedFreeFunction.java │ ├── JPC_AllocateFunction.java │ ├── JPC_Body.java │ ├── JPC_BodyActivationListenerVTable.java │ ├── JPC_BodyCreationSettings.java │ ├── JPC_BodyFilterVTable.java │ ├── JPC_BodyLockRead.java │ ├── JPC_BodyLockWrite.java │ ├── JPC_BroadPhaseCastResult.java │ ├── JPC_BroadPhaseLayerFilterVTable.java │ ├── JPC_BroadPhaseLayerInterfaceVTable.java │ ├── JPC_CastRayCollectorVTable.java │ ├── JPC_CastShapeBodyCollectorVTable.java │ ├── JPC_CastShapeCollectorVTable.java │ ├── JPC_CollidePointCollectorVTable.java │ ├── JPC_CollidePointResult.java │ ├── JPC_CollideSettingsBase.java │ ├── JPC_CollideShapeBodyCollectorVTable.java │ ├── JPC_CollideShapeCollectorVTable.java │ ├── JPC_CollideShapeResult.java │ ├── JPC_CollideShapeSettings.java │ ├── JPC_CollisionCollector.java │ ├── JPC_CollisionGroup.java │ ├── JPC_ConstraintSettings.java │ ├── JPC_ContactListenerVTable.java │ ├── JPC_ContactManifold.java │ ├── JPC_ContactSettings.java │ ├── JPC_FixedConstraintSettings.java │ ├── JPC_FreeFunction.java │ ├── JPC_GJKClosestPoint.java │ ├── JPC_MassProperties.java │ ├── JPC_MotionProperties.java │ ├── JPC_MotorSettings.java │ ├── JPC_ObjectLayerFilterVTable.java │ ├── JPC_ObjectLayerPairFilterVTable.java │ ├── JPC_ObjectVsBroadPhaseLayerFilterVTable.java │ ├── JPC_OrientedBox.java │ ├── JPC_PhysicsSettings.java │ ├── JPC_PhysicsStepListenerVTable.java │ ├── JPC_PointConvexSupport.java │ ├── JPC_RRayCast.java │ ├── JPC_RayCast.java │ ├── JPC_RayCastBodyCollectorVTable.java │ ├── JPC_RayCastResult.java │ ├── JPC_RayCastSettings.java │ ├── JPC_ShapeCastResult.java │ ├── JPC_ShapeCastSettings.java │ ├── JPC_ShapeFilterVTable.java │ ├── JPC_ShapeResult.java │ ├── JPC_SubShapeIDCreator.java │ ├── JPC_SubShapeIDPair.java │ ├── JPC_SupportBuffer.java │ ├── JPC_TransformedShape.java │ ├── JPC_TransformedShapeCollectorVTable.java │ ├── JPC_TwoBodyConstraintSettings.java │ ├── JPJ_BodyActivationListener.java │ ├── JPJ_BodyFilter.java │ ├── JPJ_BroadPhaseLayerFilter.java │ ├── JPJ_BroadPhaseLayerInterface.java │ ├── JPJ_CastRayCollector.java │ ├── JPJ_CastShapeBodyCollector.java │ ├── JPJ_CastShapeCollector.java │ ├── JPJ_CollidePointCollector.java │ ├── JPJ_CollideShapeBodyCollector.java │ ├── JPJ_CollideShapeCollector.java │ ├── JPJ_ContactListener.java │ ├── JPJ_ObjectLayerFilter.java │ ├── JPJ_ObjectLayerPairFilter.java │ ├── JPJ_ObjectVsBroadPhaseLayerFilter.java │ ├── JPJ_PhysicsStepListener.java │ ├── JPJ_RayCastBodyCollector.java │ ├── JPJ_ShapeFilter.java │ ├── JPJ_TransformedShapeCollector.java │ ├── JoltPhysicsC.java │ ├── JoltPhysicsC_1.java │ ├── RuntimeHelper.java │ ├── __atomic_wide_counter.java │ ├── __compar_fn_t.java │ ├── __fsid_t.java │ ├── __once_flag.java │ ├── __pthread_cond_s.java │ ├── __pthread_internal_list.java │ ├── __pthread_internal_slist.java │ ├── __pthread_list_t.java │ ├── __pthread_mutex_s.java │ ├── __pthread_rwlock_arch_t.java │ ├── __pthread_slist_t.java │ ├── __sigset_t.java │ ├── at_quick_exit$__func.java │ ├── atexit$__func.java │ ├── constants$0.java │ ├── constants$1.java │ ├── constants$10.java │ ├── constants$100.java │ ├── constants$101.java │ ├── constants$102.java │ ├── constants$103.java │ ├── constants$104.java │ ├── constants$105.java │ ├── constants$106.java │ ├── constants$107.java │ ├── constants$108.java │ ├── constants$109.java │ ├── constants$11.java │ ├── constants$110.java │ ├── constants$111.java │ ├── constants$112.java │ ├── constants$113.java │ ├── constants$114.java │ ├── constants$115.java │ ├── constants$116.java │ ├── constants$117.java │ ├── constants$118.java │ ├── constants$119.java │ ├── constants$12.java │ ├── constants$120.java │ ├── constants$121.java │ ├── constants$122.java │ ├── constants$123.java │ ├── constants$124.java │ ├── constants$125.java │ ├── constants$126.java │ ├── constants$127.java │ ├── constants$128.java │ ├── constants$129.java │ ├── constants$13.java │ ├── constants$130.java │ ├── constants$131.java │ ├── constants$132.java │ ├── constants$133.java │ ├── constants$134.java │ ├── constants$135.java │ ├── constants$136.java │ ├── constants$14.java │ ├── constants$15.java │ ├── constants$16.java │ ├── constants$17.java │ ├── constants$18.java │ ├── constants$19.java │ ├── constants$2.java │ ├── constants$20.java │ ├── constants$21.java │ ├── constants$22.java │ ├── constants$23.java │ ├── constants$24.java │ ├── constants$25.java │ ├── constants$26.java │ ├── constants$27.java │ ├── constants$28.java │ ├── constants$29.java │ ├── constants$3.java │ ├── constants$30.java │ ├── constants$31.java │ ├── constants$32.java │ ├── constants$33.java │ ├── constants$34.java │ ├── constants$35.java │ ├── constants$36.java │ ├── constants$37.java │ ├── constants$38.java │ ├── constants$39.java │ ├── constants$4.java │ ├── constants$40.java │ ├── constants$41.java │ ├── constants$42.java │ ├── constants$43.java │ ├── constants$44.java │ ├── constants$45.java │ ├── constants$46.java │ ├── constants$47.java │ ├── constants$48.java │ ├── constants$49.java │ ├── constants$5.java │ ├── constants$50.java │ ├── constants$51.java │ ├── constants$52.java │ ├── constants$53.java │ ├── constants$54.java │ ├── constants$55.java │ ├── constants$56.java │ ├── constants$57.java │ ├── constants$58.java │ ├── constants$59.java │ ├── constants$6.java │ ├── constants$60.java │ ├── constants$61.java │ ├── constants$62.java │ ├── constants$63.java │ ├── constants$64.java │ ├── constants$65.java │ ├── constants$66.java │ ├── constants$67.java │ ├── constants$68.java │ ├── constants$69.java │ ├── constants$7.java │ ├── constants$70.java │ ├── constants$71.java │ ├── constants$72.java │ ├── constants$73.java │ ├── constants$74.java │ ├── constants$75.java │ ├── constants$76.java │ ├── constants$77.java │ ├── constants$78.java │ ├── constants$79.java │ ├── constants$8.java │ ├── constants$80.java │ ├── constants$81.java │ ├── constants$82.java │ ├── constants$83.java │ ├── constants$84.java │ ├── constants$85.java │ ├── constants$86.java │ ├── constants$87.java │ ├── constants$88.java │ ├── constants$89.java │ ├── constants$9.java │ ├── constants$90.java │ ├── constants$91.java │ ├── constants$92.java │ ├── constants$93.java │ ├── constants$94.java │ ├── constants$95.java │ ├── constants$96.java │ ├── constants$97.java │ ├── constants$98.java │ ├── constants$99.java │ ├── div_t.java │ ├── drand48_data.java │ ├── fd_set.java │ ├── fsid_t.java │ ├── ldiv_t.java │ ├── lldiv_t.java │ ├── on_exit$__func.java │ ├── pthread_attr_t.java │ ├── pthread_barrier_t.java │ ├── pthread_barrierattr_t.java │ ├── pthread_cond_t.java │ ├── pthread_condattr_t.java │ ├── pthread_mutex_t.java │ ├── pthread_mutexattr_t.java │ ├── pthread_rwlock_t.java │ ├── pthread_rwlockattr_t.java │ ├── random_data.java │ ├── sigset_t.java │ ├── timespec.java │ └── timeval.java ├── jolt-java-natives-linux-x86 └── build.gradle.kts ├── jolt-java-natives-macos-x86 └── build.gradle.kts ├── jolt-java-natives-windows-x86 └── build.gradle.kts ├── settings.gradle.kts └── src ├── main └── java │ └── jolt │ ├── AddressedJoltNative.java │ ├── BaseJoltNative.java │ ├── Deletable.java │ ├── DeletableJoltNative.java │ ├── Jolt.java │ ├── JoltFeature.java │ ├── JoltFeatures.java │ ├── JoltNative.java │ ├── SegmentedJoltNative.java │ ├── UnimplementedException.java │ ├── core │ ├── JobSystem.java │ ├── Result.java │ ├── SharedMutex.java │ ├── TempAllocator.java │ └── package-info.java │ ├── geometry │ ├── AABox.java │ ├── AABoxCast.java │ ├── GJKClosestPoint.java │ ├── OrientedBox.java │ ├── PointConvexSupport.java │ └── package-info.java │ ├── math │ ├── DMat44.java │ ├── DVec3.java │ ├── FMat44.java │ ├── FVec3.java │ ├── Quat.java │ └── package-info.java │ ├── package-info.java │ └── physics │ ├── Activation.java │ ├── PhysicsSettings.java │ ├── PhysicsStepListener.java │ ├── PhysicsStepListenerFn.java │ ├── PhysicsSystem.java │ ├── body │ ├── Body.java │ ├── BodyActivationListener.java │ ├── BodyActivationListenerFn.java │ ├── BodyCreationSettings.java │ ├── BodyIds.java │ ├── BodyImpl.java │ ├── BodyInterface.java │ ├── BodyLock.java │ ├── BodyLockInterface.java │ ├── BodyLockRead.java │ ├── BodyLockWrite.java │ ├── MassProperties.java │ ├── MotionProperties.java │ ├── MotionPropertiesImpl.java │ ├── MotionQuality.java │ ├── MotionType.java │ ├── MutableBody.java │ ├── MutableMotionProperties.java │ ├── OverrideMassProperties.java │ └── package-info.java │ ├── collision │ ├── ActiveEdgeMode.java │ ├── BackFaceMode.java │ ├── BodyFilter.java │ ├── BodyFilterFn.java │ ├── BroadPhaseCastResult.java │ ├── CastRayCollector.java │ ├── CastRayCollectorFn.java │ ├── CollectFacesMode.java │ ├── CollidePointCollector.java │ ├── CollidePointCollectorFn.java │ ├── CollidePointResult.java │ ├── CollideSettingsBase.java │ ├── CollideShapeCollector.java │ ├── CollideShapeCollectorFn.java │ ├── CollideShapeResult.java │ ├── CollideShapeSettings.java │ ├── CollisionCollector.java │ ├── CollisionCollectorFn.java │ ├── CollisionGroup.java │ ├── ContactListener.java │ ├── ContactListenerFn.java │ ├── ContactManifold.java │ ├── ContactSettings.java │ ├── DRayCast.java │ ├── FRayCast.java │ ├── GroupFilter.java │ ├── NarrowPhaseQuery.java │ ├── ObjectLayerFilter.java │ ├── ObjectLayerFilterFn.java │ ├── ObjectLayerPairFilter.java │ ├── ObjectLayerPairFilterFn.java │ ├── PhysicsMaterial.java │ ├── RayCastResult.java │ ├── RayCastSettings.java │ ├── ShapeFilter.java │ ├── ShapeFilterFn.java │ ├── TransformedShape.java │ ├── TransformedShapeCollector.java │ ├── TransformedShapeCollectorFn.java │ ├── ValidateResult.java │ ├── broadphase │ │ ├── BroadPhaseLayerFilter.java │ │ ├── BroadPhaseLayerFilterFn.java │ │ ├── BroadPhaseLayerInterface.java │ │ ├── BroadPhaseLayerInterfaceFn.java │ │ ├── BroadPhaseQuery.java │ │ ├── CastShapeBodyCollector.java │ │ ├── CastShapeBodyCollectorFn.java │ │ ├── CollideShapeBodyCollector.java │ │ ├── CollideShapeBodyCollectorFn.java │ │ ├── ObjectVsBroadPhaseLayerFilter.java │ │ ├── ObjectVsBroadPhaseLayerFilterFn.java │ │ ├── RayCastBodyCollector.java │ │ ├── RayCastBodyCollectorFn.java │ │ └── package-info.java │ ├── package-info.java │ └── shape │ │ ├── BoxShape.java │ │ ├── BoxShapeSettings.java │ │ ├── CapsuleShape.java │ │ ├── CapsuleShapeSettings.java │ │ ├── CompoundShape.java │ │ ├── CompoundShapeSettings.java │ │ ├── ConvexHullShape.java │ │ ├── ConvexHullShapeSettings.java │ │ ├── ConvexShape.java │ │ ├── ConvexShapeSettings.java │ │ ├── CylinderShape.java │ │ ├── CylinderShapeSettings.java │ │ ├── DecoratedShape.java │ │ ├── DecoratedShapeSettings.java │ │ ├── HeightFieldMaterialIndices.java │ │ ├── HeightFieldSamples.java │ │ ├── HeightFieldShape.java │ │ ├── HeightFieldShapeSettings.java │ │ ├── MeshShape.java │ │ ├── MeshShapeSettings.java │ │ ├── MutableCompoundShape.java │ │ ├── MutableCompoundShapeSettings.java │ │ ├── OffsetCenterOfMassShape.java │ │ ├── OffsetCenterOfMassShapeSettings.java │ │ ├── RotatedTranslatedShape.java │ │ ├── RotatedTranslatedShapeSettings.java │ │ ├── ScaledShape.java │ │ ├── ScaledShapeSettings.java │ │ ├── Shape.java │ │ ├── ShapeResult.java │ │ ├── ShapeSettings.java │ │ ├── ShapeSubType.java │ │ ├── ShapeType.java │ │ ├── SphereShape.java │ │ ├── SphereShapeSettings.java │ │ ├── StaticCompoundShape.java │ │ ├── StaticCompoundShapeSettings.java │ │ ├── SubShapeIdPair.java │ │ ├── SubShapeIds.java │ │ ├── TaperedCapsuleShape.java │ │ ├── TaperedCapsuleShapeSettings.java │ │ ├── TriangleShape.java │ │ ├── TriangleShapeSettings.java │ │ └── package-info.java │ ├── constraint │ ├── Axis.java │ ├── ConeConstraint.java │ ├── ConeConstraintSettings.java │ ├── Constraint.java │ ├── ConstraintSettings.java │ ├── ConstraintSpace.java │ ├── ConstraintSubType.java │ ├── ConstraintType.java │ ├── DistanceConstraint.java │ ├── DistanceConstraintSettings.java │ ├── FixedConstraint.java │ ├── FixedConstraintSettings.java │ ├── HingeConstraint.java │ ├── HingeConstraintSettings.java │ ├── MotorSettings.java │ ├── MotorState.java │ ├── PathRotationConstraintType.java │ ├── PointConstraint.java │ ├── PointConstraintSettings.java │ ├── SixDOFConstraint.java │ ├── SixDOFConstraintSettings.java │ ├── SliderConstraint.java │ ├── SliderConstraintSettings.java │ ├── SwingTwistConstraint.java │ ├── SwingTwistConstraintSettings.java │ ├── TwoBodyConstraint.java │ └── TwoBodyConstraintSettings.java │ └── package-info.java └── test └── java └── jolt ├── HelloJolt.java ├── MemoriedTest.java ├── PhysicsSystemTest.java ├── TestBroadPhaseQuery.java ├── TestShape.java ├── TestShapeSettings.java └── Utils.java /JoltPhysicsC/Jolt/Core/FPFlushDenormals.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | #if defined(JPH_USE_SSE) 12 | 13 | /// Helper class that needs to be put on the stack to enable flushing denormals to zero 14 | /// This can make floating point operations much faster when working with very small numbers 15 | class FPFlushDenormals : public FPControlWord<_MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_MASK> { }; 16 | 17 | #elif defined(JPH_CPU_ARM) && defined(JPH_COMPILER_MSVC) 18 | 19 | class FPFlushDenormals : public FPControlWord<_DN_FLUSH, _MCW_DN> { }; 20 | 21 | #elif defined(JPH_CPU_ARM) 22 | 23 | /// Flush denormals to zero bit 24 | static constexpr uint64 FP_FZ = 1 << 24; 25 | 26 | /// Helper class that needs to be put on the stack to enable flushing denormals to zero 27 | /// This can make floating point operations much faster when working with very small numbers 28 | class FPFlushDenormals : public FPControlWord { }; 29 | 30 | #elif defined(JPH_CPU_WASM) 31 | 32 | // Not supported 33 | class FPFlushDenormals { }; 34 | 35 | #else 36 | 37 | #error Unsupported CPU architecture 38 | 39 | #endif 40 | 41 | JPH_NAMESPACE_END 42 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Core/IssueReporting.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | JPH_SUPPRESS_WARNINGS_STD_BEGIN 8 | #include 9 | JPH_SUPPRESS_WARNINGS_STD_END 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | static void DummyTrace([[maybe_unused]] const char *inFMT, ...) 14 | { 15 | JPH_ASSERT(false); 16 | }; 17 | 18 | TraceFunction Trace = DummyTrace; 19 | 20 | #ifdef JPH_ENABLE_ASSERTS 21 | 22 | static bool DummyAssertFailed(const char *inExpression, const char *inMessage, const char *inFile, uint inLine) 23 | { 24 | return true; // Trigger breakpoint 25 | }; 26 | 27 | AssertFailedFunction AssertFailed = DummyAssertFailed; 28 | 29 | #endif // JPH_ENABLE_ASSERTS 30 | 31 | JPH_NAMESPACE_END 32 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Core/LinearCurve.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | JPH_NAMESPACE_BEGIN 13 | 14 | JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(LinearCurve::Point) 15 | { 16 | JPH_ADD_ATTRIBUTE(Point, mX) 17 | JPH_ADD_ATTRIBUTE(Point, mY) 18 | } 19 | 20 | JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(LinearCurve) 21 | { 22 | JPH_ADD_ATTRIBUTE(LinearCurve, mPoints) 23 | } 24 | 25 | float LinearCurve::GetValue(float inX) const 26 | { 27 | if (mPoints.empty()) 28 | return 0.0f; 29 | 30 | Points::const_iterator i2 = lower_bound(mPoints.begin(), mPoints.end(), inX, [](const Point &inPoint, float inValue) { return inPoint.mX < inValue; }); 31 | 32 | if (i2 == mPoints.begin()) 33 | return mPoints.front().mY; 34 | else if (i2 == mPoints.end()) 35 | return mPoints.back().mY; 36 | 37 | Points::const_iterator i1 = i2 - 1; 38 | return i1->mY + (inX - i1->mX) * (i2->mY - i1->mY) / (i2->mX - i1->mX); 39 | } 40 | 41 | void LinearCurve::SaveBinaryState(StreamOut &inStream) const 42 | { 43 | inStream.Write(mPoints); 44 | } 45 | 46 | void LinearCurve::RestoreBinaryState(StreamIn &inStream) 47 | { 48 | inStream.Read(mPoints); 49 | } 50 | 51 | JPH_NAMESPACE_END 52 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Core/NonCopyable.h: -------------------------------------------------------------------------------- 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 makes another class non-copyable. Usage: Inherit from NonCopyable. 10 | class JPH_EXPORT NonCopyable 11 | { 12 | public: 13 | NonCopyable() = default; 14 | NonCopyable(const NonCopyable &) = delete; 15 | void operator = (const NonCopyable &) = delete; 16 | }; 17 | 18 | JPH_NAMESPACE_END 19 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Core/UnorderedMap.h: -------------------------------------------------------------------------------- 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_SUPPRESS_WARNINGS_STD_BEGIN 8 | #include 9 | JPH_SUPPRESS_WARNINGS_STD_END 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | template , class KeyEqual = std::equal_to> using UnorderedMap = std::unordered_map>>; 14 | 15 | JPH_NAMESPACE_END 16 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Core/UnorderedSet.h: -------------------------------------------------------------------------------- 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_SUPPRESS_WARNINGS_STD_BEGIN 8 | #include 9 | JPH_SUPPRESS_WARNINGS_STD_END 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | template , class KeyEqual = std::equal_to> using UnorderedSet = std::unordered_set>; 14 | 15 | JPH_NAMESPACE_END 16 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Geometry/Indexify.h: -------------------------------------------------------------------------------- 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 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | /// Take a list of triangles and get the unique set of vertices and use them to create indexed triangles. 13 | /// Vertices that are less than inVertexWeldDistance apart will be combined to a single vertex. 14 | JPH_EXPORT void Indexify(const TriangleList &inTriangles, VertexList &outVertices, IndexedTriangleList &outTriangles, float inVertexWeldDistance = 1.0e-4f); 15 | 16 | /// Take a list of indexed triangles and unpack them 17 | JPH_EXPORT void Deindexify(const VertexList &inVertices, const IndexedTriangleList &inTriangles, TriangleList &outTriangles); 18 | 19 | JPH_NAMESPACE_END 20 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Geometry/MortonCode.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | class MortonCode 12 | { 13 | public: 14 | /// First converts a floating point value in the range [0, 1] to a 10 bit fixed point integer. 15 | /// Then expands a 10-bit integer into 30 bits by inserting 2 zeros after each bit. 16 | static uint32 sExpandBits(float inV) 17 | { 18 | JPH_ASSERT(inV >= 0.0f && inV <= 1.0f); 19 | uint32 v = uint32(inV * 1023.0f + 0.5f); 20 | JPH_ASSERT(v < 1024); 21 | v = (v * 0x00010001u) & 0xFF0000FFu; 22 | v = (v * 0x00000101u) & 0x0F00F00Fu; 23 | v = (v * 0x00000011u) & 0xC30C30C3u; 24 | v = (v * 0x00000005u) & 0x49249249u; 25 | return v; 26 | } 27 | 28 | /// Calculate the morton code for inVector, given that all vectors lie in inVectorBounds 29 | static uint32 sGetMortonCode(Vec3Arg inVector, const AABox &inVectorBounds) 30 | { 31 | // Convert to 10 bit fixed point 32 | Vec3 scaled = (inVector - inVectorBounds.mMin) / inVectorBounds.GetSize(); 33 | uint x = sExpandBits(scaled.GetX()); 34 | uint y = sExpandBits(scaled.GetY()); 35 | uint z = sExpandBits(scaled.GetZ()); 36 | return (x << 2) + (y << 1) + z; 37 | } 38 | }; 39 | 40 | JPH_NAMESPACE_END 41 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Geometry/Triangle.h: -------------------------------------------------------------------------------- 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 | /// A simple triangle and its material 10 | class Triangle 11 | { 12 | public: 13 | JPH_OVERRIDE_NEW_DELETE 14 | 15 | /// Constructor 16 | Triangle() = default; 17 | Triangle(const Float3 &inV1, const Float3 &inV2, const Float3 &inV3) : mV { inV1, inV2, inV3 } { } 18 | Triangle(const Float3 &inV1, const Float3 &inV2, const Float3 &inV3, uint32 inMaterialIndex) : Triangle(inV1, inV2, inV3) { mMaterialIndex = inMaterialIndex; } 19 | Triangle(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3) { inV1.StoreFloat3(&mV[0]); inV2.StoreFloat3(&mV[1]); inV3.StoreFloat3(&mV[2]); } 20 | 21 | /// Get center of triangle 22 | Vec3 GetCentroid() const 23 | { 24 | return (Vec3::sLoadFloat3Unsafe(mV[0]) + Vec3::sLoadFloat3Unsafe(mV[1]) + Vec3::sLoadFloat3Unsafe(mV[2])) * (1.0f / 3.0f); 25 | } 26 | 27 | /// Vertices 28 | Float3 mV[3]; 29 | uint32 mMaterialIndex = 0; ///< Follows mV[3] so that we can read mV as 4 vectors 30 | }; 31 | 32 | using TriangleList = Array; 33 | 34 | JPH_NAMESPACE_END 35 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Jolt.h: -------------------------------------------------------------------------------- 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 | // Project includes 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/Double3.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Class that holds 3 doubles. Used as a storage class. Convert to DVec3 for calculations. 12 | class [[nodiscard]] Double3 13 | { 14 | public: 15 | JPH_OVERRIDE_NEW_DELETE 16 | 17 | Double3() = default; ///< Intentionally not initialized for performance reasons 18 | Double3(const Double3 &inRHS) = default; 19 | Double3(double inX, double inY, double inZ) : x(inX), y(inY), z(inZ) { } 20 | 21 | double operator [] (int inCoordinate) const 22 | { 23 | JPH_ASSERT(inCoordinate < 3); 24 | return *(&x + inCoordinate); 25 | } 26 | 27 | bool operator == (const Double3 &inRHS) const 28 | { 29 | return x == inRHS.x && y == inRHS.y && z == inRHS.z; 30 | } 31 | 32 | bool operator != (const Double3 &inRHS) const 33 | { 34 | return x != inRHS.x || y != inRHS.y || z != inRHS.z; 35 | } 36 | 37 | double x; 38 | double y; 39 | double z; 40 | }; 41 | 42 | static_assert(is_trivial(), "Is supposed to be a trivial type!"); 43 | 44 | JPH_NAMESPACE_END 45 | 46 | // Create a std::hash for Double3 47 | JPH_MAKE_HASHABLE(JPH::Double3, t.x, t.y, t.z) 48 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/DynMatrix.h: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2022 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #pragma once 6 | 7 | JPH_NAMESPACE_BEGIN 8 | 9 | /// Dynamic resizable matrix class 10 | class [[nodiscard]] DynMatrix 11 | { 12 | public: 13 | /// Constructor 14 | DynMatrix(const DynMatrix &) = default; 15 | DynMatrix(uint inRows, uint inCols) : mRows(inRows), mCols(inCols) { mElements.resize(inRows * inCols); } 16 | 17 | /// Access an element 18 | float operator () (uint inRow, uint inCol) const { JPH_ASSERT(inRow < mRows && inCol < mCols); return mElements[inRow * mCols + inCol]; } 19 | float & operator () (uint inRow, uint inCol) { JPH_ASSERT(inRow < mRows && inCol < mCols); return mElements[inRow * mCols + inCol]; } 20 | 21 | /// Get dimensions 22 | uint GetCols() const { return mCols; } 23 | uint GetRows() const { return mRows; } 24 | 25 | private: 26 | uint mRows; 27 | uint mCols; 28 | Array mElements; 29 | }; 30 | 31 | JPH_NAMESPACE_END 32 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/FindRoot.h: -------------------------------------------------------------------------------- 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 | /// Find the roots of \f$inA \: x^2 + inB \: x + inC = 0\f$. 10 | /// @return The number of roots, actual roots in outX1 and outX2. 11 | /// If number of roots returned is 1 then outX1 == outX2. 12 | template 13 | inline int FindRoot(const T inA, const T inB, const T inC, T &outX1, T &outX2) 14 | { 15 | // Check if this is a linear equation 16 | if (inA == T(0)) 17 | { 18 | // Check if this is a constant equation 19 | if (inB == T(0)) 20 | return 0; 21 | 22 | // Linear equation with 1 solution 23 | outX1 = outX2 = -inC / inB; 24 | return 1; 25 | } 26 | 27 | // See Numerical Recipes in C, Chapter 5.6 Quadratic and Cubic Equations 28 | T det = Square(inB) - T(4) * inA * inC; 29 | if (det < T(0)) 30 | return 0; 31 | T q = (inB + Sign(inB) * sqrt(det)) / T(-2); 32 | outX1 = q / inA; 33 | if (q == T(0)) 34 | { 35 | outX2 = outX1; 36 | return 1; 37 | } 38 | outX2 = inC / q; 39 | return 2; 40 | } 41 | 42 | JPH_NAMESPACE_END 43 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/Float2.h: -------------------------------------------------------------------------------- 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 2 floats, used as a storage class mainly. 10 | class [[nodiscard]] Float2 11 | { 12 | public: 13 | JPH_OVERRIDE_NEW_DELETE 14 | 15 | Float2() = default; ///< Intentionally not initialized for performance reasons 16 | Float2(const Float2 &inRHS) = default; 17 | Float2(float inX, float inY) : x(inX), y(inY) { } 18 | 19 | bool operator == (const Float2 &inRHS) const { return x == inRHS.x && y == inRHS.y; } 20 | bool operator != (const Float2 &inRHS) const { return x != inRHS.x || y != inRHS.y; } 21 | 22 | /// To String 23 | friend ostream & operator << (ostream &inStream, const Float2 &inV) 24 | { 25 | inStream << inV.x << ", " << inV.y; 26 | return inStream; 27 | } 28 | 29 | float x; 30 | float y; 31 | }; 32 | 33 | static_assert(is_trivial(), "Is supposed to be a trivial type!"); 34 | 35 | JPH_NAMESPACE_END 36 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/Float3.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations. 12 | class [[nodiscard]] Float3 13 | { 14 | public: 15 | JPH_OVERRIDE_NEW_DELETE 16 | 17 | Float3() = default; ///< Intentionally not initialized for performance reasons 18 | Float3(const Float3 &inRHS) = default; 19 | Float3(float inX, float inY, float inZ) : x(inX), y(inY), z(inZ) { } 20 | 21 | float operator [] (int inCoordinate) const 22 | { 23 | JPH_ASSERT(inCoordinate < 3); 24 | return *(&x + inCoordinate); 25 | } 26 | 27 | bool operator == (const Float3 &inRHS) const 28 | { 29 | return x == inRHS.x && y == inRHS.y && z == inRHS.z; 30 | } 31 | 32 | bool operator != (const Float3 &inRHS) const 33 | { 34 | return x != inRHS.x || y != inRHS.y || z != inRHS.z; 35 | } 36 | 37 | float x; 38 | float y; 39 | float z; 40 | }; 41 | 42 | using VertexList = Array; 43 | 44 | static_assert(is_trivial(), "Is supposed to be a trivial type!"); 45 | 46 | JPH_NAMESPACE_END 47 | 48 | // Create a std::hash for Float3 49 | JPH_MAKE_HASHABLE(JPH::Float3, t.x, t.y, t.z) 50 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/Float4.h: -------------------------------------------------------------------------------- 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(is_trivial(), "Is supposed to be a trivial type!"); 32 | 33 | JPH_NAMESPACE_END 34 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/MathTypes.h: -------------------------------------------------------------------------------- 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 Vec3; 10 | class DVec3; 11 | class Vec4; 12 | class UVec4; 13 | class Vec8; 14 | class UVec8; 15 | class Quat; 16 | class Mat44; 17 | class DMat44; 18 | 19 | // Types to use for passing arguments to functions 20 | using Vec3Arg = Vec3; 21 | #ifdef JPH_USE_AVX 22 | using DVec3Arg = DVec3; 23 | #else 24 | using DVec3Arg = const DVec3 &; 25 | #endif 26 | using Vec4Arg = Vec4; 27 | using UVec4Arg = UVec4; 28 | using Vec8Arg = Vec8; 29 | using UVec8Arg = UVec8; 30 | using QuatArg = Quat; 31 | using Mat44Arg = const Mat44 &; 32 | using DMat44Arg = const DMat44 &; 33 | 34 | JPH_NAMESPACE_END 35 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/Real.h: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2022 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | #ifdef JPH_DOUBLE_PRECISION 13 | 14 | // Define real to double 15 | using Real = double; 16 | using Real3 = Double3; 17 | using RVec3 = DVec3; 18 | using RVec3Arg = DVec3Arg; 19 | using RMat44 = DMat44; 20 | using RMat44Arg = DMat44Arg; 21 | 22 | #define JPH_RVECTOR_ALIGNMENT JPH_DVECTOR_ALIGNMENT 23 | 24 | #else 25 | 26 | // Define real to float 27 | using Real = float; 28 | using Real3 = Float3; 29 | using RVec3 = Vec3; 30 | using RVec3Arg = Vec3Arg; 31 | using RMat44 = Mat44; 32 | using RMat44Arg = Mat44Arg; 33 | 34 | #define JPH_RVECTOR_ALIGNMENT JPH_VECTOR_ALIGNMENT 35 | 36 | #endif // JPH_DOUBLE_PRECISION 37 | 38 | // Put the 'real' operator in a namespace so that users can opt in to use it: 39 | // using namespace JPH::literals; 40 | namespace literals { 41 | constexpr Real operator "" _r (long double inValue) { return Real(inValue); } 42 | }; 43 | 44 | JPH_NAMESPACE_END 45 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/Swizzle.h: -------------------------------------------------------------------------------- 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 | /// Enum indicating which component to use when swizzling 10 | enum 11 | { 12 | SWIZZLE_X = 0, ///< Use the X component 13 | SWIZZLE_Y = 1, ///< Use the Y component 14 | SWIZZLE_Z = 2, ///< Use the Z component 15 | SWIZZLE_W = 3, ///< Use the W component 16 | SWIZZLE_UNUSED = 2, ///< We always use the Z component when we don't specifically want to initialize a value, this is consistent with what is done in Vec3(x, y, z), Vec3(Float3 &) and Vec3::sLoadFloat3Unsafe 17 | }; 18 | 19 | JPH_NAMESPACE_END 20 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Math/UVec4.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | JPH_NAMESPACE_BEGIN 8 | 9 | // Table that shifts vector components by 4 - X floats to the left 10 | const UVec4 UVec4::sFourMinusXShuffle[5] = 11 | { 12 | UVec4(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), 13 | UVec4(0x0f0e0d0c, 0xffffffff, 0xffffffff, 0xffffffff), 14 | UVec4(0x0b0a0908, 0x0f0e0d0c, 0xffffffff, 0xffffffff), 15 | UVec4(0x07060504, 0x0b0a0908, 0x0f0e0d0c, 0xffffffff), 16 | UVec4(0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c) 17 | }; 18 | 19 | JPH_NAMESPACE_END 20 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/ObjectStream/GetPrimitiveTypeOfType.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Helper functions to get the underlying RTTI type of a type (so e.g. Array will return sometype) 12 | template 13 | const RTTI *GetPrimitiveTypeOfType(T *) 14 | { 15 | return GetRTTIOfType((T *)nullptr); 16 | } 17 | 18 | template 19 | const RTTI *GetPrimitiveTypeOfType(T **) 20 | { 21 | return GetRTTIOfType((T *)nullptr); 22 | } 23 | 24 | template 25 | const RTTI *GetPrimitiveTypeOfType(Ref *) 26 | { 27 | return GetRTTIOfType((T *)nullptr); 28 | } 29 | 30 | template 31 | const RTTI *GetPrimitiveTypeOfType(RefConst *) 32 | { 33 | return GetRTTIOfType((T *)nullptr); 34 | } 35 | 36 | template 37 | const RTTI *GetPrimitiveTypeOfType(Array *) 38 | { 39 | return GetPrimitiveTypeOfType((T *)nullptr); 40 | } 41 | 42 | template 43 | const RTTI *GetPrimitiveTypeOfType(StaticArray *) 44 | { 45 | return GetPrimitiveTypeOfType((T *)nullptr); 46 | } 47 | 48 | template 49 | const RTTI *GetPrimitiveTypeOfType(T (*)[N]) 50 | { 51 | return GetPrimitiveTypeOfType((T *)nullptr); 52 | } 53 | 54 | JPH_NAMESPACE_END 55 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/ObjectStream/ObjectStream.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | // Define macro to declare functions for a specific primitive type 12 | #define JPH_DECLARE_PRIMITIVE(name) \ 13 | bool OSIsType(name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \ 14 | { \ 15 | return inArrayDepth == 0 && inDataType == EOSDataType::T_##name; \ 16 | } \ 17 | bool OSReadData(IObjectStreamIn &ioStream, name &outPrimitive) \ 18 | { \ 19 | return ioStream.ReadPrimitiveData(outPrimitive); \ 20 | } \ 21 | void OSWriteDataType(IObjectStreamOut &ioStream, name *) \ 22 | { \ 23 | ioStream.WriteDataType(EOSDataType::T_##name); \ 24 | } \ 25 | void OSWriteData(IObjectStreamOut &ioStream, const name &inPrimitive) \ 26 | { \ 27 | ioStream.HintNextItem(); \ 28 | ioStream.WritePrimitiveData(inPrimitive); \ 29 | } 30 | 31 | // This file uses the JPH_DECLARE_PRIMITIVE macro to define all types 32 | #include 33 | 34 | JPH_NAMESPACE_END 35 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTypes.h: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | // Note: Order is important, an enum is created and its value is stored in a binary stream! 6 | JPH_DECLARE_PRIMITIVE(uint8) 7 | JPH_DECLARE_PRIMITIVE(uint16) 8 | JPH_DECLARE_PRIMITIVE(int) 9 | JPH_DECLARE_PRIMITIVE(uint32) 10 | JPH_DECLARE_PRIMITIVE(uint64) 11 | JPH_DECLARE_PRIMITIVE(float) 12 | JPH_DECLARE_PRIMITIVE(bool) 13 | JPH_DECLARE_PRIMITIVE(String) 14 | JPH_DECLARE_PRIMITIVE(Float3) 15 | JPH_DECLARE_PRIMITIVE(Vec3) 16 | JPH_DECLARE_PRIMITIVE(Vec4) 17 | JPH_DECLARE_PRIMITIVE(Quat) 18 | JPH_DECLARE_PRIMITIVE(Mat44) 19 | JPH_DECLARE_PRIMITIVE(double) 20 | JPH_DECLARE_PRIMITIVE(DVec3) 21 | JPH_DECLARE_PRIMITIVE(DMat44) 22 | JPH_DECLARE_PRIMITIVE(Double3) 23 | 24 | #undef JPH_DECLARE_PRIMITIVE 25 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/ObjectStream/SerializableObject.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT(SerializableObject) 12 | { 13 | } 14 | 15 | JPH_NAMESPACE_END 16 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Body/BodyAccess.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | #ifdef JPH_ENABLE_ASSERTS 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | thread_local BodyAccess::EAccess BodyAccess::sVelocityAccess = BodyAccess::EAccess::ReadWrite; 14 | thread_local BodyAccess::EAccess BodyAccess::sPositionAccess = BodyAccess::EAccess::ReadWrite; 15 | 16 | JPH_NAMESPACE_END 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Body/BodyAccess.h: -------------------------------------------------------------------------------- 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 | #ifdef JPH_ENABLE_ASSERTS 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | class BodyAccess 12 | { 13 | public: 14 | /// Access rules, used to detect race conditions during simulation 15 | enum class EAccess : uint8 16 | { 17 | None = 0, 18 | Read = 1, 19 | ReadWrite = 3, 20 | }; 21 | 22 | /// Grant a scope specific access rights on the current thread 23 | class Grant 24 | { 25 | public: 26 | inline Grant(EAccess inVelocity, EAccess inPosition) 27 | { 28 | JPH_ASSERT(sVelocityAccess == EAccess::ReadWrite); 29 | JPH_ASSERT(sPositionAccess == EAccess::ReadWrite); 30 | 31 | sVelocityAccess = inVelocity; 32 | sPositionAccess = inPosition; 33 | } 34 | 35 | inline ~Grant() 36 | { 37 | sVelocityAccess = EAccess::ReadWrite; 38 | sPositionAccess = EAccess::ReadWrite; 39 | } 40 | }; 41 | 42 | /// Check if we have permission 43 | static bool sCheckRights(EAccess inRights, EAccess inDesiredRights) 44 | { 45 | return (uint8(inRights) & uint8(inDesiredRights)) == uint8(inDesiredRights); 46 | } 47 | 48 | // Various permissions that can be granted 49 | static thread_local EAccess sVelocityAccess; 50 | static thread_local EAccess sPositionAccess; 51 | }; 52 | 53 | JPH_NAMESPACE_END 54 | 55 | #endif // JPH_ENABLE_ASSERTS 56 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Body/BodyActivationListener.h: -------------------------------------------------------------------------------- 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 BodyID; 10 | 11 | /// A listener class that receives events when a body activates or deactivates. 12 | /// It can be registered with the BodyManager (or PhysicsSystem). 13 | class BodyActivationListener 14 | { 15 | public: 16 | /// Ensure virtual destructor 17 | virtual ~BodyActivationListener() = default; 18 | 19 | /// Called whenever a body activates, note this can be called from any thread so make sure your code is thread safe. 20 | /// At the time of the callback the body inBodyID will be locked and no bodies can be written/activated/deactivated from the callback. 21 | virtual void OnBodyActivated(const BodyID &inBodyID, uint64 inBodyUserData) = 0; 22 | 23 | /// Called whenever a body deactivates, note this can be called from any thread so make sure your code is thread safe. 24 | /// At the time of the callback the body inBodyID will be locked and no bodies can be written/activated/deactivated from the callback. 25 | virtual void OnBodyDeactivated(const BodyID &inBodyID, uint64 inBodyUserData) = 0; 26 | }; 27 | 28 | JPH_NAMESPACE_END 29 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Body/BodyPair.h: -------------------------------------------------------------------------------- 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 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | /// Structure that holds a body pair 13 | struct alignas(uint64) BodyPair 14 | { 15 | JPH_OVERRIDE_NEW_DELETE 16 | 17 | /// Constructor 18 | BodyPair() = default; 19 | BodyPair(BodyID inA, BodyID inB) : mBodyA(inA), mBodyB(inB) { } 20 | 21 | /// Equals operator 22 | bool operator == (const BodyPair &inRHS) const { return *reinterpret_cast(this) == *reinterpret_cast(&inRHS); } 23 | 24 | /// Smaller than operator, used for consistently ordering body pairs 25 | bool operator < (const BodyPair &inRHS) const { return *reinterpret_cast(this) < *reinterpret_cast(&inRHS); } 26 | 27 | /// Get the hash value of this object 28 | uint64 GetHash() const { return Hash64(*reinterpret_cast(this)); } 29 | 30 | BodyID mBodyA; 31 | BodyID mBodyB; 32 | }; 33 | 34 | static_assert(sizeof(BodyPair) == sizeof(uint64), "Mismatch in class size"); 35 | 36 | JPH_NAMESPACE_END 37 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Body/MotionType.h: -------------------------------------------------------------------------------- 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 | /// Motion type of a physics body 10 | enum class EMotionType : uint8 11 | { 12 | Static, ///< Non movable 13 | Kinematic, ///< Movable using velocities only, does not respond to forces 14 | Dynamic, ///< Responds to forces as a normal physics object 15 | }; 16 | 17 | JPH_NAMESPACE_END 18 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/AABoxCast.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Structure that holds AABox moving linearly through 3d space 12 | struct AABoxCast 13 | { 14 | JPH_OVERRIDE_NEW_DELETE 15 | 16 | AABox mBox; ///< Axis aligned box at starting location 17 | Vec3 mDirection; ///< Direction and length of the cast (anything beyond this length will not be reported as a hit) 18 | }; 19 | 20 | JPH_NAMESPACE_END 21 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/ActiveEdgeMode.h: -------------------------------------------------------------------------------- 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 | /// How to treat active/inactive edges. 10 | /// An active edge is an edge that either has no neighbouring edge or if the angle between the two connecting faces is too large, see: ActiveEdges 11 | enum class EActiveEdgeMode : uint8 12 | { 13 | CollideOnlyWithActive, ///< Do not collide with inactive edges. For physics simulation, this gives less ghost collisions. 14 | CollideWithAll, ///< Collide with all edges. Use this when you're interested in all collisions. 15 | }; 16 | 17 | JPH_NAMESPACE_END 18 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/BackFaceMode.h: -------------------------------------------------------------------------------- 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 | /// How collision detection functions will treat back facing triangles 10 | enum class EBackFaceMode : uint8 11 | { 12 | IgnoreBackFaces, ///< Ignore collision with back facing surfaces/triangles 13 | CollideWithBackFaces, ///< Collide with back facing surfaces/triangles 14 | }; 15 | 16 | JPH_NAMESPACE_END 17 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhase.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | void BroadPhase::Init(BodyManager *inBodyManager, const BroadPhaseLayerInterface &inLayerInterface) 12 | { 13 | mBodyManager = inBodyManager; 14 | } 15 | 16 | JPH_NAMESPACE_END 17 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/CastResult.h: -------------------------------------------------------------------------------- 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 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | /// Structure that holds a ray cast or other object cast hit 13 | class BroadPhaseCastResult 14 | { 15 | public: 16 | JPH_OVERRIDE_NEW_DELETE 17 | 18 | /// Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. For rays/cast shapes we can just use the collision fraction. 19 | inline float GetEarlyOutFraction() const { return mFraction; } 20 | 21 | BodyID mBodyID; ///< Body that was hit 22 | float mFraction = 1.0f + FLT_EPSILON; ///< Hit fraction of the ray/object [0, 1], HitPoint = Start + mFraction * (End - Start) 23 | }; 24 | 25 | /// Specialization of cast result against a shape 26 | class RayCastResult : public BroadPhaseCastResult 27 | { 28 | public: 29 | JPH_OVERRIDE_NEW_DELETE 30 | 31 | SubShapeID mSubShapeID2; ///< Sub shape ID of shape that we collided against 32 | }; 33 | 34 | JPH_NAMESPACE_END 35 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/CollectFacesMode.h: -------------------------------------------------------------------------------- 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 | /// Whether or not to collect faces, used by CastShape and CollideShape 10 | enum class ECollectFacesMode : uint8 11 | { 12 | CollectFaces, ///< mShape1/2Face is desired 13 | NoFaces ///< mShape1/2Face is not desired 14 | }; 15 | 16 | JPH_NAMESPACE_END 17 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/CollidePointResult.h: -------------------------------------------------------------------------------- 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 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | /// Structure that holds the result of colliding a point against a shape 13 | class CollidePointResult 14 | { 15 | public: 16 | JPH_OVERRIDE_NEW_DELETE 17 | 18 | /// Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. For point queries there is no sensible return value. 19 | inline float GetEarlyOutFraction() const { return 0.0f; } 20 | 21 | BodyID mBodyID; ///< Body that was hit 22 | SubShapeID mSubShapeID2; ///< Sub shape ID of shape that we collided against 23 | }; 24 | 25 | JPH_NAMESPACE_END 26 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/CollisionGroup.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | JPH_NAMESPACE_BEGIN 13 | 14 | JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(CollisionGroup) 15 | { 16 | JPH_ADD_ATTRIBUTE(CollisionGroup, mGroupFilter) 17 | JPH_ADD_ATTRIBUTE(CollisionGroup, mGroupID) 18 | JPH_ADD_ATTRIBUTE(CollisionGroup, mSubGroupID) 19 | } 20 | 21 | void CollisionGroup::SaveBinaryState(StreamOut &inStream) const 22 | { 23 | inStream.Write(mGroupID); 24 | inStream.Write(mSubGroupID); 25 | } 26 | 27 | void CollisionGroup::RestoreBinaryState(StreamIn &inStream) 28 | { 29 | inStream.Read(mGroupID); 30 | inStream.Read(mSubGroupID); 31 | } 32 | 33 | JPH_NAMESPACE_END 34 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/GroupFilter.h: -------------------------------------------------------------------------------- 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 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | class CollisionGroup; 13 | class StreamIn; 14 | class StreamOut; 15 | 16 | /// Abstract class that checks if two CollisionGroups collide 17 | class JPH_EXPORT GroupFilter : public SerializableObject, public RefTarget 18 | { 19 | public: 20 | JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, GroupFilter) 21 | 22 | /// Virtual destructor 23 | virtual ~GroupFilter() override = default; 24 | 25 | /// Check if two groups collide 26 | virtual bool CanCollide(const CollisionGroup &inGroup1, const CollisionGroup &inGroup2) const = 0; 27 | 28 | /// Saves the contents of the group filter in binary form to inStream. 29 | virtual void SaveBinaryState(StreamOut &inStream) const; 30 | 31 | using GroupFilterResult = Result>; 32 | 33 | /// Creates a GroupFilter of the correct type and restores its contents from the binary stream inStream. 34 | static GroupFilterResult sRestoreFromBinaryState(StreamIn &inStream); 35 | 36 | protected: 37 | /// This function should not be called directly, it is used by sRestoreFromBinaryState. 38 | virtual void RestoreBinaryState(StreamIn &inStream); 39 | }; 40 | 41 | JPH_NAMESPACE_END 42 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/GroupFilterTable.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | JPH_NAMESPACE_BEGIN 13 | 14 | JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(GroupFilterTable) 15 | { 16 | JPH_ADD_BASE_CLASS(GroupFilterTable, GroupFilter) 17 | 18 | JPH_ADD_ATTRIBUTE(GroupFilterTable, mNumSubGroups) 19 | JPH_ADD_ATTRIBUTE(GroupFilterTable, mTable) 20 | } 21 | 22 | void GroupFilterTable::SaveBinaryState(StreamOut &inStream) const 23 | { 24 | GroupFilter::SaveBinaryState(inStream); 25 | 26 | inStream.Write(mNumSubGroups); 27 | inStream.Write(mTable); 28 | } 29 | 30 | void GroupFilterTable::RestoreBinaryState(StreamIn &inStream) 31 | { 32 | GroupFilter::RestoreBinaryState(inStream); 33 | 34 | inStream.Read(mNumSubGroups); 35 | inStream.Read(mTable); 36 | } 37 | 38 | JPH_NAMESPACE_END 39 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterialSimple.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | JPH_NAMESPACE_BEGIN 13 | 14 | JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(PhysicsMaterialSimple) 15 | { 16 | JPH_ADD_BASE_CLASS(PhysicsMaterialSimple, PhysicsMaterial) 17 | 18 | JPH_ADD_ATTRIBUTE(PhysicsMaterialSimple, mDebugName) 19 | JPH_ADD_ATTRIBUTE(PhysicsMaterialSimple, mDebugColor) 20 | } 21 | 22 | void PhysicsMaterialSimple::SaveBinaryState(StreamOut &inStream) const 23 | { 24 | PhysicsMaterial::SaveBinaryState(inStream); 25 | 26 | inStream.Write(mDebugName); 27 | inStream.Write(mDebugColor); 28 | } 29 | 30 | void PhysicsMaterialSimple::RestoreBinaryState(StreamIn &inStream) 31 | { 32 | PhysicsMaterial::RestoreBinaryState(inStream); 33 | 34 | inStream.Read(mDebugName); 35 | inStream.Read(mDebugColor); 36 | } 37 | 38 | JPH_NAMESPACE_END 39 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterialSimple.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Sample implementation of PhysicsMaterial that just holds the needed properties directly 12 | class JPH_EXPORT PhysicsMaterialSimple : public PhysicsMaterial 13 | { 14 | public: 15 | JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PhysicsMaterialSimple) 16 | 17 | /// Constructor 18 | PhysicsMaterialSimple() = default; 19 | PhysicsMaterialSimple(const string_view &inName, ColorArg inColor) : mDebugName(inName), mDebugColor(inColor) { } 20 | 21 | // Properties 22 | virtual const char * GetDebugName() const override { return mDebugName.c_str(); } 23 | virtual Color GetDebugColor() const override { return mDebugColor; } 24 | 25 | // See: PhysicsMaterial::SaveBinaryState 26 | virtual void SaveBinaryState(StreamOut &inStream) const override; 27 | 28 | protected: 29 | // See: PhysicsMaterial::RestoreBinaryState 30 | virtual void RestoreBinaryState(StreamIn &inStream) override; 31 | 32 | private: 33 | String mDebugName; ///< Name of the material, used for debugging purposes 34 | Color mDebugColor = Color::sGrey; ///< Color of the material, used to render the shapes 35 | }; 36 | 37 | JPH_NAMESPACE_END 38 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Constraints/MotorSettings.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | JPH_NAMESPACE_BEGIN 13 | 14 | JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(MotorSettings) 15 | { 16 | JPH_ADD_ATTRIBUTE(MotorSettings, mFrequency) 17 | JPH_ADD_ATTRIBUTE(MotorSettings, mDamping) 18 | JPH_ADD_ATTRIBUTE(MotorSettings, mMinForceLimit) 19 | JPH_ADD_ATTRIBUTE(MotorSettings, mMaxForceLimit) 20 | JPH_ADD_ATTRIBUTE(MotorSettings, mMinTorqueLimit) 21 | JPH_ADD_ATTRIBUTE(MotorSettings, mMaxTorqueLimit) 22 | } 23 | 24 | void MotorSettings::SaveBinaryState(StreamOut &inStream) const 25 | { 26 | inStream.Write(mFrequency); 27 | inStream.Write(mDamping); 28 | inStream.Write(mMinForceLimit); 29 | inStream.Write(mMaxForceLimit); 30 | inStream.Write(mMinTorqueLimit); 31 | inStream.Write(mMaxTorqueLimit); 32 | } 33 | 34 | void MotorSettings::RestoreBinaryState(StreamIn &inStream) 35 | { 36 | inStream.Read(mFrequency); 37 | inStream.Read(mDamping); 38 | inStream.Read(mMinForceLimit); 39 | inStream.Read(mMaxForceLimit); 40 | inStream.Read(mMinTorqueLimit); 41 | inStream.Read(mMaxTorqueLimit); 42 | } 43 | 44 | JPH_NAMESPACE_END 45 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/DeterminismLog.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2022 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | #ifdef JPH_ENABLE_DETERMINISM_LOG 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | DeterminismLog DeterminismLog::sLog; 14 | 15 | JPH_NAMESPACE_END 16 | 17 | #endif // JPH_ENABLE_DETERMINISM_LOG 18 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/EActivation.h: -------------------------------------------------------------------------------- 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 | /// Enum used by AddBody to determine if the body needs to be initially active 10 | enum class EActivation 11 | { 12 | Activate, ///< Activate the body, making it part of the simulation 13 | DontActivate ///< Leave activation state as it is (will not deactivate an active body) 14 | }; 15 | 16 | JPH_NAMESPACE_END 17 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/PhysicsLock.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | #ifdef JPH_ENABLE_ASSERTS 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | thread_local PhysicsLock::LockData PhysicsLock::sLocks[4]; 14 | 15 | JPH_NAMESPACE_END 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/PhysicsStepListener.h: -------------------------------------------------------------------------------- 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 PhysicsSystem; 10 | 11 | /// A listener class that receives a callback before every physics simulation step 12 | class JPH_EXPORT PhysicsStepListener 13 | { 14 | public: 15 | /// Ensure virtual destructor 16 | virtual ~PhysicsStepListener() = default; 17 | 18 | /// Called before every simulation step (received inCollisionSteps times for every PhysicsSystem::Update(...) call) 19 | /// This is called while all body and constraint mutexes are locked. You can read/write bodies and constraints but not add/remove them. 20 | /// Multiple listeners can be executed in parallel and it is the responsibility of the listener to avoid race conditions. 21 | /// The best way to do this is to have each step listener operate on a subset of the bodies and constraints 22 | /// and making sure that these bodies and constraints are not touched by any other step listener. 23 | /// Note that this function is not called if there aren't any active bodies or when the physics system is updated with 0 delta time. 24 | virtual void OnStep(float inDeltaTime, PhysicsSystem &inPhysicsSystem) = 0; 25 | }; 26 | 27 | JPH_NAMESPACE_END 28 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/PhysicsUpdateContext.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | PhysicsUpdateContext::PhysicsUpdateContext(TempAllocator &inTempAllocator) : 12 | mTempAllocator(&inTempAllocator), 13 | mSteps(inTempAllocator) 14 | { 15 | } 16 | 17 | PhysicsUpdateContext::~PhysicsUpdateContext() 18 | { 19 | JPH_ASSERT(mBodyPairs == nullptr); 20 | JPH_ASSERT(mActiveConstraints == nullptr); 21 | } 22 | 23 | JPH_NAMESPACE_END 24 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Vehicle/VehicleAntiRollBar.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(VehicleAntiRollBar) 13 | { 14 | JPH_ADD_ATTRIBUTE(VehicleAntiRollBar, mLeftWheel) 15 | JPH_ADD_ATTRIBUTE(VehicleAntiRollBar, mRightWheel) 16 | JPH_ADD_ATTRIBUTE(VehicleAntiRollBar, mStiffness) 17 | } 18 | 19 | void VehicleAntiRollBar::SaveBinaryState(StreamOut &inStream) const 20 | { 21 | inStream.Write(mLeftWheel); 22 | inStream.Write(mRightWheel); 23 | inStream.Write(mStiffness); 24 | } 25 | 26 | void VehicleAntiRollBar::RestoreBinaryState(StreamIn &inStream) 27 | { 28 | inStream.Read(mLeftWheel); 29 | inStream.Read(mRightWheel); 30 | inStream.Read(mStiffness); 31 | } 32 | 33 | JPH_NAMESPACE_END 34 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Vehicle/VehicleAntiRollBar.h: -------------------------------------------------------------------------------- 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 | #include 8 | #include 9 | #include 10 | 11 | JPH_NAMESPACE_BEGIN 12 | 13 | /// An anti rollbar is a stiff spring that connects two wheels to reduce the amount of roll the vehicle makes in sharp corners 14 | /// See: https://en.wikipedia.org/wiki/Anti-roll_bar 15 | class JPH_EXPORT VehicleAntiRollBar 16 | { 17 | public: 18 | JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleAntiRollBar) 19 | 20 | /// Saves the contents in binary form to inStream. 21 | void SaveBinaryState(StreamOut &inStream) const; 22 | 23 | /// Restores the contents in binary form to inStream. 24 | void RestoreBinaryState(StreamIn &inStream); 25 | 26 | int mLeftWheel = 0; ///< Index (in mWheels) that represents the left wheel of this anti-rollbar 27 | int mRightWheel = 1; ///< Index (in mWheels) that represents the right wheel of this anti-rollbar 28 | float mStiffness = 1000.0f; ///< Stiffness (spring constant in N/m) of anti rollbar, can be 0 to disable the anti-rollbar 29 | }; 30 | 31 | JPH_NAMESPACE_END 32 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/Physics/Vehicle/VehicleController.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT(VehicleControllerSettings) 13 | { 14 | JPH_ADD_BASE_CLASS(VehicleControllerSettings, SerializableObject) 15 | } 16 | 17 | JPH_NAMESPACE_END 18 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/RegisterTypes.h: -------------------------------------------------------------------------------- 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 | /// Register all physics types with the factory 10 | JPH_EXPORT extern void RegisterTypes(); 11 | 12 | /// Unregisters all types with the factory and cleans up the default material 13 | JPH_EXPORT extern void UnregisterTypes(); 14 | 15 | JPH_NAMESPACE_END 16 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouper.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// A class that groups triangles in batches of N (according to closeness) 12 | class JPH_EXPORT TriangleGrouper 13 | { 14 | public: 15 | /// Virtual destructor 16 | virtual ~TriangleGrouper() = default; 17 | 18 | /// Group a batch of indexed triangles 19 | /// @param inVertices The list of vertices 20 | /// @param inTriangles The list of indexed triangles (indexes into inVertices) 21 | /// @param inGroupSize How big each group should be 22 | /// @param outGroupedTriangleIndices An ordered list of indices (indexing into inTriangles), contains groups of inGroupSize large worth of indices to triangles that are grouped together. If the triangle count is not an exact multiple of inGroupSize the last batch will be smaller. 23 | virtual void Group(const VertexList &inVertices, const IndexedTriangleList &inTriangles, int inGroupSize, Array &outGroupedTriangleIndices) = 0; 24 | }; 25 | 26 | JPH_NAMESPACE_END 27 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// A class that groups triangles in batches of N. 12 | /// Starts with centroid with lowest X coordinate and finds N closest centroids, this repeats until all groups have been found. 13 | /// Time complexity: O(N^2) 14 | class JPH_EXPORT TriangleGrouperClosestCentroid : public TriangleGrouper 15 | { 16 | public: 17 | // See: TriangleGrouper::Group 18 | virtual void Group(const VertexList &inVertices, const IndexedTriangleList &inTriangles, int inGroupSize, Array &outGroupedTriangleIndices) override; 19 | }; 20 | 21 | JPH_NAMESPACE_END 22 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperMorton.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// A class that groups triangles in batches of N according to morton code of centroid. 12 | /// Time complexity: O(N log(N)) 13 | class JPH_EXPORT TriangleGrouperMorton : public TriangleGrouper 14 | { 15 | public: 16 | // See: TriangleGrouper::Group 17 | virtual void Group(const VertexList &inVertices, const IndexedTriangleList &inTriangles, int inGroupSize, Array &outGroupedTriangleIndices) override; 18 | }; 19 | 20 | JPH_NAMESPACE_END 21 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | JPH_NAMESPACE_BEGIN 11 | 12 | TriangleSplitterLongestAxis::TriangleSplitterLongestAxis(const VertexList &inVertices, const IndexedTriangleList &inTriangles) : 13 | TriangleSplitter(inVertices, inTriangles) 14 | { 15 | } 16 | 17 | bool TriangleSplitterLongestAxis::Split(const Range &inTriangles, Range &outLeft, Range &outRight) 18 | { 19 | // Calculate bounding box for triangles 20 | AABox bounds; 21 | for (uint t = inTriangles.mBegin; t < inTriangles.mEnd; ++t) 22 | bounds.Encapsulate(mVertices, GetTriangle(t)); 23 | 24 | // Calculate split plane 25 | uint dimension = bounds.GetExtent().GetHighestComponentIndex(); 26 | float split = bounds.GetCenter()[dimension]; 27 | 28 | return SplitInternal(inTriangles, dimension, split, outLeft, outRight); 29 | } 30 | 31 | JPH_NAMESPACE_END 32 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Splitter using center of bounding box with longest axis 12 | class JPH_EXPORT TriangleSplitterLongestAxis : public TriangleSplitter 13 | { 14 | public: 15 | /// Constructor 16 | TriangleSplitterLongestAxis(const VertexList &inVertices, const IndexedTriangleList &inTriangles); 17 | 18 | // See TriangleSplitter::GetStats 19 | virtual void GetStats(Stats &outStats) const override 20 | { 21 | outStats.mSplitterName = "TriangleSplitterLongestAxis"; 22 | } 23 | 24 | // See TriangleSplitter::Split 25 | virtual bool Split(const Range &inTriangles, Range &outLeft, Range &outRight) override; 26 | }; 27 | 28 | JPH_NAMESPACE_END 29 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMean.cpp: -------------------------------------------------------------------------------- 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe 3 | // SPDX-License-Identifier: MIT 4 | 5 | #include 6 | 7 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | TriangleSplitterMean::TriangleSplitterMean(const VertexList &inVertices, const IndexedTriangleList &inTriangles) : 12 | TriangleSplitter(inVertices, inTriangles) 13 | { 14 | } 15 | 16 | bool TriangleSplitterMean::Split(const Range &inTriangles, Range &outLeft, Range &outRight) 17 | { 18 | // Calculate mean value for these triangles 19 | Vec3 mean = Vec3::sZero(); 20 | for (uint t = inTriangles.mBegin; t < inTriangles.mEnd; ++t) 21 | mean += Vec3(mCentroids[mSortedTriangleIdx[t]]); 22 | mean *= 1.0f / inTriangles.Count(); 23 | 24 | // Calculate deviation 25 | Vec3 deviation = Vec3::sZero(); 26 | for (uint t = inTriangles.mBegin; t < inTriangles.mEnd; ++t) 27 | { 28 | Vec3 delta = Vec3(mCentroids[mSortedTriangleIdx[t]]) - mean; 29 | deviation += delta * delta; 30 | } 31 | deviation *= 1.0f / inTriangles.Count(); 32 | 33 | // Calculate split plane 34 | uint dimension = deviation.GetHighestComponentIndex(); 35 | float split = mean[dimension]; 36 | 37 | return SplitInternal(inTriangles, dimension, split, outLeft, outRight); 38 | } 39 | 40 | JPH_NAMESPACE_END 41 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMean.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Splitter using mean of axis with biggest centroid deviation 12 | class JPH_EXPORT TriangleSplitterMean : public TriangleSplitter 13 | { 14 | public: 15 | /// Constructor 16 | TriangleSplitterMean(const VertexList &inVertices, const IndexedTriangleList &inTriangles); 17 | 18 | // See TriangleSplitter::GetStats 19 | virtual void GetStats(Stats &outStats) const override 20 | { 21 | outStats.mSplitterName = "TriangleSplitterMean"; 22 | } 23 | 24 | // See TriangleSplitter::Split 25 | virtual bool Split(const Range &inTriangles, Range &outLeft, Range &outRight) override; 26 | }; 27 | 28 | JPH_NAMESPACE_END 29 | -------------------------------------------------------------------------------- /JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMorton.h: -------------------------------------------------------------------------------- 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 | #include 8 | 9 | JPH_NAMESPACE_BEGIN 10 | 11 | /// Splitter using Morton codes, see: http://devblogs.nvidia.com/parallelforall/thinking-parallel-part-iii-tree-construction-gpu/ 12 | class JPH_EXPORT TriangleSplitterMorton : public TriangleSplitter 13 | { 14 | public: 15 | /// Constructor 16 | TriangleSplitterMorton(const VertexList &inVertices, const IndexedTriangleList &inTriangles); 17 | 18 | // See TriangleSplitter::GetStats 19 | virtual void GetStats(Stats &outStats) const override 20 | { 21 | outStats.mSplitterName = "TriangleSplitterMorton"; 22 | } 23 | 24 | // See TriangleSplitter::Split 25 | virtual bool Split(const Range &inTriangles, Range &outLeft, Range &outRight) override; 26 | 27 | private: 28 | // Precalculated Morton codes 29 | Array mMortonCodes; 30 | }; 31 | 32 | JPH_NAMESPACE_END 33 | -------------------------------------------------------------------------------- /JoltPhysicsC/README.md: -------------------------------------------------------------------------------- 1 | # JoltPhysicsC v0.0.4 - C API for Jolt Physics C++ library 2 | 3 | [Jolt Physics](https://github.com/jrouwe/JoltPhysics) is a fast and modern physics library written in C++. 4 | 5 | This project aims to provide high-performance, consistent and roboust C API for Jolt. 6 | 7 | JoltPhysicsC is not yet complete but already usable, to get started please take a look at our [tests](https://github.com/michal-z/zig-gamedev/blob/main/libs/zphysics/libs/JoltC/JoltPhysicsC_Tests.c). 8 | 9 | Folder structure: 10 | 11 | * `Jolt/` - contains complete, up-to date source code of Jolt Physics 12 | * `JoltC/` 13 | * `JoltPhysicsC.h` - C API header file 14 | * `JoltPhysicsC.cpp` - C API implementation 15 | * `JoltPhysicsC_Extensions.cpp` - some additional, low-level functions implemented for performance reasons 16 | * `JoltPhysicsC_Tests.c` - tests for our C API 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023 aecsocket 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /build-logic/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | gradlePluginPortal() 7 | } 8 | 9 | dependencies { 10 | implementation(libs.indraCommon) 11 | implementation(libs.indraPublishingSonatype) 12 | implementation(libs.jextract) 13 | } 14 | -------------------------------------------------------------------------------- /build-logic/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | import ca.stellardrift.build.configurate.ConfigFormats 2 | import ca.stellardrift.build.configurate.catalog.PolyglotVersionCatalogExtension 3 | 4 | plugins { 5 | id("ca.stellardrift.polyglot-version-catalogs") version "6.0.1" 6 | } 7 | 8 | extensions.configure { 9 | from(ConfigFormats.YAML, file("../gradle/libs.versions.yml")) 10 | } 11 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/Globals.kt: -------------------------------------------------------------------------------- 1 | enum class JoltBuildType(val key: String) { 2 | DEBUG ("Debug"), 3 | RELEASE ("Release"), 4 | DISTRIBUTION ("Distribution") 5 | } 6 | 7 | enum class JoltBuildFlavor { 8 | SP, 9 | DP 10 | } 11 | 12 | enum class JoltBuildFeature { 13 | DOUBLE_PRECISION, 14 | USE_SSE4_1, 15 | USE_SSE4_2, 16 | USE_AVX, 17 | USE_AVX2, 18 | USE_AVX512, 19 | USE_LZCNT, 20 | USE_TZCNT, 21 | USE_F16C, 22 | USE_FMADD; 23 | 24 | fun macro() = "JPH_$name" 25 | 26 | fun cmakeFlag() = "JPJ_$name" 27 | } 28 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/NativesExtension.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.api.provider.Property 2 | import org.gradle.internal.os.OperatingSystem 3 | import java.util.function.Predicate 4 | 5 | abstract class NativesExtension { 6 | abstract val platformPredicate: Property> 7 | abstract val generator: Property 8 | abstract val sourceLibraryName: Property 9 | abstract val destDir: Property 10 | } 11 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/base-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("net.kyori.indra.git") 3 | } 4 | 5 | group = rootProject.group 6 | version = rootProject.version 7 | description = rootProject.description 8 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/java-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.gradle.api.tasks.testing.logging.TestExceptionFormat 2 | 3 | plugins { 4 | id("base-conventions") 5 | id("java-library") 6 | id("net.kyori.indra") 7 | } 8 | 9 | indra { 10 | javaVersions { 11 | target(19) 12 | } 13 | } 14 | 15 | repositories { 16 | mavenCentral() 17 | } 18 | 19 | afterEvaluate { 20 | tasks { 21 | withType { 22 | options.compilerArgs.addAll(listOf("--enable-preview")) 23 | } 24 | 25 | javadoc { 26 | (options as CoreJavadocOptions).apply { 27 | addBooleanOption("-enable-preview", true) 28 | } 29 | } 30 | 31 | test { 32 | jvmArgs("--enable-preview", "--enable-native-access=ALL-UNNAMED") 33 | testLogging.exceptionFormat = TestExceptionFormat.FULL 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/natives-linux-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("natives-conventions") 3 | } 4 | 5 | extensions.getByType().apply { 6 | platformPredicate.set { it.isLinux } 7 | generator.set("Unix Makefiles") 8 | sourceLibraryName.set("libJoltC.so") 9 | } 10 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/natives-macos-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("natives-conventions") 3 | } 4 | 5 | extensions.getByType().apply { 6 | platformPredicate.set { it.isMacOsX } 7 | generator.set("Unix Makefiles") 8 | sourceLibraryName.set("libJoltC.dylib") 9 | } 10 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/natives-windows-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("natives-conventions") 3 | } 4 | 5 | extensions.getByType().apply { 6 | platformPredicate.set { it.isWindows } 7 | generator.set("MinGW Makefiles") 8 | sourceLibraryName.set("libJoltC.dll") 9 | } 10 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/parent-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("net.kyori.indra.publishing.sonatype") 3 | id("publishing-conventions") 4 | } 5 | 6 | indraSonatype { 7 | useAlternateSonatypeOSSHost("s01") 8 | } 9 | 10 | tasks.register("printVersionType") { 11 | doFirst { 12 | println(if (net.kyori.indra.util.Versioning.isSnapshot(project)) "snapshot" else "release") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/publishing-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("net.kyori.indra.publishing") 3 | } 4 | 5 | signing { 6 | val signingKey: String? by project 7 | val signingPassword: String? by project 8 | if (signingKey != null) { 9 | useInMemoryPgpKeys(signingKey, signingPassword) 10 | } 11 | } 12 | 13 | indra { 14 | github("aecsocket", rootProject.name) 15 | mitLicense() 16 | 17 | configurePublications { 18 | pom { 19 | developers { 20 | developer { 21 | name.set("aecsocket") 22 | email.set("aecsocket@tutanota.com") 23 | url.set("https://github.com/aecsocket") 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("parent-conventions") 3 | id("java-conventions") 4 | } 5 | 6 | group = "io.github.aecsocket" 7 | version = "0.1.0-SNAPSHOT" 8 | description = "Java bindings for JoltPhysics" 9 | 10 | dependencies { 11 | implementation(projects.joltJavaHeaders) 12 | implementation(libs.cpuFeaturesJava) 13 | compileOnlyApi(libs.findBugs) 14 | 15 | testImplementation(libs.jUnitJupiterApi) 16 | testImplementation(libs.jUnitJupiterEngine) 17 | testImplementation(libs.findBugs) 18 | testRuntimeOnly(projects.joltJavaNativesLinuxX86) 19 | testRuntimeOnly(projects.joltJavaNativesWindowsX86) 20 | testRuntimeOnly(projects.joltJavaNativesMacosX86) 21 | } 22 | 23 | if (!publishCore()) { 24 | tasks { 25 | withType { 26 | enabled = false 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | buildType=distribution 2 | buildFlavor=dp 3 | -------------------------------------------------------------------------------- /gradle/libs.versions.yml: -------------------------------------------------------------------------------- 1 | metadata: 2 | format: { version: 1.0 } 3 | polyglot-extensions: [ plugins ] 4 | 5 | versions: 6 | indra: 3.0.1 7 | jextract: 0.3.2 8 | findBugs: 3.0.2 9 | cpuFeaturesJava: 2.0.1 10 | jUnit: 5.9.2 11 | 12 | dependencies: 13 | indraCommon: { group: net.kyori, name: indra-common, version: { ref: indra } } 14 | indraPublishingSonatype: { group: net.kyori, name: indra-publishing-sonatype, version: { ref: indra } } 15 | jextract: { group: gradle.plugin.io.github.krakowski, name: gradle-jextract, version: { ref: jextract } } 16 | findBugs: { group: com.google.code.findbugs, name: jsr305, version: { ref: findBugs } } 17 | cpuFeaturesJava: { group: io.github.aecsocket, name: cpu-features-java, version: { ref: cpuFeaturesJava } } 18 | cpuFeaturesJavaNativesLinuxX86: { group: io.github.aecsocket, name: cpu-features-java-natives-linux-x86, version: { ref: cpuFeaturesJava } } 19 | cpuFeaturesJavaNativesWindowsX86: { group: io.github.aecsocket, name: cpu-features-java-natives-windows-x86, version: { ref: cpuFeaturesJava } } 20 | cpuFeaturesJavaNativesMacosX86: { group: io.github.aecsocket, name: cpu-features-java-natives-macos-x86, version: { ref: cpuFeaturesJava } } 21 | jUnitJupiterApi: { group: org.junit.jupiter, name: junit-jupiter-api, version: { ref: jUnit } } 22 | jUnitJupiterEngine: { group: org.junit.jupiter, name: junit-jupiter-engine, version: { ref: jUnit } } 23 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aecsocket/jolt-java/6522a905f839ce04a56c70dfd4cb0a78f20d8427/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /jolt-java-headers/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.krakowski.jextract.JextractTask 2 | import io.github.krakowski.jextract.LibraryDefinition 3 | 4 | plugins { 5 | id("java-conventions") 6 | } 7 | 8 | publishCore() 9 | 10 | fun LibraryDefinition.defaults() { 11 | className.set("JoltPhysicsC") 12 | } 13 | 14 | tasks { 15 | register("generateHeaders") { 16 | toolchain.convention(org.gradle.internal.jvm.Jvm.current().javaHome.absolutePath) 17 | 18 | header("$joltDir/JoltC/JoltPhysicsC.h") { 19 | defaults() 20 | targetPackage.set("jolt.headers") 21 | } 22 | 23 | header("$joltDir/JoltC/JoltPhysicsC.h") { 24 | defaults() 25 | targetPackage.set("jolt.headers_f") 26 | } 27 | 28 | header("$joltDir/JoltC/JoltPhysicsC.h") { 29 | defaults() 30 | targetPackage.set("jolt.headers_d") 31 | definedMacros.add("JPH_DOUBLE_PRECISION") 32 | } 33 | 34 | doLast { 35 | copy { 36 | from("${outputDir.get()}") 37 | into("$projectDir/src/main/java") 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/cheaders/Constants$root.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.cheaders; 4 | 5 | import static java.lang.foreign.ValueLayout.*; 6 | 7 | public class Constants$root { 8 | 9 | static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; 10 | static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; 11 | static final OfShort C_SHORT$LAYOUT = JAVA_SHORT.withBitAlignment(16); 12 | static final OfInt C_INT$LAYOUT = JAVA_INT.withBitAlignment(32); 13 | static final OfLong C_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 14 | static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 15 | static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT.withBitAlignment(32); 16 | static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE.withBitAlignment(64); 17 | static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64); 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/cheaders/JPC_RRayCast.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.cheaders; 4 | 5 | import java.lang.foreign.*; 6 | 7 | public class JPC_RRayCast { 8 | 9 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 10 | MemoryLayout.sequenceLayout(4, Constants$root.C_DOUBLE$LAYOUT).withBitAlignment(256).withName("origin"), 11 | MemoryLayout.sequenceLayout(4, Constants$root.C_FLOAT$LAYOUT).withBitAlignment(128).withName("direction") 12 | ).withName("JPC_RRayCast"); 13 | public static MemoryLayout $LAYOUT() { 14 | return JPC_RRayCast.$struct$LAYOUT; 15 | } 16 | public static MemorySegment origin$slice(MemorySegment seg) { 17 | return seg.asSlice(0, 32); 18 | } 19 | public static MemorySegment direction$slice(MemorySegment seg) { 20 | return seg.asSlice(32, 16); 21 | } 22 | public static long sizeof() { return $LAYOUT().byteSize(); } 23 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 24 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 25 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 26 | } 27 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/cheaders/JPC_RayCast.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.cheaders; 4 | 5 | import java.lang.foreign.*; 6 | 7 | public class JPC_RayCast { 8 | 9 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 10 | MemoryLayout.sequenceLayout(4, Constants$root.C_FLOAT$LAYOUT).withBitAlignment(128).withName("origin"), 11 | MemoryLayout.sequenceLayout(4, Constants$root.C_FLOAT$LAYOUT).withBitAlignment(128).withName("direction") 12 | ).withName("JPC_RayCast"); 13 | public static MemoryLayout $LAYOUT() { 14 | return JPC_RayCast.$struct$LAYOUT; 15 | } 16 | public static MemorySegment origin$slice(MemorySegment seg) { 17 | return seg.asSlice(0, 16); 18 | } 19 | public static MemorySegment direction$slice(MemorySegment seg) { 20 | return seg.asSlice(16, 16); 21 | } 22 | public static long sizeof() { return $LAYOUT().byteSize(); } 23 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 24 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 25 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 26 | } 27 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/Constants$root.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class Constants$root { 11 | 12 | static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; 13 | static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; 14 | static final OfShort C_SHORT$LAYOUT = JAVA_SHORT.withBitAlignment(16); 15 | static final OfInt C_INT$LAYOUT = JAVA_INT.withBitAlignment(32); 16 | static final OfLong C_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 17 | static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 18 | static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT.withBitAlignment(32); 19 | static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE.withBitAlignment(64); 20 | static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64); 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_AABox.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_AABox { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(4, Constants$root.C_FLOAT$LAYOUT).withName("min"), 14 | MemoryLayout.sequenceLayout(4, Constants$root.C_FLOAT$LAYOUT).withName("max") 15 | ).withName("JPC_AABox"); 16 | public static MemoryLayout $LAYOUT() { 17 | return JPC_AABox.$struct$LAYOUT; 18 | } 19 | public static MemorySegment min$slice(MemorySegment seg) { 20 | return seg.asSlice(0, 16); 21 | } 22 | public static MemorySegment max$slice(MemorySegment seg) { 23 | return seg.asSlice(16, 16); 24 | } 25 | public static long sizeof() { return $LAYOUT().byteSize(); } 26 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 27 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 28 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 29 | } 30 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_AlignedAllocateFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AlignedAllocateFunction { 11 | 12 | java.lang.foreign.Addressable apply(long in_size, long in_alignment); 13 | static MemorySegment allocate(JPC_AlignedAllocateFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AlignedAllocateFunction.class, fi, constants$19.JPC_AlignedAllocateFunction$FUNC, session); 15 | } 16 | static JPC_AlignedAllocateFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (long _in_size, long _in_alignment) -> { 19 | try { 20 | return (java.lang.foreign.Addressable)(java.lang.foreign.MemoryAddress)constants$19.JPC_AlignedAllocateFunction$MH.invokeExact((Addressable)symbol, _in_size, _in_alignment); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_AlignedFreeFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AlignedFreeFunction { 11 | 12 | void apply(java.lang.foreign.MemoryAddress in_block); 13 | static MemorySegment allocate(JPC_AlignedFreeFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AlignedFreeFunction.class, fi, constants$19.JPC_AlignedFreeFunction$FUNC, session); 15 | } 16 | static JPC_AlignedFreeFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress _in_block) -> { 19 | try { 20 | constants$19.JPC_AlignedFreeFunction$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)_in_block); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_AllocateFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AllocateFunction { 11 | 12 | java.lang.foreign.Addressable apply(long in_size); 13 | static MemorySegment allocate(JPC_AllocateFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AllocateFunction.class, fi, constants$18.JPC_AllocateFunction$FUNC, session); 15 | } 16 | static JPC_AllocateFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (long _in_size) -> { 19 | try { 20 | return (java.lang.foreign.Addressable)(java.lang.foreign.MemoryAddress)constants$18.JPC_AllocateFunction$MH.invokeExact((Addressable)symbol, _in_size); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_FreeFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_FreeFunction { 11 | 12 | void apply(java.lang.foreign.MemoryAddress in_block); 13 | static MemorySegment allocate(JPC_FreeFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_FreeFunction.class, fi, constants$18.JPC_FreeFunction$FUNC, session); 15 | } 16 | static JPC_FreeFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress _in_block) -> { 19 | try { 20 | constants$19.JPC_FreeFunction$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)_in_block); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_PointConvexSupport.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_PointConvexSupport { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(3, Constants$root.C_FLOAT$LAYOUT).withName("point"), 14 | MemoryLayout.paddingLayout(32) 15 | ).withName("JPC_PointConvexSupport"); 16 | public static MemoryLayout $LAYOUT() { 17 | return JPC_PointConvexSupport.$struct$LAYOUT; 18 | } 19 | public static MemorySegment point$slice(MemorySegment seg) { 20 | return seg.asSlice(0, 12); 21 | } 22 | public static long sizeof() { return $LAYOUT().byteSize(); } 23 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 24 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 25 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 26 | } 27 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/JPC_SupportBuffer.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_SupportBuffer { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(4160, Constants$root.C_CHAR$LAYOUT).withName("data") 14 | ).withName("JPC_SupportBuffer"); 15 | public static MemoryLayout $LAYOUT() { 16 | return JPC_SupportBuffer.$struct$LAYOUT; 17 | } 18 | public static MemorySegment data$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 4160); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/__compar_fn_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface __compar_fn_t { 11 | 12 | int apply(java.lang.foreign.MemoryAddress _x0, java.lang.foreign.MemoryAddress _x1); 13 | static MemorySegment allocate(__compar_fn_t fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(__compar_fn_t.class, fi, constants$14.__compar_fn_t$FUNC, session); 15 | } 16 | static __compar_fn_t ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress __x0, java.lang.foreign.MemoryAddress __x1) -> { 19 | try { 20 | return (int)constants$14.__compar_fn_t$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)__x0, (java.lang.foreign.Addressable)__x1); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/__fsid_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __fsid_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return __fsid_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 8); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/__pthread_list_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __pthread_list_t extends __pthread_internal_list { 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/__pthread_slist_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __pthread_slist_t extends __pthread_internal_slist { 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/__sigset_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __sigset_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return __sigset_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/at_quick_exit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface at_quick_exit$__func { 11 | 12 | void apply(); 13 | static MemorySegment allocate(at_quick_exit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(at_quick_exit$__func.class, fi, constants$11.at_quick_exit$__func$FUNC, session); 15 | } 16 | static at_quick_exit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return () -> { 19 | try { 20 | constants$11.at_quick_exit$__func$MH.invokeExact((Addressable)symbol); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/atexit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface atexit$__func { 11 | 12 | void apply(); 13 | static MemorySegment allocate(atexit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(atexit$__func.class, fi, constants$10.atexit$__func$FUNC, session); 15 | } 16 | static atexit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return () -> { 19 | try { 20 | constants$11.atexit$__func$MH.invokeExact((Addressable)symbol); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/constants$136.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | class constants$136 { 11 | 12 | static final FunctionDescriptor JPJ_GetFeatures$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); 13 | static final MethodHandle JPJ_GetFeatures$MH = RuntimeHelper.downcallHandleVariadic( 14 | "JPJ_GetFeatures", 15 | constants$136.JPJ_GetFeatures$FUNC 16 | ); 17 | static final MemoryAddress NULL$ADDR = MemoryAddress.ofLong(0L); 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/fd_set.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class fd_set { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__fds_bits") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return fd_set.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __fds_bits$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/fsid_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class fsid_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return fsid_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 8); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/on_exit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface on_exit$__func { 11 | 12 | void apply(int _x0, java.lang.foreign.MemoryAddress _x1); 13 | static MemorySegment allocate(on_exit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(on_exit$__func.class, fi, constants$11.on_exit$__func$FUNC, session); 15 | } 16 | static on_exit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (int __x0, java.lang.foreign.MemoryAddress __x1) -> { 19 | try { 20 | constants$12.on_exit$__func$MH.invokeExact((Addressable)symbol, __x0, (java.lang.foreign.Addressable)__x1); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers/sigset_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class sigset_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return sigset_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/Constants$root.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class Constants$root { 11 | 12 | static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; 13 | static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; 14 | static final OfShort C_SHORT$LAYOUT = JAVA_SHORT.withBitAlignment(16); 15 | static final OfInt C_INT$LAYOUT = JAVA_INT.withBitAlignment(32); 16 | static final OfLong C_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 17 | static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 18 | static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT.withBitAlignment(32); 19 | static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE.withBitAlignment(64); 20 | static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64); 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/JPC_AlignedAllocateFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AlignedAllocateFunction { 11 | 12 | java.lang.foreign.Addressable apply(long in_size, long in_alignment); 13 | static MemorySegment allocate(JPC_AlignedAllocateFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AlignedAllocateFunction.class, fi, constants$19.JPC_AlignedAllocateFunction$FUNC, session); 15 | } 16 | static JPC_AlignedAllocateFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (long _in_size, long _in_alignment) -> { 19 | try { 20 | return (java.lang.foreign.Addressable)(java.lang.foreign.MemoryAddress)constants$19.JPC_AlignedAllocateFunction$MH.invokeExact((Addressable)symbol, _in_size, _in_alignment); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/JPC_AlignedFreeFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AlignedFreeFunction { 11 | 12 | void apply(java.lang.foreign.MemoryAddress in_block); 13 | static MemorySegment allocate(JPC_AlignedFreeFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AlignedFreeFunction.class, fi, constants$19.JPC_AlignedFreeFunction$FUNC, session); 15 | } 16 | static JPC_AlignedFreeFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress _in_block) -> { 19 | try { 20 | constants$19.JPC_AlignedFreeFunction$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)_in_block); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/JPC_AllocateFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AllocateFunction { 11 | 12 | java.lang.foreign.Addressable apply(long in_size); 13 | static MemorySegment allocate(JPC_AllocateFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AllocateFunction.class, fi, constants$18.JPC_AllocateFunction$FUNC, session); 15 | } 16 | static JPC_AllocateFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (long _in_size) -> { 19 | try { 20 | return (java.lang.foreign.Addressable)(java.lang.foreign.MemoryAddress)constants$18.JPC_AllocateFunction$MH.invokeExact((Addressable)symbol, _in_size); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/JPC_FreeFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_FreeFunction { 11 | 12 | void apply(java.lang.foreign.MemoryAddress in_block); 13 | static MemorySegment allocate(JPC_FreeFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_FreeFunction.class, fi, constants$18.JPC_FreeFunction$FUNC, session); 15 | } 16 | static JPC_FreeFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress _in_block) -> { 19 | try { 20 | constants$19.JPC_FreeFunction$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)_in_block); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/JPC_PointConvexSupport.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_PointConvexSupport { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(3, Constants$root.C_FLOAT$LAYOUT).withName("point"), 14 | MemoryLayout.paddingLayout(32) 15 | ).withName("JPC_PointConvexSupport"); 16 | public static MemoryLayout $LAYOUT() { 17 | return JPC_PointConvexSupport.$struct$LAYOUT; 18 | } 19 | public static MemorySegment point$slice(MemorySegment seg) { 20 | return seg.asSlice(0, 12); 21 | } 22 | public static long sizeof() { return $LAYOUT().byteSize(); } 23 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 24 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 25 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 26 | } 27 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/JPC_SupportBuffer.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_SupportBuffer { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(4160, Constants$root.C_CHAR$LAYOUT).withName("data") 14 | ).withName("JPC_SupportBuffer"); 15 | public static MemoryLayout $LAYOUT() { 16 | return JPC_SupportBuffer.$struct$LAYOUT; 17 | } 18 | public static MemorySegment data$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 4160); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/__compar_fn_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface __compar_fn_t { 11 | 12 | int apply(java.lang.foreign.MemoryAddress _x0, java.lang.foreign.MemoryAddress _x1); 13 | static MemorySegment allocate(__compar_fn_t fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(__compar_fn_t.class, fi, constants$14.__compar_fn_t$FUNC, session); 15 | } 16 | static __compar_fn_t ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress __x0, java.lang.foreign.MemoryAddress __x1) -> { 19 | try { 20 | return (int)constants$14.__compar_fn_t$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)__x0, (java.lang.foreign.Addressable)__x1); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/__fsid_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __fsid_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return __fsid_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 8); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/__pthread_list_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __pthread_list_t extends __pthread_internal_list { 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/__pthread_slist_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __pthread_slist_t extends __pthread_internal_slist { 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/__sigset_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __sigset_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return __sigset_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/at_quick_exit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface at_quick_exit$__func { 11 | 12 | void apply(); 13 | static MemorySegment allocate(at_quick_exit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(at_quick_exit$__func.class, fi, constants$11.at_quick_exit$__func$FUNC, session); 15 | } 16 | static at_quick_exit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return () -> { 19 | try { 20 | constants$11.at_quick_exit$__func$MH.invokeExact((Addressable)symbol); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/atexit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface atexit$__func { 11 | 12 | void apply(); 13 | static MemorySegment allocate(atexit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(atexit$__func.class, fi, constants$10.atexit$__func$FUNC, session); 15 | } 16 | static atexit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return () -> { 19 | try { 20 | constants$11.atexit$__func$MH.invokeExact((Addressable)symbol); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/constants$136.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | class constants$136 { 11 | 12 | static final FunctionDescriptor JPJ_GetFeatures$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); 13 | static final MethodHandle JPJ_GetFeatures$MH = RuntimeHelper.downcallHandleVariadic( 14 | "JPJ_GetFeatures", 15 | constants$136.JPJ_GetFeatures$FUNC 16 | ); 17 | static final MemoryAddress NULL$ADDR = MemoryAddress.ofLong(0L); 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/fd_set.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class fd_set { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__fds_bits") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return fd_set.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __fds_bits$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/fsid_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class fsid_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return fsid_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 8); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/on_exit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface on_exit$__func { 11 | 12 | void apply(int _x0, java.lang.foreign.MemoryAddress _x1); 13 | static MemorySegment allocate(on_exit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(on_exit$__func.class, fi, constants$11.on_exit$__func$FUNC, session); 15 | } 16 | static on_exit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (int __x0, java.lang.foreign.MemoryAddress __x1) -> { 19 | try { 20 | constants$12.on_exit$__func$MH.invokeExact((Addressable)symbol, __x0, (java.lang.foreign.Addressable)__x1); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_d/sigset_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_d; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class sigset_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return sigset_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/Constants$root.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class Constants$root { 11 | 12 | static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; 13 | static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; 14 | static final OfShort C_SHORT$LAYOUT = JAVA_SHORT.withBitAlignment(16); 15 | static final OfInt C_INT$LAYOUT = JAVA_INT.withBitAlignment(32); 16 | static final OfLong C_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 17 | static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG.withBitAlignment(64); 18 | static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT.withBitAlignment(32); 19 | static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE.withBitAlignment(64); 20 | static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64); 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/JPC_AlignedAllocateFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AlignedAllocateFunction { 11 | 12 | java.lang.foreign.Addressable apply(long in_size, long in_alignment); 13 | static MemorySegment allocate(JPC_AlignedAllocateFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AlignedAllocateFunction.class, fi, constants$19.JPC_AlignedAllocateFunction$FUNC, session); 15 | } 16 | static JPC_AlignedAllocateFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (long _in_size, long _in_alignment) -> { 19 | try { 20 | return (java.lang.foreign.Addressable)(java.lang.foreign.MemoryAddress)constants$19.JPC_AlignedAllocateFunction$MH.invokeExact((Addressable)symbol, _in_size, _in_alignment); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/JPC_AlignedFreeFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AlignedFreeFunction { 11 | 12 | void apply(java.lang.foreign.MemoryAddress in_block); 13 | static MemorySegment allocate(JPC_AlignedFreeFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AlignedFreeFunction.class, fi, constants$19.JPC_AlignedFreeFunction$FUNC, session); 15 | } 16 | static JPC_AlignedFreeFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress _in_block) -> { 19 | try { 20 | constants$19.JPC_AlignedFreeFunction$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)_in_block); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/JPC_AllocateFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_AllocateFunction { 11 | 12 | java.lang.foreign.Addressable apply(long in_size); 13 | static MemorySegment allocate(JPC_AllocateFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_AllocateFunction.class, fi, constants$18.JPC_AllocateFunction$FUNC, session); 15 | } 16 | static JPC_AllocateFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (long _in_size) -> { 19 | try { 20 | return (java.lang.foreign.Addressable)(java.lang.foreign.MemoryAddress)constants$18.JPC_AllocateFunction$MH.invokeExact((Addressable)symbol, _in_size); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/JPC_FreeFunction.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface JPC_FreeFunction { 11 | 12 | void apply(java.lang.foreign.MemoryAddress in_block); 13 | static MemorySegment allocate(JPC_FreeFunction fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(JPC_FreeFunction.class, fi, constants$18.JPC_FreeFunction$FUNC, session); 15 | } 16 | static JPC_FreeFunction ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress _in_block) -> { 19 | try { 20 | constants$19.JPC_FreeFunction$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)_in_block); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/JPC_PointConvexSupport.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_PointConvexSupport { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(3, Constants$root.C_FLOAT$LAYOUT).withName("point"), 14 | MemoryLayout.paddingLayout(32) 15 | ).withName("JPC_PointConvexSupport"); 16 | public static MemoryLayout $LAYOUT() { 17 | return JPC_PointConvexSupport.$struct$LAYOUT; 18 | } 19 | public static MemorySegment point$slice(MemorySegment seg) { 20 | return seg.asSlice(0, 12); 21 | } 22 | public static long sizeof() { return $LAYOUT().byteSize(); } 23 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 24 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 25 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 26 | } 27 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/JPC_SupportBuffer.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class JPC_SupportBuffer { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(4160, Constants$root.C_CHAR$LAYOUT).withName("data") 14 | ).withName("JPC_SupportBuffer"); 15 | public static MemoryLayout $LAYOUT() { 16 | return JPC_SupportBuffer.$struct$LAYOUT; 17 | } 18 | public static MemorySegment data$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 4160); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/__compar_fn_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface __compar_fn_t { 11 | 12 | int apply(java.lang.foreign.MemoryAddress _x0, java.lang.foreign.MemoryAddress _x1); 13 | static MemorySegment allocate(__compar_fn_t fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(__compar_fn_t.class, fi, constants$14.__compar_fn_t$FUNC, session); 15 | } 16 | static __compar_fn_t ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (java.lang.foreign.MemoryAddress __x0, java.lang.foreign.MemoryAddress __x1) -> { 19 | try { 20 | return (int)constants$14.__compar_fn_t$MH.invokeExact((Addressable)symbol, (java.lang.foreign.Addressable)__x0, (java.lang.foreign.Addressable)__x1); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/__fsid_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __fsid_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return __fsid_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 8); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/__pthread_list_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __pthread_list_t extends __pthread_internal_list { 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/__pthread_slist_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __pthread_slist_t extends __pthread_internal_slist { 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/__sigset_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class __sigset_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return __sigset_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/at_quick_exit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface at_quick_exit$__func { 11 | 12 | void apply(); 13 | static MemorySegment allocate(at_quick_exit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(at_quick_exit$__func.class, fi, constants$11.at_quick_exit$__func$FUNC, session); 15 | } 16 | static at_quick_exit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return () -> { 19 | try { 20 | constants$11.at_quick_exit$__func$MH.invokeExact((Addressable)symbol); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/atexit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface atexit$__func { 11 | 12 | void apply(); 13 | static MemorySegment allocate(atexit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(atexit$__func.class, fi, constants$10.atexit$__func$FUNC, session); 15 | } 16 | static atexit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return () -> { 19 | try { 20 | constants$11.atexit$__func$MH.invokeExact((Addressable)symbol); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/constants$136.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | class constants$136 { 11 | 12 | static final FunctionDescriptor JPJ_GetFeatures$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); 13 | static final MethodHandle JPJ_GetFeatures$MH = RuntimeHelper.downcallHandleVariadic( 14 | "JPJ_GetFeatures", 15 | constants$136.JPJ_GetFeatures$FUNC 16 | ); 17 | static final MemoryAddress NULL$ADDR = MemoryAddress.ofLong(0L); 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/fd_set.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class fd_set { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__fds_bits") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return fd_set.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __fds_bits$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/fsid_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class fsid_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(2, Constants$root.C_INT$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return fsid_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 8); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/on_exit$__func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public interface on_exit$__func { 11 | 12 | void apply(int _x0, java.lang.foreign.MemoryAddress _x1); 13 | static MemorySegment allocate(on_exit$__func fi, MemorySession session) { 14 | return RuntimeHelper.upcallStub(on_exit$__func.class, fi, constants$11.on_exit$__func$FUNC, session); 15 | } 16 | static on_exit$__func ofAddress(MemoryAddress addr, MemorySession session) { 17 | MemorySegment symbol = MemorySegment.ofAddress(addr, 0, session); 18 | return (int __x0, java.lang.foreign.MemoryAddress __x1) -> { 19 | try { 20 | constants$12.on_exit$__func$MH.invokeExact((Addressable)symbol, __x0, (java.lang.foreign.Addressable)__x1); 21 | } catch (Throwable ex$) { 22 | throw new AssertionError("should not reach here", ex$); 23 | } 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /jolt-java-headers/src/main/java/jolt/headers_f/sigset_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package jolt.headers_f; 4 | 5 | import java.lang.invoke.MethodHandle; 6 | import java.lang.invoke.VarHandle; 7 | import java.nio.ByteOrder; 8 | import java.lang.foreign.*; 9 | import static java.lang.foreign.ValueLayout.*; 10 | public class sigset_t { 11 | 12 | static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( 13 | MemoryLayout.sequenceLayout(16, Constants$root.C_LONG_LONG$LAYOUT).withName("__val") 14 | ); 15 | public static MemoryLayout $LAYOUT() { 16 | return sigset_t.$struct$LAYOUT; 17 | } 18 | public static MemorySegment __val$slice(MemorySegment seg) { 19 | return seg.asSlice(0, 128); 20 | } 21 | public static long sizeof() { return $LAYOUT().byteSize(); } 22 | public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 23 | public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 24 | return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 25 | } 26 | public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /jolt-java-natives-linux-x86/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("natives-linux-conventions") 3 | } 4 | 5 | dependencies { 6 | runtimeOnly(libs.cpuFeaturesJavaNativesLinuxX86) 7 | } 8 | 9 | natives { 10 | destDir.set("linux_x86") 11 | } 12 | -------------------------------------------------------------------------------- /jolt-java-natives-macos-x86/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("natives-macos-conventions") 3 | } 4 | 5 | dependencies { 6 | runtimeOnly(libs.cpuFeaturesJavaNativesMacosX86) 7 | } 8 | 9 | natives { 10 | destDir.set("macos_x86") 11 | } 12 | -------------------------------------------------------------------------------- /jolt-java-natives-windows-x86/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("natives-windows-conventions") 3 | } 4 | 5 | dependencies { 6 | runtimeOnly(libs.cpuFeaturesJavaNativesWindowsX86) 7 | } 8 | 9 | natives { 10 | destDir.set("windows_x86") 11 | } 12 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") 2 | 3 | pluginManagement { 4 | repositories { 5 | gradlePluginPortal() 6 | } 7 | includeBuild("build-logic") 8 | } 9 | 10 | plugins { 11 | id("ca.stellardrift.polyglot-version-catalogs") version "6.0.1" 12 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.4.0" 13 | } 14 | 15 | rootProject.name = "jolt-java" 16 | 17 | include("jolt-java-headers") 18 | include("jolt-java-natives-linux-x86") 19 | include("jolt-java-natives-windows-x86") 20 | include("jolt-java-natives-macos-x86") 21 | -------------------------------------------------------------------------------- /src/main/java/jolt/AddressedJoltNative.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | public non-sealed abstract class AddressedJoltNative extends BaseJoltNative { 6 | protected final MemoryAddress handle; 7 | 8 | protected AddressedJoltNative(MemoryAddress handle) { 9 | this.handle = handle; 10 | } 11 | 12 | @Override 13 | public MemoryAddress address() { 14 | return handle; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/jolt/BaseJoltNative.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | public abstract sealed class BaseJoltNative implements JoltNative 4 | permits AddressedJoltNative, SegmentedJoltNative { 5 | @Override 6 | public boolean equals(Object obj) { 7 | if (obj instanceof JoltNative nativeObj) { 8 | return address().equals(nativeObj.address()); 9 | } 10 | return false; 11 | } 12 | 13 | @Override 14 | public int hashCode() { 15 | return address().hashCode(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/jolt/Deletable.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | // doesn't implement AutoCloseable because it would cause a lot of static analysis warnings 4 | // alternative: Jolt.use 5 | public interface Deletable { 6 | boolean isDeleted(); 7 | 8 | void delete(); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/jolt/DeletableJoltNative.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | public abstract class DeletableJoltNative extends AddressedJoltNative implements Deletable { 6 | protected boolean deleted; 7 | 8 | protected DeletableJoltNative(MemoryAddress address) { 9 | super(address); 10 | } 11 | 12 | @Override 13 | public boolean isDeleted() { 14 | return deleted; 15 | } 16 | 17 | protected abstract void deleteInternal(); 18 | 19 | @Override 20 | public void delete() { 21 | if (deleted) throw new IllegalStateException("Object is already deleted"); 22 | deleteInternal(); 23 | deleted = true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/jolt/JoltFeature.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public enum JoltFeature { 6 | DOUBLE_PRECISION (JoltFeatures::doublePrecision), 7 | USE_SSE4_1 (JoltFeatures::useSSE4_1), 8 | USE_SSE4_2 (JoltFeatures::useSSE4_2), 9 | USE_AVX (JoltFeatures::useAVX), 10 | USE_AVX2 (JoltFeatures::useAVX2), 11 | USE_AVX512 (JoltFeatures::useAVX512), 12 | USE_LZCNT (JoltFeatures::useLZCNT), 13 | USE_TZCNT (JoltFeatures::useTZCNT), 14 | USE_F16C (JoltFeatures::useF16C), 15 | USE_FMADD (JoltFeatures::useFMADD); 16 | 17 | final Predicate test; 18 | 19 | JoltFeature(Predicate test) { 20 | this.test = test; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jolt/JoltFeatures.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | public record JoltFeatures( 4 | boolean doublePrecision, 5 | boolean useSSE4_1, 6 | boolean useSSE4_2, 7 | boolean useAVX, 8 | boolean useAVX2, 9 | boolean useAVX512, 10 | boolean useLZCNT, 11 | boolean useTZCNT, 12 | boolean useF16C, 13 | boolean useFMADD 14 | ) { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/jolt/JoltNative.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | import javax.annotation.Nullable; 4 | import java.lang.foreign.MemoryAddress; 5 | 6 | public interface JoltNative { 7 | MemoryAddress address(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/jolt/SegmentedJoltNative.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | import java.lang.foreign.MemorySegment; 5 | 6 | public non-sealed abstract class SegmentedJoltNative extends BaseJoltNative { 7 | protected final MemorySegment handle; 8 | 9 | protected SegmentedJoltNative(MemorySegment handle) { 10 | this.handle = handle; 11 | } 12 | 13 | @Override 14 | public MemoryAddress address() { 15 | return handle.address(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/jolt/UnimplementedException.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | public final class UnimplementedException extends RuntimeException {} 4 | -------------------------------------------------------------------------------- /src/main/java/jolt/core/JobSystem.java: -------------------------------------------------------------------------------- 1 | package jolt.core; 2 | 3 | import jolt.DeletableJoltNative; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public final class JobSystem extends DeletableJoltNative { 10 | public static final int MAX_PHYSICS_JOBS = JPC_MAX_PHYSICS_JOBS(); 11 | public static final int MAX_PHYSICS_BARRIERS = JPC_MAX_PHYSICS_BARRIERS(); 12 | 13 | //region Jolt-Pointer 14 | private JobSystem(MemoryAddress handle) { 15 | super(handle); 16 | } 17 | 18 | public static JobSystem at(MemoryAddress addr) { 19 | return addr == MemoryAddress.NULL ? null : new JobSystem(addr); 20 | } 21 | //endregion Jolt-Pointer 22 | 23 | public static JobSystem of(int maxJobs, int maxBarriers, int numThreads) { 24 | return new JobSystem(JPC_JobSystem_Create(maxJobs, maxBarriers, numThreads)); 25 | } 26 | 27 | @Override 28 | protected void deleteInternal() { 29 | JPC_JobSystem_Destroy(handle); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/jolt/core/Result.java: -------------------------------------------------------------------------------- 1 | package jolt.core; 2 | 3 | import jolt.SegmentedJoltNative; 4 | 5 | import javax.annotation.Nullable; 6 | import java.lang.foreign.MemorySegment; 7 | 8 | public abstract class Result extends SegmentedJoltNative { 9 | //region Jolt-Value-Protected 10 | protected Result(MemorySegment handle) { 11 | super(handle); 12 | } 13 | //endregion Jolt-Value-Protected 14 | 15 | public abstract boolean hasError(); 16 | 17 | public abstract @Nullable T or(); 18 | 19 | public T orThrow() { 20 | var result = or(); 21 | if (result == null) throwError(); 22 | return result; 23 | } 24 | 25 | public abstract String getError(); 26 | 27 | public void throwError() { 28 | throw new RuntimeException(getError()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/jolt/core/SharedMutex.java: -------------------------------------------------------------------------------- 1 | package jolt.core; 2 | 3 | import jolt.AddressedJoltNative; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | public final class SharedMutex extends AddressedJoltNative { 8 | //region Jolt-Pointer 9 | private SharedMutex(MemoryAddress handle) { 10 | super(handle); 11 | } 12 | 13 | public static SharedMutex at(MemoryAddress addr) { 14 | return addr == MemoryAddress.NULL ? null : new SharedMutex(addr); 15 | } 16 | //endregion Jolt-Pointer 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/jolt/core/TempAllocator.java: -------------------------------------------------------------------------------- 1 | package jolt.core; 2 | 3 | import jolt.DeletableJoltNative; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public final class TempAllocator extends DeletableJoltNative { 10 | //region Jolt-Pointer 11 | private TempAllocator(MemoryAddress handle) { 12 | super(handle); 13 | } 14 | 15 | public static TempAllocator at(MemoryAddress addr) { 16 | return addr == MemoryAddress.NULL ? null : new TempAllocator(addr); 17 | } 18 | //endregion Jolt-Pointer 19 | 20 | public static TempAllocator of(int size) { 21 | return new TempAllocator(JPC_TempAllocator_Create(size)); 22 | } 23 | 24 | @Override 25 | protected void deleteInternal() { 26 | JPC_TempAllocator_Destroy(handle); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/jolt/core/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.core; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/geometry/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.geometry; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/math/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.math; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/Activation.java: -------------------------------------------------------------------------------- 1 | package jolt.physics; 2 | 3 | public enum Activation { 4 | ACTIVATE, 5 | DONT_ACTIVATE; 6 | 7 | public static Activation ofValue(boolean value) { 8 | return value ? ACTIVATE : DONT_ACTIVATE; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/PhysicsStepListener.java: -------------------------------------------------------------------------------- 1 | package jolt.physics; 2 | 3 | import jolt.AddressedJoltNative; 4 | import jolt.headers.JPC_PhysicsStepListenerVTable; 5 | import jolt.headers.JPJ_PhysicsStepListener; 6 | 7 | import java.lang.foreign.MemoryAddress; 8 | import java.lang.foreign.MemorySegment; 9 | import java.lang.foreign.MemorySession; 10 | 11 | import static jolt.headers.JPC_PhysicsStepListenerVTable.*; 12 | import static jolt.headers.JPJ_PhysicsStepListener.*; 13 | 14 | public final class PhysicsStepListener extends AddressedJoltNative { 15 | //region Jolt-Pointer 16 | private PhysicsStepListener(MemoryAddress handle) { 17 | super(handle); 18 | } 19 | 20 | public static PhysicsStepListener at(MemoryAddress addr) { 21 | return addr == MemoryAddress.NULL ? null : new PhysicsStepListener(addr); 22 | } 23 | //endregion Jolt-Pointer 24 | 25 | public static PhysicsStepListener of(MemorySession arena, PhysicsStepListenerFn impl) { 26 | var vtable = JPC_PhysicsStepListenerVTable.allocate(arena); 27 | @SuppressWarnings("DataFlowIssue") 28 | MemorySegment onStep = OnStep.allocate((v0, v1, v2) -> 29 | impl.onStep(v1, PhysicsSystem.at(v2)), arena); 30 | OnStep$set(vtable, onStep.address()); 31 | 32 | var segment = JPJ_PhysicsStepListener.allocate(arena); 33 | vtable$set(segment, vtable.address()); 34 | return new PhysicsStepListener(segment.address()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/PhysicsStepListenerFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics; 2 | 3 | public interface PhysicsStepListenerFn { 4 | void onStep(float deltaTime, PhysicsSystem physicsSystem); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/BodyActivationListenerFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | public interface BodyActivationListenerFn { 4 | void onBodyActivated(int bodyId, long bodyUserData); 5 | 6 | void onBodyDeactivated(int bodyId, long bodyUserData); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/BodyIds.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | import java.util.Collection; 5 | 6 | import static jolt.headers.JoltPhysicsC.C_INT; 7 | 8 | public final class BodyIds { 9 | private BodyIds() {} 10 | 11 | public static final int INVALID_BODY_ID = 0xffffffff; 12 | public static final int MAX_BODY_INDEX = 0x7fffff; 13 | 14 | public static int index(int id) { 15 | return id & MAX_BODY_INDEX; 16 | } 17 | 18 | public static byte sequenceNumber(int id) { 19 | return (byte) (id >> 24); 20 | } 21 | 22 | public static boolean valid(int id) { 23 | return id != INVALID_BODY_ID; 24 | } 25 | 26 | public static String asString(int id) { 27 | return index(id) + "/" + sequenceNumber(id); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/BodyLock.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import jolt.SegmentedJoltNative; 4 | import jolt.core.SharedMutex; 5 | 6 | import javax.annotation.Nullable; 7 | import java.lang.foreign.MemorySegment; 8 | 9 | import static jolt.headers.JPC_BodyLockRead.*; 10 | 11 | public abstract sealed class BodyLock extends SegmentedJoltNative 12 | permits BodyLockRead, BodyLockWrite { 13 | //region Jolt-Value-Protected 14 | protected BodyLock(MemorySegment handle) { 15 | super(handle); 16 | } 17 | //endregion Jolt-Value 18 | 19 | public BodyLockInterface getLockInterface() { 20 | return BodyLockInterface.at(lock_interface$get(handle)); 21 | } 22 | 23 | public SharedMutex getMutex() { 24 | return SharedMutex.at(mutex$get(handle)); 25 | } 26 | 27 | public abstract @Nullable Body getBody(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/BodyLockInterface.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import jolt.AddressedJoltNative; 4 | import jolt.core.SharedMutex; 5 | 6 | import java.lang.foreign.MemoryAddress; 7 | 8 | import static jolt.headers.JoltPhysicsC.*; 9 | 10 | public final class BodyLockInterface extends AddressedJoltNative { 11 | //region Jolt-Pointer 12 | private BodyLockInterface(MemoryAddress handle) { 13 | super(handle); 14 | } 15 | 16 | public static BodyLockInterface at(MemoryAddress addr) { 17 | return addr == MemoryAddress.NULL ? null : new BodyLockInterface(addr); 18 | } 19 | //endregion Jolt-Pointer 20 | 21 | public void lockRead(int bodyId, BodyLockRead out) { 22 | JPC_BodyLockInterface_LockRead(handle, bodyId, out.address()); 23 | } 24 | 25 | public void unlockRead(BodyLockRead lock) { 26 | JPC_BodyLockInterface_UnlockRead(handle, lock.address()); 27 | } 28 | 29 | public void lockWrite(int bodyId, BodyLockWrite out) { 30 | JPC_BodyLockInterface_LockWrite(handle, bodyId, out.address()); 31 | } 32 | 33 | public void unlockWrite(BodyLockWrite lock) { 34 | JPC_BodyLockInterface_UnlockWrite(handle, lock.address()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/BodyLockRead.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import javax.annotation.Nullable; 4 | import java.lang.foreign.MemoryAddress; 5 | import java.lang.foreign.MemorySegment; 6 | import java.lang.foreign.MemorySession; 7 | import java.lang.foreign.SegmentAllocator; 8 | 9 | import static jolt.headers.JPC_BodyLockRead.*; 10 | 11 | public final class BodyLockRead extends BodyLock { 12 | //region Jolt-Value 13 | private BodyLockRead(MemorySegment handle) { 14 | super(handle); 15 | } 16 | 17 | public static BodyLockRead at(MemorySegment segment) { 18 | return new BodyLockRead(segment); 19 | } 20 | 21 | public static BodyLockRead at(MemorySession alloc, MemoryAddress addr) { 22 | return addr == MemoryAddress.NULL ? null : new BodyLockRead(ofAddress(addr, alloc)); 23 | } 24 | 25 | public static BodyLockRead of(SegmentAllocator alloc) { 26 | return new BodyLockRead(allocate(alloc)); 27 | } 28 | //endregion Jolt-Value 29 | 30 | public @Nullable Body getBody() { 31 | return Body.at(body$get(handle)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/BodyLockWrite.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import javax.annotation.Nullable; 4 | import java.lang.foreign.MemoryAddress; 5 | import java.lang.foreign.MemorySegment; 6 | import java.lang.foreign.MemorySession; 7 | import java.lang.foreign.SegmentAllocator; 8 | 9 | import static jolt.headers.JPC_BodyLockRead.*; 10 | 11 | public final class BodyLockWrite extends BodyLock { 12 | //region Jolt-Value 13 | private BodyLockWrite(MemorySegment handle) { 14 | super(handle); 15 | } 16 | 17 | public static BodyLockWrite at(MemorySegment segment) { 18 | return new BodyLockWrite(segment); 19 | } 20 | 21 | public static BodyLockWrite at(MemorySession alloc, MemoryAddress addr) { 22 | return addr == MemoryAddress.NULL ? null : new BodyLockWrite(ofAddress(addr, alloc)); 23 | } 24 | 25 | public static BodyLockWrite of(SegmentAllocator alloc) { 26 | return new BodyLockWrite(allocate(alloc)); 27 | } 28 | //endregion Jolt-Value 29 | 30 | public @Nullable MutableBody getBody() { 31 | return MutableBody.at(body$get(handle)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/MotionProperties.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import jolt.Jolt; 4 | import jolt.JoltNative; 5 | import jolt.math.FMat44; 6 | import jolt.math.FVec3; 7 | import jolt.math.Quat; 8 | 9 | import java.lang.foreign.MemoryAddress; 10 | 11 | // TODO 12 | public interface MotionProperties extends JoltNative { 13 | static MotionProperties at(MemoryAddress addr) { 14 | return addr == MemoryAddress.NULL ? null : new MotionPropertiesImpl(addr); 15 | } 16 | 17 | MotionQuality getMotionQuality(); 18 | 19 | void getLinearVelocity(FVec3 out); 20 | 21 | void getAngularVelocity(FVec3 out); 22 | 23 | float getMaxLinearVelocity(); 24 | 25 | float getMaxAngularVelocity(); 26 | 27 | float getLinearDamping(); 28 | 29 | float getAngularDamping(); 30 | 31 | float getGravityFactor(); 32 | 33 | float getInverseMass(); 34 | 35 | void getInverseInertiaDiagonal(FVec3 out); 36 | 37 | void getInertiaRotation(Quat out); 38 | 39 | void getLocalSpaceInverseInertia(FMat44 out); 40 | 41 | void getInverseInertiaForRotation(FMat44 rotation, FMat44 out); 42 | 43 | void multiplyWorldSpaceInverseInertiaByVector(Quat bodyRotation, FVec3 v, FVec3 out); 44 | 45 | void getPointVelocityCOM(FVec3 pointRelativeToCOM, FVec3 out); 46 | 47 | void getAccumulatedForce(FVec3 out); 48 | 49 | void getAccumulatedTorque(FVec3 out); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/MotionQuality.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | public enum MotionQuality { 4 | DISCRETE, 5 | LINEAR_CAST 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/MotionType.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | public enum MotionType { 4 | STATIC, 5 | KINEMATIC, 6 | DYNAMIC 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/MutableMotionProperties.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | import jolt.math.FVec3; 4 | import jolt.math.Quat; 5 | 6 | import java.lang.foreign.MemoryAddress; 7 | 8 | public sealed interface MutableMotionProperties extends MotionProperties permits MotionPropertiesImpl { 9 | static MutableMotionProperties at(MemoryAddress addr) { 10 | return addr == MemoryAddress.NULL ? null : new MotionPropertiesImpl(addr); 11 | } 12 | 13 | void setLinearVelocity(FVec3 linearVelocity); 14 | 15 | void setLinearVelocityClamped(FVec3 linearVelocity); 16 | 17 | void setAngularVelocity(FVec3 angularVelocity); 18 | 19 | void setAngularVelocityClamped(FVec3 angularVelocity); 20 | 21 | void moveKinematic(FVec3 deltaPosition, Quat deltaRotation, float deltaTime); 22 | 23 | void setMaxLinearVelocity(float linearVelocity); 24 | 25 | void setMaxAngularVelocity(float angularVelocity); 26 | 27 | void clampLinearVelocity(); 28 | 29 | void clampAngularVelocity(); 30 | 31 | void setLinearDamping(float linearDamping); 32 | 33 | void setAngularDamping(float angularDamping); 34 | 35 | void setGravityFactor(float gravityFactor); 36 | 37 | void setInverseMass(float inverseMass); 38 | 39 | void setInverseInertia(FVec3 diagonal, Quat rot); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/OverrideMassProperties.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.body; 2 | 3 | public enum OverrideMassProperties { 4 | CALCULATE_MASS_AND_INERTIA, 5 | CALCULATE_INERTIA, 6 | MASS_AND_INERTIA_PROVIDED 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/body/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.physics.body; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/ActiveEdgeMode.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public enum ActiveEdgeMode { 4 | COLLIDE_ONLY_WITH_ACTIVE, 5 | COLLIDE_WITH_ALL 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/BackFaceMode.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public enum BackFaceMode { 4 | IGNORE_BACK_FACES, 5 | COLLIDE_WITH_BACK_FACES 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/BodyFilterFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import jolt.physics.body.Body; 4 | 5 | public interface BodyFilterFn { 6 | boolean shouldCollide(int bodyId); 7 | 8 | boolean shouldCollideLocked(Body body); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/CastRayCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface CastRayCollectorFn extends CollisionCollectorFn {} 4 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/CollectFacesMode.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public enum CollectFacesMode { 4 | COLLECT_FACES, 5 | NO_FACES 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/CollidePointCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface CollidePointCollectorFn extends CollisionCollectorFn {} 4 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/CollideShapeCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface CollideShapeCollectorFn extends CollisionCollectorFn {} 4 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/CollisionCollector.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import jolt.SegmentedJoltNative; 4 | 5 | import java.lang.foreign.MemorySegment; 6 | import java.lang.foreign.MemorySession; 7 | 8 | import static jolt.headers.JoltPhysicsC.*; 9 | 10 | public abstract class CollisionCollector extends SegmentedJoltNative { 11 | protected CollisionCollector(MemorySegment segment) { 12 | super(segment); 13 | } 14 | 15 | public void reset() { 16 | JPC_CollisionCollector_Reset(handle); 17 | } 18 | 19 | public abstract float getEarlyOutFraction(); 20 | 21 | public abstract TransformedShape getContext(MemorySession arena); 22 | 23 | public abstract void setContext(TransformedShape context); 24 | 25 | public void updateEarlyOutFraction(float fraction) { 26 | JPC_CollisionCollector_UpdateEarlyOutFraction(handle, fraction); 27 | } 28 | 29 | public void resetEarlyOutFraction(float fraction) { 30 | JPC_CollisionCollector_ResetEarlyOutFraction(handle, fraction); 31 | } 32 | 33 | public abstract void forceEarlyOut(); 34 | 35 | public abstract boolean shouldEarlyOut(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/CollisionCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import jolt.physics.body.Body; 4 | 5 | public interface CollisionCollectorFn { 6 | default void onBody(Body body) {} 7 | 8 | void addHit(R result); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/ContactListenerFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import jolt.math.DVec3; 4 | import jolt.math.FVec3; 5 | import jolt.physics.body.Body; 6 | import jolt.physics.collision.shape.SubShapeIdPair; 7 | 8 | public interface ContactListenerFn { 9 | void onContactAdded(Body body1, Body body2, ContactManifold manifold, ContactSettings settings); 10 | 11 | void onContactPersisted(Body body1, Body body2, ContactManifold manifold, ContactSettings settings); 12 | 13 | void onContactRemoved(SubShapeIdPair subShapeIdPair); 14 | 15 | interface F extends ContactListenerFn { 16 | ValidateResult onContactValidate(Body body1, Body body2, FVec3 baseOffset, CollideShapeResult collisionResult); 17 | } 18 | 19 | interface D extends ContactListenerFn { 20 | ValidateResult onContactValidate(Body body1, Body body2, DVec3 baseOffset, CollideShapeResult collisionResult); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/GroupFilter.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import jolt.JoltNative; 4 | 5 | // TODO 6 | public interface GroupFilter extends JoltNative { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/ObjectLayerFilterFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface ObjectLayerFilterFn { 4 | boolean shouldCollide(short layer); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/ObjectLayerPairFilterFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface ObjectLayerPairFilterFn { 4 | boolean shouldCollide(short layer1, short layer2); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/PhysicsMaterial.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import jolt.AddressedJoltNative; 4 | 5 | import java.lang.foreign.Addressable; 6 | import java.lang.foreign.MemoryAddress; 7 | 8 | public final class PhysicsMaterial extends AddressedJoltNative { 9 | //region Jolt-Pointer 10 | private PhysicsMaterial(MemoryAddress handle) { 11 | super(handle); 12 | } 13 | 14 | public static PhysicsMaterial at(MemoryAddress addr) { 15 | return addr == MemoryAddress.NULL ? null : new PhysicsMaterial(addr); 16 | } 17 | //endregion Jolt-Pointer 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/RayCastResult.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | import java.lang.foreign.MemorySegment; 5 | import java.lang.foreign.MemorySession; 6 | import java.lang.foreign.SegmentAllocator; 7 | 8 | import static jolt.headers.JPC_RayCastResult.*; 9 | 10 | public final class RayCastResult extends BroadPhaseCastResult { 11 | //region Jolt-Value 12 | private RayCastResult(MemorySegment handle) { 13 | super(handle); 14 | } 15 | 16 | public static RayCastResult at(MemorySegment segment) { 17 | return new RayCastResult(segment); 18 | } 19 | 20 | public static RayCastResult at(MemorySession alloc, MemoryAddress addr) { 21 | return addr == MemoryAddress.NULL ? null : new RayCastResult(ofAddress(addr, alloc)); 22 | } 23 | 24 | public static RayCastResult of(SegmentAllocator alloc) { 25 | return new RayCastResult(allocate(alloc)); 26 | } 27 | //endregion Jolt-Value 28 | 29 | public int getSubShapeId() { 30 | return sub_shape_id$get(handle); 31 | } 32 | 33 | public void setSubShapeId(int subShapeId) { 34 | sub_shape_id$set(handle, subShapeId); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/ShapeFilterFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface ShapeFilterFn { 4 | boolean shouldPairCollide(int subShapeId); 5 | 6 | boolean shouldPairCollide(int subShapeId1, int subShapeId2); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/TransformedShapeCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public interface TransformedShapeCollectorFn extends CollisionCollectorFn {} 4 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/ValidateResult.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision; 2 | 3 | public enum ValidateResult { 4 | ACCEPT_ALL_CONTACTS_FOR_THIS_BODY_PAIR, 5 | ACCEPT_CONTACT, 6 | REJECT_CONTACT, 7 | REJECT_ALL_CONTACTS_FOR_THIS_BODY_PAIR 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/BroadPhaseLayerFilterFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.broadphase; 2 | 3 | public interface BroadPhaseLayerFilterFn { 4 | boolean shouldCollide(byte layer); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/BroadPhaseLayerInterfaceFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.broadphase; 2 | 3 | public interface BroadPhaseLayerInterfaceFn { 4 | int getNumBroadPhaseLayers(); 5 | 6 | byte getBroadPhaseLayer(short layer); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/CastShapeBodyCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.broadphase; 2 | 3 | import jolt.physics.collision.BroadPhaseCastResult; 4 | import jolt.physics.collision.CollisionCollectorFn; 5 | 6 | public interface CastShapeBodyCollectorFn extends CollisionCollectorFn {} 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/CollideShapeBodyCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.broadphase; 2 | 3 | import jolt.physics.collision.CollisionCollectorFn; 4 | 5 | public interface CollideShapeBodyCollectorFn extends CollisionCollectorFn {} 6 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/ObjectVsBroadPhaseLayerFilterFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.broadphase; 2 | 3 | public interface ObjectVsBroadPhaseLayerFilterFn { 4 | boolean shouldCollide(short layer1, byte layer2); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/RayCastBodyCollectorFn.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.broadphase; 2 | 3 | import jolt.physics.collision.BroadPhaseCastResult; 4 | import jolt.physics.collision.CollisionCollectorFn; 5 | 6 | public interface RayCastBodyCollectorFn extends CollisionCollectorFn {} 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/broadphase/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.physics.collision.broadphase; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.physics.collision; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/BoxShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.math.FVec3; 5 | import jolt.physics.collision.PhysicsMaterial; 6 | 7 | import javax.annotation.Nullable; 8 | import java.lang.foreign.MemoryAddress; 9 | 10 | import static jolt.headers.JoltPhysicsC.*; 11 | 12 | public final class BoxShape extends ConvexShape { 13 | //region Jolt-Pointer 14 | private BoxShape(MemoryAddress handle) { 15 | super(handle); 16 | } 17 | 18 | public static BoxShape at(MemoryAddress addr) { 19 | return addr == MemoryAddress.NULL ? null : new BoxShape(addr); 20 | } 21 | //endregion Jolt-Pointer 22 | 23 | public static BoxShape of(FVec3 halfExtent, float convexRadius, @Nullable PhysicsMaterial material) { 24 | return new BoxShape(JPC_BoxShape_Create(halfExtent.address(), convexRadius, Jolt.ptr(material))); 25 | } 26 | 27 | public static BoxShape of(FVec3 halfExtent, float convexRadius) { 28 | return of(halfExtent, convexRadius, null); 29 | } 30 | 31 | public static BoxShape of(FVec3 halfExtent) { 32 | return of(halfExtent, Shape.DEFAULT_CONVEX_RADIUS, null); 33 | } 34 | 35 | public void getHalfExtent(FVec3 out) { 36 | JPC_BoxShape_GetHalfExtent(handle, out.address()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/CapsuleShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.physics.collision.PhysicsMaterial; 5 | 6 | import javax.annotation.Nullable; 7 | import java.lang.foreign.MemoryAddress; 8 | 9 | import static jolt.headers.JoltPhysicsC.*; 10 | 11 | public final class CapsuleShape extends ConvexShape { 12 | //region Jolt-Pointer 13 | private CapsuleShape(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static CapsuleShape at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new CapsuleShape(addr); 19 | } 20 | //endregion Jolt-Pointer 21 | 22 | public static CapsuleShape of(float halfHeight, float radius, @Nullable PhysicsMaterial material) { 23 | return new CapsuleShape(JPC_CapsuleShape_Create(halfHeight, radius, Jolt.ptr(material))); 24 | } 25 | 26 | public static CapsuleShape of(float halfHeight, float radius) { 27 | return of(halfHeight, radius, null); 28 | } 29 | 30 | public float getRadius() { 31 | return JPC_CapsuleShape_GetRadius(handle); 32 | } 33 | 34 | public float getHalfHeight() { 35 | return JPC_CapsuleShape_GetHalfHeightOfCylinder(handle); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/CompoundShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | import static jolt.headers.JoltPhysicsC.*; 6 | 7 | public sealed class CompoundShape extends Shape 8 | permits StaticCompoundShape, MutableCompoundShape { 9 | //region Jolt-Pointer-Protected 10 | protected CompoundShape(MemoryAddress handle) { 11 | super(handle); 12 | } 13 | 14 | public static CompoundShape at(MemoryAddress addr) { 15 | return addr == MemoryAddress.NULL ? null : new CompoundShape(addr); 16 | } 17 | //endregion Jolt-Pointer-Protected 18 | 19 | // TODO getSubShapes 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/CompoundShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.math.FVec3; 4 | import jolt.math.Quat; 5 | 6 | import java.lang.foreign.MemoryAddress; 7 | 8 | import static jolt.headers.JoltPhysicsC.*; 9 | 10 | public sealed class CompoundShapeSettings extends ShapeSettings 11 | permits StaticCompoundShapeSettings, MutableCompoundShapeSettings { 12 | //region Jolt-Pointer-Protected 13 | protected CompoundShapeSettings(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static CompoundShapeSettings at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new CompoundShapeSettings(addr); 19 | } 20 | //endregion Jolt-Pointer-Protected 21 | 22 | public void addShape(FVec3 position, Quat rotation, ShapeSettings settings, int userData) { 23 | JPC_CompoundShapeSettings_AddShapeSettings(handle, 24 | position.address(), 25 | rotation.address(), 26 | settings.address(), 27 | userData 28 | ); 29 | } 30 | 31 | public void addShape(FVec3 position, Quat rotation, Shape settings, int userData) { 32 | JPC_CompoundShapeSettings_AddShape(handle, 33 | position.address(), 34 | rotation.address(), 35 | settings.address(), 36 | userData 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ConvexHullShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.Addressable; 4 | import java.lang.foreign.MemoryAddress; 5 | 6 | import static jolt.headers.JoltPhysicsC.*; 7 | 8 | public final class ConvexHullShape extends ConvexShape { 9 | //region Jolt-Pointer 10 | private ConvexHullShape(MemoryAddress handle) { 11 | super(handle); 12 | } 13 | 14 | public static ConvexHullShape at(MemoryAddress addr) { 15 | return addr == MemoryAddress.NULL ? null : new ConvexHullShape(addr); 16 | } 17 | //endregion Jolt-Pointer 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ConvexShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.physics.collision.PhysicsMaterial; 5 | 6 | import javax.annotation.Nullable; 7 | import java.lang.foreign.MemoryAddress; 8 | 9 | import static jolt.headers.JoltPhysicsC.*; 10 | 11 | public sealed class ConvexShapeSettings extends ShapeSettings 12 | permits SphereShapeSettings, BoxShapeSettings, TriangleShapeSettings, CapsuleShapeSettings, 13 | TaperedCapsuleShapeSettings, CylinderShapeSettings, ConvexHullShapeSettings { 14 | //region Jolt-Pointer-Protected 15 | protected ConvexShapeSettings(MemoryAddress handle) { 16 | super(handle); 17 | } 18 | 19 | public static ConvexShapeSettings at(MemoryAddress addr) { 20 | return addr == MemoryAddress.NULL ? null : new ConvexShapeSettings(addr); 21 | } 22 | //endregion Jolt-Pointer-Protected 23 | 24 | public @Nullable PhysicsMaterial getMaterial() { 25 | return PhysicsMaterial.at(JPC_ConvexShapeSettings_GetMaterial(handle)); 26 | } 27 | 28 | public void setMaterial(@Nullable PhysicsMaterial material) { 29 | JPC_ConvexShapeSettings_SetMaterial(handle, Jolt.ptr(material)); 30 | } 31 | 32 | public float getDensity() { 33 | return JPC_ConvexShapeSettings_GetDensity(handle); 34 | } 35 | 36 | public void setDensity(float density) { 37 | JPC_ConvexShapeSettings_SetDensity(handle, density); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/CylinderShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.physics.collision.PhysicsMaterial; 5 | 6 | import javax.annotation.Nullable; 7 | import java.lang.foreign.MemoryAddress; 8 | 9 | import static jolt.headers.JoltPhysicsC.*; 10 | 11 | public final class CylinderShape extends ConvexShape { 12 | //region Jolt-Pointer 13 | private CylinderShape(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static CylinderShape at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new CylinderShape(addr); 19 | } 20 | //endregion Jolt-Pointer 21 | 22 | public static CylinderShape of(float halfHeight, float radius, float convexRadius, @Nullable PhysicsMaterial material) { 23 | return new CylinderShape(JPC_CylinderShape_Create(halfHeight, radius, convexRadius, Jolt.ptr(material))); 24 | } 25 | 26 | public static CylinderShape of(float halfHeight, float radius, float convexRadius) { 27 | return of(halfHeight, radius, convexRadius, null); 28 | } 29 | 30 | public float getRadius() { 31 | return JPC_CylinderShape_GetRadius(handle); 32 | } 33 | 34 | public float getHalfHeight() { 35 | return JPC_CylinderShape_GetHalfHeight(handle); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/DecoratedShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | import static jolt.headers.JoltPhysicsC.*; 6 | 7 | public sealed class DecoratedShape extends Shape 8 | permits ScaledShape, RotatedTranslatedShape, OffsetCenterOfMassShape { 9 | //region Jolt-Pointer-Protected 10 | protected DecoratedShape(MemoryAddress handle) { 11 | super(handle); 12 | } 13 | 14 | public static DecoratedShape at(MemoryAddress addr) { 15 | return addr == MemoryAddress.NULL ? null : new DecoratedShape(addr); 16 | } 17 | //endregion Jolt-Pointer-Protected 18 | 19 | public Shape getInnerShape() { 20 | return Shape.at(JPC_DecoratedShape_GetInnerShape(handle)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/HeightFieldSamples.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.SegmentedJoltNative; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | import java.lang.foreign.MemorySegment; 7 | import java.lang.foreign.MemorySession; 8 | import java.lang.foreign.SegmentAllocator; 9 | 10 | import static jolt.headers.JPC_ContactSettings.*; 11 | import static jolt.headers.JoltPhysicsC.*; 12 | 13 | public final class HeightFieldSamples extends SegmentedJoltNative { 14 | //region Jolt-Value 15 | private HeightFieldSamples(MemorySegment handle) { 16 | super(handle); 17 | } 18 | 19 | public static HeightFieldSamples at(MemorySegment segment) { 20 | return new HeightFieldSamples(segment); 21 | } 22 | 23 | public static HeightFieldSamples at(MemorySession alloc, MemoryAddress addr) { 24 | return addr == MemoryAddress.NULL ? null : new HeightFieldSamples(ofAddress(addr, alloc)); 25 | } 26 | 27 | public static HeightFieldSamples of(SegmentAllocator alloc) { 28 | return new HeightFieldSamples(allocate(alloc)); 29 | } 30 | //endregion Jolt-Value 31 | 32 | public static HeightFieldSamples of(SegmentAllocator alloc, float... samples) { 33 | return new HeightFieldSamples(alloc.allocateArray(C_FLOAT, samples)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/HeightFieldShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | public final class HeightFieldShape extends Shape { 6 | //region Jolt-Pointer 7 | private HeightFieldShape(MemoryAddress handle) { 8 | super(handle); 9 | } 10 | 11 | public static HeightFieldShape at(MemoryAddress addr) { 12 | return addr == MemoryAddress.NULL ? null : new HeightFieldShape(addr); 13 | } 14 | //endregion Jolt-Pointer 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/MeshShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | public final class MeshShape extends Shape { 6 | //region Jolt-Pointer 7 | private MeshShape(MemoryAddress handle) { 8 | super(handle); 9 | } 10 | 11 | public static MeshShape at(MemoryAddress addr) { 12 | return addr == MemoryAddress.NULL ? null : new MeshShape(addr); 13 | } 14 | //endregion Jolt-Pointer 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/MutableCompoundShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | public final class MutableCompoundShape extends CompoundShape { 6 | //region Jolt-Pointer 7 | private MutableCompoundShape(MemoryAddress handle) { 8 | super(handle); 9 | } 10 | 11 | public static MutableCompoundShape at(MemoryAddress addr) { 12 | return addr == MemoryAddress.NULL ? null : new MutableCompoundShape(addr); 13 | } 14 | //endregion Jolt-Pointer 15 | 16 | // TODO addShape 17 | // TODO removeShape 18 | // TODO modifyShape 19 | // TODO modifyShapes 20 | // TODO adjustCenterOfMass 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/MutableCompoundShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | import static jolt.headers.JoltPhysicsC.*; 6 | 7 | public final class MutableCompoundShapeSettings extends CompoundShapeSettings { 8 | //region Jolt-Pointer 9 | private MutableCompoundShapeSettings(MemoryAddress handle) { 10 | super(handle); 11 | } 12 | 13 | public static MutableCompoundShapeSettings at(MemoryAddress addr) { 14 | return addr == MemoryAddress.NULL ? null : new MutableCompoundShapeSettings(addr); 15 | } 16 | //endregion Jolt-Pointer 17 | 18 | public static MutableCompoundShapeSettings of() { 19 | return new MutableCompoundShapeSettings(JPC_MutableCompoundShapeSettings_Create()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/OffsetCenterOfMassShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.math.FVec3; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public final class OffsetCenterOfMassShape extends DecoratedShape { 10 | //region Jolt-Pointer 11 | private OffsetCenterOfMassShape(MemoryAddress handle) { 12 | super(handle); 13 | } 14 | 15 | public static OffsetCenterOfMassShape at(MemoryAddress addr) { 16 | return addr == MemoryAddress.NULL ? null : new OffsetCenterOfMassShape(addr); 17 | } 18 | //endregion Jolt-Pointer 19 | 20 | public static OffsetCenterOfMassShape of(Shape shape, FVec3 offset) { 21 | return new OffsetCenterOfMassShape(JPC_OffsetCenterOfMassShape_Create(shape.address(), offset.address())); 22 | } 23 | 24 | public void getOffset(FVec3 out) { 25 | JPC_OffsetCenterOfMassShape_GetOffset(handle, out.address()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/OffsetCenterOfMassShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.math.FVec3; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public final class OffsetCenterOfMassShapeSettings extends DecoratedShapeSettings { 10 | //region Jolt-Pointer 11 | private OffsetCenterOfMassShapeSettings(MemoryAddress handle) { 12 | super(handle); 13 | } 14 | 15 | public static OffsetCenterOfMassShapeSettings at(MemoryAddress addr) { 16 | return addr == MemoryAddress.NULL ? null : new OffsetCenterOfMassShapeSettings(addr); 17 | } 18 | //endregion Jolt-Pointer 19 | 20 | public static OffsetCenterOfMassShapeSettings of(ShapeSettings shape, FVec3 offset) { 21 | return new OffsetCenterOfMassShapeSettings(JPC_OffsetCenterOfMassShapeSettings_CreateFromSettings(shape.address(), offset.address())); 22 | } 23 | 24 | public static OffsetCenterOfMassShapeSettings of(Shape shape, FVec3 offset) { 25 | return new OffsetCenterOfMassShapeSettings(JPC_OffsetCenterOfMassShapeSettings_CreateFromShape(shape.address(), offset.address())); 26 | } 27 | 28 | public void getOffset(FVec3 out) { 29 | JPC_OffsetCenterOfMassShapeSettings_GetOffset(handle, out.address()); 30 | } 31 | 32 | public void setOffset(FVec3 offset) { 33 | JPC_OffsetCenterOfMassShapeSettings_SetOffset(handle, offset.address()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/RotatedTranslatedShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.math.FVec3; 4 | import jolt.math.Quat; 5 | 6 | import java.lang.foreign.MemoryAddress; 7 | 8 | import static jolt.headers.JoltPhysicsC.*; 9 | 10 | public final class RotatedTranslatedShape extends DecoratedShape { 11 | //region Jolt-Pointer 12 | private RotatedTranslatedShape(MemoryAddress handle) { 13 | super(handle); 14 | } 15 | 16 | public static RotatedTranslatedShape at(MemoryAddress addr) { 17 | return addr == MemoryAddress.NULL ? null : new RotatedTranslatedShape(addr); 18 | } 19 | //endregion Jolt-Pointer 20 | 21 | public static RotatedTranslatedShape of(Shape shape, FVec3 position, Quat rotation) { 22 | return new RotatedTranslatedShape(JPC_RotatedTranslatedShape_Create(shape.address(), position.address(), rotation.address())); 23 | } 24 | 25 | public void getPosition(FVec3 out) { 26 | JPC_RotatedTranslatedShape_GetPosition(handle, out.address()); 27 | } 28 | 29 | public void getRotation(Quat out) { 30 | JPC_RotatedTranslatedShape_GetRotation(handle, out.address()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ScaledShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.math.FVec3; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public final class ScaledShape extends DecoratedShape { 10 | //region Jolt-Pointer 11 | private ScaledShape(MemoryAddress handle) { 12 | super(handle); 13 | } 14 | 15 | public static ScaledShape at(MemoryAddress addr) { 16 | return addr == MemoryAddress.NULL ? null : new ScaledShape(addr); 17 | } 18 | //endregion Jolt-Pointer 19 | 20 | public static ScaledShape of(Shape shape, FVec3 scale) { 21 | return new ScaledShape(JPC_ScaledShape_Create(shape.address(), scale.address())); 22 | } 23 | 24 | public void getScale(FVec3 out) { 25 | JPC_ScaledShape_GetScale(handle, out.address()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ScaledShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.math.FVec3; 5 | import jolt.physics.collision.PhysicsMaterial; 6 | 7 | import javax.annotation.Nullable; 8 | import java.lang.foreign.MemoryAddress; 9 | 10 | import static jolt.headers.JoltPhysicsC.*; 11 | 12 | public final class ScaledShapeSettings extends DecoratedShapeSettings { 13 | //region Jolt-Pointer 14 | private ScaledShapeSettings(MemoryAddress handle) { 15 | super(handle); 16 | } 17 | 18 | public static ScaledShapeSettings at(MemoryAddress addr) { 19 | return addr == MemoryAddress.NULL ? null : new ScaledShapeSettings(addr); 20 | } 21 | //endregion Jolt-Pointer 22 | 23 | public static ScaledShapeSettings of(ShapeSettings shape, FVec3 scale) { 24 | return new ScaledShapeSettings(JPC_ScaledShapeSettings_CreateFromSettings(shape.address(), scale.address())); 25 | } 26 | 27 | public static ScaledShapeSettings of(Shape shape, FVec3 scale) { 28 | return new ScaledShapeSettings(JPC_ScaledShapeSettings_CreateFromShape(shape.address(), scale.address())); 29 | } 30 | 31 | public void getScale(FVec3 out) { 32 | JPC_ScaledShapeSettings_GetScale(handle, out.address()); 33 | } 34 | 35 | public void setScale(FVec3 scale) { 36 | JPC_ScaledShapeSettings_SetScale(handle, scale.address()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ShapeResult.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.core.Result; 4 | 5 | import javax.annotation.Nullable; 6 | import java.lang.foreign.MemoryAddress; 7 | import java.lang.foreign.MemorySegment; 8 | import java.lang.foreign.MemorySession; 9 | import java.lang.foreign.SegmentAllocator; 10 | 11 | import static jolt.headers.JPC_ShapeResult.*; 12 | import static jolt.headers.JoltPhysicsC.*; 13 | 14 | public final class ShapeResult extends Result { 15 | //region Jolt-Value 16 | private ShapeResult(MemorySegment handle) { 17 | super(handle); 18 | } 19 | 20 | public static ShapeResult at(MemorySegment segment) { 21 | return new ShapeResult(segment); 22 | } 23 | 24 | public static ShapeResult at(MemorySession alloc, MemoryAddress addr) { 25 | return addr == MemoryAddress.NULL ? null : new ShapeResult(ofAddress(addr, alloc)); 26 | } 27 | 28 | public static ShapeResult of(SegmentAllocator alloc) { 29 | return new ShapeResult(allocate(alloc)); 30 | } 31 | //endregion Jolt-Value 32 | 33 | @Override 34 | public boolean hasError() { 35 | return result$get(handle) == MemoryAddress.NULL; 36 | } 37 | 38 | @Override 39 | public @Nullable Shape or() { 40 | return Shape.at(result$get(handle)); 41 | } 42 | 43 | @Override 44 | public String getError() { 45 | return error$slice(handle).getUtf8String(0); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.DeletableJoltNative; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | import java.lang.foreign.SegmentAllocator; 7 | 8 | import static jolt.headers.JoltPhysicsC.*; 9 | 10 | public sealed class ShapeSettings extends DeletableJoltNative 11 | permits ConvexShapeSettings, CompoundShapeSettings, DecoratedShapeSettings, MeshShapeSettings, HeightFieldShapeSettings { 12 | //region Jolt-Pointer-Protected 13 | protected ShapeSettings(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static ShapeSettings at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new ShapeSettings(addr); 19 | } 20 | //endregion Jolt-Pointer-Protected 21 | 22 | @Override 23 | protected void deleteInternal() { 24 | JPC_ShapeSettings_Release(handle); 25 | } 26 | 27 | public long getUserData() { 28 | return JPC_ShapeSettings_GetUserData(handle); 29 | } 30 | 31 | public void setUserData(long userData) { 32 | JPC_ShapeSettings_SetUserData(handle, userData); 33 | } 34 | 35 | public ShapeResult create(SegmentAllocator alloc) { 36 | return ShapeResult.at(JPC_ShapeSettings_CreateShape(alloc, handle)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ShapeSubType.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | public enum ShapeSubType { 4 | SPHERE, 5 | BOX, 6 | TRIANGLE, 7 | CAPSULE, 8 | TAPERED_CAPSULE, 9 | CYLINDER, 10 | CONVEX_HULL, 11 | 12 | STATIC_COMPOUND, 13 | MUTABLE_COMPOUND, 14 | 15 | ROTATED_TRANSLATED, 16 | SCALED, 17 | OFFSET_CENTER_OF_MASS, 18 | 19 | MESH, 20 | HEIGHT_FIELD, 21 | 22 | USER1, 23 | USER2, 24 | USER3, 25 | USER4, 26 | USER5, 27 | USER6, 28 | USER7, 29 | USER8 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/ShapeType.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | public enum ShapeType { 4 | CONVEX, 5 | COMPOUND, 6 | DECORATED, 7 | MESH, 8 | HEIGHT_FIELD, 9 | 10 | USER1, 11 | USER2, 12 | USER3, 13 | USER4 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/SphereShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.physics.collision.PhysicsMaterial; 5 | 6 | import javax.annotation.Nullable; 7 | import java.lang.foreign.MemoryAddress; 8 | 9 | import static jolt.headers.JoltPhysicsC.*; 10 | 11 | public final class SphereShape extends ConvexShape { 12 | //region Jolt-Pointer 13 | private SphereShape(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static SphereShape at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new SphereShape(addr); 19 | } 20 | //endregion Jolt-Pointer 21 | 22 | public static SphereShape of(float radius, @Nullable PhysicsMaterial material) { 23 | return new SphereShape(JPC_SphereShape_Create(radius, Jolt.ptr(material))); 24 | } 25 | 26 | public static SphereShape of(float radius) { 27 | return of(radius, null); 28 | } 29 | 30 | public float getRadius() { 31 | return JPC_SphereShape_GetRadius(handle); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/SphereShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.Jolt; 4 | import jolt.physics.collision.PhysicsMaterial; 5 | 6 | import javax.annotation.Nullable; 7 | import java.lang.foreign.MemoryAddress; 8 | 9 | import static jolt.headers.JoltPhysicsC.*; 10 | 11 | public final class SphereShapeSettings extends ConvexShapeSettings { 12 | //region Jolt-Pointer 13 | private SphereShapeSettings(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static SphereShapeSettings at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new SphereShapeSettings(addr); 19 | } 20 | //endregion Jolt-Pointer 21 | 22 | public static SphereShapeSettings of(float radius, @Nullable PhysicsMaterial material) { 23 | return new SphereShapeSettings(JPC_SphereShapeSettings_Create(radius, Jolt.ptr(material))); 24 | } 25 | 26 | public static SphereShapeSettings of(float radius) { 27 | return of(radius, null); 28 | } 29 | 30 | public float getRadius() { 31 | return JPC_SphereShapeSettings_GetRadius(handle); 32 | } 33 | 34 | public void setRadius(float radius) { 35 | JPC_SphereShapeSettings_SetRadius(handle, radius); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/StaticCompoundShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | public final class StaticCompoundShape extends CompoundShape { 6 | //region Jolt-Pointer 7 | private StaticCompoundShape(MemoryAddress handle) { 8 | super(handle); 9 | } 10 | 11 | public static StaticCompoundShape at(MemoryAddress addr) { 12 | return addr == MemoryAddress.NULL ? null : new StaticCompoundShape(addr); 13 | } 14 | //endregion Jolt-Pointer 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/StaticCompoundShapeSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import jolt.core.TempAllocator; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | import java.lang.foreign.SegmentAllocator; 7 | 8 | import static jolt.headers.JoltPhysicsC.*; 9 | 10 | public final class StaticCompoundShapeSettings extends CompoundShapeSettings { 11 | //region Jolt-Pointer 12 | private StaticCompoundShapeSettings(MemoryAddress handle) { 13 | super(handle); 14 | } 15 | 16 | public static StaticCompoundShapeSettings at(MemoryAddress addr) { 17 | return addr == MemoryAddress.NULL ? null : new StaticCompoundShapeSettings(addr); 18 | } 19 | //endregion Jolt-Pointer 20 | 21 | public static StaticCompoundShapeSettings of() { 22 | return new StaticCompoundShapeSettings(JPC_StaticCompoundShapeSettings_Create()); 23 | } 24 | 25 | public ShapeResult create(SegmentAllocator alloc, TempAllocator tempAllocator) { 26 | return ShapeResult.at(JPC_StaticCompoundShapeSettings_CreateShape(alloc, handle, tempAllocator.address())); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/SubShapeIds.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.MemoryAddress; 4 | 5 | import static jolt.headers.JoltPhysicsC.C_INT; 6 | 7 | public final class SubShapeIds { 8 | private SubShapeIds() {} 9 | 10 | public static int at(MemoryAddress address) { 11 | return address.get(C_INT, 0); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/TaperedCapsuleShape.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.collision.shape; 2 | 3 | import java.lang.foreign.Addressable; 4 | import java.lang.foreign.MemoryAddress; 5 | 6 | public final class TaperedCapsuleShape extends ConvexShape { 7 | //region Jolt-Pointer 8 | private TaperedCapsuleShape(MemoryAddress handle) { 9 | super(handle); 10 | } 11 | 12 | public static TaperedCapsuleShape at(MemoryAddress addr) { 13 | return addr == MemoryAddress.NULL ? null : new TaperedCapsuleShape(addr); 14 | } 15 | //endregion Jolt-Pointer 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/collision/shape/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.physics.collision.shape; 3 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/Axis.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | public enum Axis { 4 | TRANSLATION_X, 5 | TRANSLATION_Y, 6 | TRANSLATION_Z, 7 | 8 | ROTATION_X, 9 | ROTATION_Y, 10 | ROTATION_Z 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/ConeConstraint.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | import jolt.math.FVec3; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public final class ConeConstraint extends TwoBodyConstraint { 10 | //region Jolt-Pointer 11 | private ConeConstraint(MemoryAddress handle) { 12 | super(handle); 13 | } 14 | 15 | public static ConeConstraint at(MemoryAddress addr) { 16 | return addr == MemoryAddress.NULL ? null : new ConeConstraint(addr); 17 | } 18 | //endregion Jolt-Pointer 19 | 20 | public void setHalfConeAngle(float halfConeAngle) { 21 | JPC_ConeConstraint_SetHalfConeAngle(handle, halfConeAngle); 22 | } 23 | 24 | public float getCosHalfConeAngle() { 25 | return JPC_ConeConstraint_GetCosHalfConeAngle(handle); 26 | } 27 | 28 | public void getTotalLambdaPosition(FVec3 out) { 29 | JPC_ConeConstraint_GetTotalLambdaPosition(handle, out.address()); 30 | } 31 | 32 | public float getTotalLambdaRotation() { 33 | return JPC_ConeConstraint_GetTotalLambdaRotation(handle); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/ConstraintSpace.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | public enum ConstraintSpace { 4 | LOCAL_TO_BODY_COM, 5 | WORLD_SPACE 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/ConstraintSubType.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | public enum ConstraintSubType { 4 | FIXED, 5 | POINT, 6 | HINGE, 7 | SLIDER, 8 | DISTANCE, 9 | CONE, 10 | SWING_TWIST, 11 | SIX_DOF, 12 | PATH, 13 | VEHICLE, 14 | RACK_AND_PINION, 15 | GEAR, 16 | PULLEY, 17 | 18 | USER1, 19 | USER2, 20 | USER3, 21 | USER4 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/ConstraintType.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | public enum ConstraintType { 4 | CONSTRAINT, 5 | TWO_BODY_CONSTRAINT 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/FixedConstraint.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | import jolt.math.FVec3; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.JPC_FixedConstraint_GetTotalLambdaPosition; 8 | import static jolt.headers.JoltPhysicsC.JPC_FixedConstraint_GetTotalLambdaRotation; 9 | 10 | public final class FixedConstraint extends TwoBodyConstraint { 11 | //region Jolt-Pointer 12 | private FixedConstraint(MemoryAddress handle) { 13 | super(handle); 14 | } 15 | 16 | public static FixedConstraint at(MemoryAddress addr) { 17 | return addr == MemoryAddress.NULL ? null : new FixedConstraint(addr); 18 | } 19 | //endregion Jolt-Pointer 20 | 21 | public void getTotalLambdaPosition(FVec3 out) { 22 | JPC_FixedConstraint_GetTotalLambdaPosition(handle, out.address()); 23 | } 24 | 25 | public void getTotalLambdaRotation(FVec3 out) { 26 | JPC_FixedConstraint_GetTotalLambdaRotation(handle, out.address()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/MotorState.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | public enum MotorState { 4 | OFF, 5 | VELOCITY, 6 | POSITION 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/PathRotationConstraintType.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | public enum PathRotationConstraintType { 4 | FREE, 5 | CONSTRAIN_AROUND_TANGENT, 6 | CONSTRAIN_AROUND_NORMAL, 7 | CONSTRAIN_AROUND_BINORMAL, 8 | CONSTRAIN_TO_PATH, 9 | FULLY_CONSTRAINED 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/constraint/TwoBodyConstraintSettings.java: -------------------------------------------------------------------------------- 1 | package jolt.physics.constraint; 2 | 3 | import jolt.physics.body.MutableBody; 4 | 5 | import java.lang.foreign.MemoryAddress; 6 | 7 | import static jolt.headers.JoltPhysicsC.*; 8 | 9 | public sealed class TwoBodyConstraintSettings extends ConstraintSettings 10 | permits FixedConstraintSettings, DistanceConstraintSettings, PointConstraintSettings, HingeConstraintSettings, ConeConstraintSettings, SliderConstraintSettings, 11 | SwingTwistConstraintSettings, SixDOFConstraintSettings /* TODO, PathConstraintSettings, GearConstraintSettings, RackAndPinionConstraintSettings, PulleyConstraintSettings */ { 12 | //region Jolt-Pointer-Protected 13 | protected TwoBodyConstraintSettings(MemoryAddress handle) { 14 | super(handle); 15 | } 16 | 17 | public static TwoBodyConstraintSettings at(MemoryAddress addr) { 18 | return addr == MemoryAddress.NULL ? null : new TwoBodyConstraintSettings(addr); 19 | } 20 | //endregion Jolt-Pointer-Protected 21 | 22 | public TwoBodyConstraint create(MutableBody body1, MutableBody body2) { 23 | return TwoBodyConstraint.at(JPC_TwoBodyConstraintSettings_CreateConstraint(handle, body1.address(), body2.address())); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/jolt/physics/package-info.java: -------------------------------------------------------------------------------- 1 | @javax.annotation.ParametersAreNonnullByDefault 2 | package jolt.physics; 3 | -------------------------------------------------------------------------------- /src/test/java/jolt/MemoriedTest.java: -------------------------------------------------------------------------------- 1 | package jolt; 2 | 3 | import java.lang.foreign.MemorySession; 4 | 5 | public class MemoriedTest { 6 | protected MemorySession arena; 7 | 8 | protected void setUpMemory() { 9 | arena = MemorySession.openConfined(); 10 | } 11 | 12 | protected void tearDownMemory() { 13 | arena.close(); 14 | } 15 | } 16 | --------------------------------------------------------------------------------