-- Produced by boxnd-gen; edit the generator, not this file.

module Box3D.Collision
  ( getWorldCount
  , getMaxWorldCount
  , saveRecordingToFile
  , loadRecordingFromFile
  , validateReplay
  , cloneHull
  , cloneAndTransformHull
  , makeCubeHull
  , makeBoxHull
  , makeOffsetBoxHull
  , makeTransformedBoxHull
  , makeScaledBoxHull
  , scaleBox
  , getHeight
  , dumpHeightData
  , loadHeightField
  , getCompoundChild
  , queryCompound
  , getCompoundCapsule
  , getCompoundHull
  , getCompoundMesh
  , getCompoundSphere
  , getCompoundMaterials
  , convertCompoundToBytes
  , convertBytesToCompound
  , computeSphereMass
  , computeCapsuleMass
  , computeHullMass
  , computeHullMassInto
  , computeSphereAABB
  , computeCapsuleAABB
  , computeHullAABB
  , computeMeshAABB
  , computeHeightFieldAABB
  , computeCompoundAABB
  , isValidRay
  , overlapCapsule
  , overlapCompound
  , overlapHeightField
  , overlapHull
  , overlapMesh
  , overlapSphere
  , rayCastSphere
  , rayCastHollowSphere
  , rayCastCapsule
  , rayCastCompound
  , rayCastHull
  , rayCastMesh
  , rayCastHeightField
  , shapeCastSphere
  , shapeCastCapsule
  , shapeCastCompound
  , shapeCastCompoundInto
  , shapeCastHull
  , shapeCastHullInto
  , shapeCastMesh
  , shapeCastMeshInto
  , shapeCastHeightField
  , shapeCastHeightFieldInto
  , queryMesh
  , queryHeightField
  , shapeDistance
  , shapeCast
  , shapeCastInto
  , getSweepTransform
  , timeOfImpact
  , collideSpheres
  , collideCapsuleAndSphere
  , collideHullAndSphere
  , collideCapsules
  , collideHullAndCapsule
  , collideHulls
  , collideCapsuleAndTriangle
  , collideHullAndTriangle
  , collideSphereAndTriangle
  , solvePlanes
  , clipVector
  )

  where

import Foreign
import Foreign.C.Types (CInt(..), CBool(..))
import Foreign.C.String (CString)
import Box3D.MathTypes (AABB, Transform, Vec3)
import Box3D.Tags (BoxHull, ChildShape, CollisionPlane, CompoundCapsule, CompoundData, CompoundHull, CompoundMesh, CompoundQueryFcn, CompoundSphere, DistanceInput, DistanceOutput, HeightFieldData, HeightFieldDef, HullData, LocalManifold, Mesh, MeshData, MeshQueryFcn, PlaneSolverResult, Recording, SATCache, ShapeCastInput, ShapeCastPairInput, ShapeProxy, Simplex, SimplexCache, TOIInput, TOIOutput)
import Box3D.Types (Capsule, CastOutput, MassData, RayCastInput, Sphere, SurfaceMaterial, Sweep)

foreign import ccall unsafe "b3GetWorldCount"
  c_b3GetWorldCount :: IO CInt

foreign import ccall unsafe "b3GetMaxWorldCount"
  c_b3GetMaxWorldCount :: IO CInt

foreign import ccall unsafe "b3SaveRecordingToFile"
  c_b3SaveRecordingToFile :: Ptr Recording -> CString -> IO CBool

foreign import ccall unsafe "b3LoadRecordingFromFile"
  c_b3LoadRecordingFromFile :: CString -> IO (Ptr Recording)

foreign import ccall unsafe "b3ValidateReplay"
  c_b3ValidateReplay :: Ptr () -> CInt -> CInt -> IO CBool

foreign import ccall unsafe "b3CloneHull"
  c_b3CloneHull :: Ptr HullData -> IO (Ptr HullData)

foreign import ccall unsafe "hsg_b3CloneAndTransformHull"
  c_b3CloneAndTransformHull :: Ptr HullData -> Ptr Transform -> Ptr Vec3 -> IO (Ptr HullData)

foreign import ccall unsafe "hsg_b3MakeCubeHull"
  c_b3MakeCubeHull :: Float -> Ptr BoxHull -> IO ()

foreign import ccall unsafe "hsg_b3MakeBoxHull"
  c_b3MakeBoxHull :: Float -> Float -> Float -> Ptr BoxHull -> IO ()

foreign import ccall unsafe "hsg_b3MakeOffsetBoxHull"
  c_b3MakeOffsetBoxHull :: Float -> Float -> Float -> Ptr Vec3 -> Ptr BoxHull -> IO ()

foreign import ccall unsafe "hsg_b3MakeTransformedBoxHull"
  c_b3MakeTransformedBoxHull :: Float -> Float -> Float -> Ptr Transform -> Ptr BoxHull -> IO ()

foreign import ccall unsafe "hsg_b3MakeScaledBoxHull"
  c_b3MakeScaledBoxHull :: Ptr Vec3 -> Ptr Transform -> Ptr Vec3 -> Ptr BoxHull -> IO ()

foreign import ccall unsafe "hsg_b3ScaleBox"
  c_b3ScaleBox :: Ptr Vec3 -> Ptr Transform -> Ptr Vec3 -> Float -> IO ()

foreign import ccall unsafe "b3GetHeight"
  c_b3GetHeight :: Ptr MeshData -> IO CInt

foreign import ccall unsafe "b3DumpHeightData"
  c_b3DumpHeightData :: Ptr HeightFieldDef -> CString -> IO ()

foreign import ccall unsafe "b3LoadHeightField"
  c_b3LoadHeightField :: CString -> IO (Ptr HeightFieldData)

foreign import ccall unsafe "hsg_b3GetCompoundChild"
  c_b3GetCompoundChild :: Ptr CompoundData -> CInt -> Ptr ChildShape -> IO ()

foreign import ccall safe "hsg_b3QueryCompound"
  c_b3QueryCompound :: Ptr CompoundData -> Ptr AABB -> FunPtr CompoundQueryFcn -> Ptr () -> IO ()

foreign import ccall unsafe "hsg_b3GetCompoundCapsule"
  c_b3GetCompoundCapsule :: Ptr CompoundData -> CInt -> Ptr CompoundCapsule -> IO ()

foreign import ccall unsafe "hsg_b3GetCompoundHull"
  c_b3GetCompoundHull :: Ptr CompoundData -> CInt -> Ptr CompoundHull -> IO ()

foreign import ccall unsafe "hsg_b3GetCompoundMesh"
  c_b3GetCompoundMesh :: Ptr CompoundData -> CInt -> Ptr CompoundMesh -> IO ()

foreign import ccall unsafe "hsg_b3GetCompoundSphere"
  c_b3GetCompoundSphere :: Ptr CompoundData -> CInt -> Ptr CompoundSphere -> IO ()

foreign import ccall unsafe "b3GetCompoundMaterials"
  c_b3GetCompoundMaterials :: Ptr CompoundData -> IO (Ptr SurfaceMaterial)

foreign import ccall unsafe "b3ConvertCompoundToBytes"
  c_b3ConvertCompoundToBytes :: Ptr CompoundData -> IO (Ptr Word8)

foreign import ccall unsafe "b3ConvertBytesToCompound"
  c_b3ConvertBytesToCompound :: Ptr Word8 -> CInt -> IO (Ptr CompoundData)

foreign import ccall unsafe "hsg_b3ComputeSphereMass"
  c_b3ComputeSphereMass :: Ptr Sphere -> Float -> Ptr MassData -> IO ()

foreign import ccall unsafe "hsg_b3ComputeCapsuleMass"
  c_b3ComputeCapsuleMass :: Ptr Capsule -> Float -> Ptr MassData -> IO ()

foreign import ccall unsafe "hsg_b3ComputeHullMass"
  c_b3ComputeHullMass :: Ptr HullData -> Float -> Ptr MassData -> IO ()

foreign import ccall unsafe "hsg_b3ComputeSphereAABB"
  c_b3ComputeSphereAABB :: Ptr Sphere -> Ptr Transform -> Ptr AABB -> IO ()

foreign import ccall unsafe "hsg_b3ComputeCapsuleAABB"
  c_b3ComputeCapsuleAABB :: Ptr Capsule -> Ptr Transform -> Ptr AABB -> IO ()

foreign import ccall unsafe "hsg_b3ComputeHullAABB"
  c_b3ComputeHullAABB :: Ptr HullData -> Ptr Transform -> Ptr AABB -> IO ()

foreign import ccall unsafe "hsg_b3ComputeMeshAABB"
  c_b3ComputeMeshAABB :: Ptr MeshData -> Ptr Transform -> Ptr Vec3 -> Ptr AABB -> IO ()

foreign import ccall unsafe "hsg_b3ComputeHeightFieldAABB"
  c_b3ComputeHeightFieldAABB :: Ptr HeightFieldData -> Ptr Transform -> Ptr AABB -> IO ()

foreign import ccall unsafe "hsg_b3ComputeCompoundAABB"
  c_b3ComputeCompoundAABB :: Ptr CompoundData -> Ptr Transform -> Ptr AABB -> IO ()

foreign import ccall unsafe "b3IsValidRay"
  c_b3IsValidRay :: Ptr RayCastInput -> IO CBool

foreign import ccall unsafe "hsg_b3OverlapCapsule"
  c_b3OverlapCapsule :: Ptr Capsule -> Ptr Transform -> Ptr ShapeProxy -> IO CBool

foreign import ccall unsafe "hsg_b3OverlapCompound"
  c_b3OverlapCompound :: Ptr CompoundData -> Ptr Transform -> Ptr ShapeProxy -> IO CBool

foreign import ccall unsafe "hsg_b3OverlapHeightField"
  c_b3OverlapHeightField :: Ptr HeightFieldData -> Ptr Transform -> Ptr ShapeProxy -> IO CBool

foreign import ccall unsafe "hsg_b3OverlapHull"
  c_b3OverlapHull :: Ptr HullData -> Ptr Transform -> Ptr ShapeProxy -> IO CBool

foreign import ccall unsafe "hsg_b3OverlapMesh"
  c_b3OverlapMesh :: Ptr Mesh -> Ptr Transform -> Ptr ShapeProxy -> IO CBool

foreign import ccall unsafe "hsg_b3OverlapSphere"
  c_b3OverlapSphere :: Ptr Sphere -> Ptr Transform -> Ptr ShapeProxy -> IO CBool

foreign import ccall unsafe "hsg_b3RayCastSphere"
  c_b3RayCastSphere :: Ptr Sphere -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3RayCastHollowSphere"
  c_b3RayCastHollowSphere :: Ptr Sphere -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3RayCastCapsule"
  c_b3RayCastCapsule :: Ptr Capsule -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3RayCastCompound"
  c_b3RayCastCompound :: Ptr CompoundData -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3RayCastHull"
  c_b3RayCastHull :: Ptr HullData -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3RayCastMesh"
  c_b3RayCastMesh :: Ptr Mesh -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3RayCastHeightField"
  c_b3RayCastHeightField :: Ptr HeightFieldData -> Ptr RayCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCastSphere"
  c_b3ShapeCastSphere :: Ptr Sphere -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCastCapsule"
  c_b3ShapeCastCapsule :: Ptr Capsule -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCastCompound"
  c_b3ShapeCastCompound :: Ptr CompoundData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCastHull"
  c_b3ShapeCastHull :: Ptr HullData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCastMesh"
  c_b3ShapeCastMesh :: Ptr Mesh -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCastHeightField"
  c_b3ShapeCastHeightField :: Ptr HeightFieldData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()

foreign import ccall safe "hsg_b3QueryMesh"
  c_b3QueryMesh :: Ptr Mesh -> Ptr AABB -> FunPtr MeshQueryFcn -> Ptr () -> IO ()

foreign import ccall safe "hsg_b3QueryHeightField"
  c_b3QueryHeightField :: Ptr HeightFieldData -> Ptr AABB -> FunPtr MeshQueryFcn -> Ptr () -> IO ()

foreign import ccall unsafe "hsg_b3ShapeDistance"
  c_b3ShapeDistance :: Ptr DistanceInput -> Ptr SimplexCache -> Ptr Simplex -> CInt -> Ptr DistanceOutput -> IO ()

foreign import ccall unsafe "hsg_b3ShapeCast"
  c_b3ShapeCast :: Ptr ShapeCastPairInput -> Ptr CastOutput -> IO ()

foreign import ccall unsafe "hsg_b3GetSweepTransform"
  c_b3GetSweepTransform :: Ptr Sweep -> Float -> Ptr Transform -> IO ()

foreign import ccall unsafe "hsg_b3TimeOfImpact"
  c_b3TimeOfImpact :: Ptr TOIInput -> Ptr TOIOutput -> IO ()

foreign import ccall unsafe "hsg_b3CollideSpheres"
  c_b3CollideSpheres :: Ptr LocalManifold -> CInt -> Ptr Sphere -> Ptr Sphere -> Ptr Transform -> IO ()

foreign import ccall unsafe "hsg_b3CollideCapsuleAndSphere"
  c_b3CollideCapsuleAndSphere :: Ptr LocalManifold -> CInt -> Ptr Capsule -> Ptr Sphere -> Ptr Transform -> IO ()

foreign import ccall unsafe "hsg_b3CollideHullAndSphere"
  c_b3CollideHullAndSphere :: Ptr LocalManifold -> CInt -> Ptr HullData -> Ptr Sphere -> Ptr Transform -> Ptr SimplexCache -> IO ()

foreign import ccall unsafe "hsg_b3CollideCapsules"
  c_b3CollideCapsules :: Ptr LocalManifold -> CInt -> Ptr Capsule -> Ptr Capsule -> Ptr Transform -> IO ()

foreign import ccall unsafe "hsg_b3CollideHullAndCapsule"
  c_b3CollideHullAndCapsule :: Ptr LocalManifold -> CInt -> Ptr HullData -> Ptr Capsule -> Ptr Transform -> Ptr SimplexCache -> IO ()

foreign import ccall unsafe "hsg_b3CollideHulls"
  c_b3CollideHulls :: Ptr LocalManifold -> CInt -> Ptr HullData -> Ptr HullData -> Ptr Transform -> Ptr SATCache -> IO ()

foreign import ccall unsafe "b3CollideCapsuleAndTriangle"
  c_b3CollideCapsuleAndTriangle :: Ptr LocalManifold -> CInt -> Ptr Capsule -> Ptr Vec3 -> Ptr SimplexCache -> IO ()

foreign import ccall unsafe "hsg_b3CollideHullAndTriangle"
  c_b3CollideHullAndTriangle :: Ptr LocalManifold -> CInt -> Ptr HullData -> Ptr Vec3 -> Ptr Vec3 -> Ptr Vec3 -> CInt -> Ptr SATCache -> IO ()

foreign import ccall unsafe "b3CollideSphereAndTriangle"
  c_b3CollideSphereAndTriangle :: Ptr LocalManifold -> CInt -> Ptr Sphere -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3SolvePlanes"
  c_b3SolvePlanes :: Ptr Vec3 -> Ptr CollisionPlane -> CInt -> Ptr PlaneSolverResult -> IO ()

foreign import ccall unsafe "hsg_b3ClipVector"
  c_b3ClipVector :: Ptr Vec3 -> Ptr CollisionPlane -> CInt -> Ptr Vec3 -> IO ()

{- | Get the current number of worlds

Binds @b3GetWorldCount@.
-}
getWorldCount :: IO Int
getWorldCount :: IO Int
getWorldCount  =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (IO CInt
c_b3GetWorldCount)

{- | Get the maximum number of simultaneous worlds that have been created

Binds @b3GetMaxWorldCount@.
-}
getMaxWorldCount :: IO Int
getMaxWorldCount :: IO Int
getMaxWorldCount  =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (IO CInt
c_b3GetMaxWorldCount)

{- | Save the recording buffer to a file. Returns true on success.

Binds @b3SaveRecordingToFile@.
-}
saveRecordingToFile
  :: Ptr Recording
  -- ^ @recording@: the recording to save
  -> CString
  -- ^ @path@: file path to write
  -> IO Bool
saveRecordingToFile :: Ptr Recording -> CString -> IO Bool
saveRecordingToFile Ptr Recording
a0 CString
a1 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Recording -> CString -> IO CBool
c_b3SaveRecordingToFile Ptr Recording
a0 CString
a1)

{- | Load a recording from a file. Returns NULL on failure (file not found, wrong magic).
The caller owns the returned recording and must destroy it with b3DestroyRecording.

Binds @b3LoadRecordingFromFile@.
-}
loadRecordingFromFile
  :: CString
  -- ^ @path@: file path to read
  -> IO (Ptr Recording)
loadRecordingFromFile :: CString -> IO (Ptr Recording)
loadRecordingFromFile CString
a0 =
  CString -> IO (Ptr Recording)
c_b3LoadRecordingFromFile CString
a0

{- | Replay a recording from memory and verify it reproduces the same world-state hashes.
Stands up a fresh world, restores the seed snapshot, replays every op, and checks each embedded
StateHash record. Returns true if replay completed without id mismatches or hash divergences.

Binds @b3ValidateReplay@.
-}
validateReplay
  :: Ptr ()
  -- ^ @data@: pointer to recording bytes
  -> Int
  -- ^ @size@: byte count of the recording
  -> Int
  -- ^ @workerCount@: reserved for future multithreaded replay; pass 1 for now
  -> IO Bool
validateReplay :: Ptr () -> Int -> Int -> IO Bool
validateReplay Ptr ()
a0 Int
a1 Int
a2 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr () -> CInt -> CInt -> IO CBool
c_b3ValidateReplay Ptr ()
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2))

{- | Deep clone a hull.

Binds @b3CloneHull@.
-}
cloneHull
  :: Ptr HullData
  -> IO (Ptr HullData)
cloneHull :: Ptr HullData -> IO (Ptr HullData)
cloneHull Ptr HullData
a0 =
  Ptr HullData -> IO (Ptr HullData)
c_b3CloneHull Ptr HullData
a0

{- | Clone and transform a hull. Supports non-uniform and mirroring scale.

Binds @b3CloneAndTransformHull@.
-}
cloneAndTransformHull
  :: Ptr HullData
  -- ^ @original@
  -> Transform
  -> Vec3
  -- ^ @scale@
  -> IO (Ptr HullData)
cloneAndTransformHull :: Ptr HullData -> Transform -> Vec3 -> IO (Ptr HullData)
cloneAndTransformHull Ptr HullData
a0 Transform
a1 Vec3
a2 =
  Transform
-> (Ptr Transform -> IO (Ptr HullData)) -> IO (Ptr HullData)
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO (Ptr HullData)) -> IO (Ptr HullData))
-> (Ptr Transform -> IO (Ptr HullData)) -> IO (Ptr HullData)
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  Vec3 -> (Ptr Vec3 -> IO (Ptr HullData)) -> IO (Ptr HullData)
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a2 ((Ptr Vec3 -> IO (Ptr HullData)) -> IO (Ptr HullData))
-> (Ptr Vec3 -> IO (Ptr HullData)) -> IO (Ptr HullData)
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p2 ->
  Ptr HullData -> Ptr Transform -> Ptr Vec3 -> IO (Ptr HullData)
c_b3CloneAndTransformHull Ptr HullData
a0 Ptr Transform
p1 Ptr Vec3
p2

{- | Make a cube as a hull. Do not call b3DestroyHull on this.

Binds @b3MakeCubeHull@.
-}
makeCubeHull
  :: Float
  -- ^ @halfWidth@
  -> Ptr BoxHull
  -- ^ Result buffer.
  -> IO ()
makeCubeHull :: Float -> Ptr BoxHull -> IO ()
makeCubeHull Float
a0 Ptr BoxHull
out =
  Float -> Ptr BoxHull -> IO ()
c_b3MakeCubeHull Float
a0 Ptr BoxHull
out

{- | Make a box as a hull. Do not call b3DestroyHull on this.

Binds @b3MakeBoxHull@.
-}
makeBoxHull
  :: Float
  -- ^ @hx@
  -> Float
  -- ^ @hy@
  -> Float
  -- ^ @hz@
  -> Ptr BoxHull
  -- ^ Result buffer.
  -> IO ()
makeBoxHull :: Float -> Float -> Float -> Ptr BoxHull -> IO ()
makeBoxHull Float
a0 Float
a1 Float
a2 Ptr BoxHull
out =
  Float -> Float -> Float -> Ptr BoxHull -> IO ()
c_b3MakeBoxHull Float
a0 Float
a1 Float
a2 Ptr BoxHull
out

{- | Make an offset box as a hull. Do not call b3DestroyHull on this.

Binds @b3MakeOffsetBoxHull@.
-}
makeOffsetBoxHull
  :: Float
  -- ^ @hx@
  -> Float
  -- ^ @hy@
  -> Float
  -- ^ @hz@
  -> Vec3
  -- ^ @offset@
  -> Ptr BoxHull
  -- ^ Result buffer.
  -> IO ()
makeOffsetBoxHull :: Float -> Float -> Float -> Vec3 -> Ptr BoxHull -> IO ()
makeOffsetBoxHull Float
a0 Float
a1 Float
a2 Vec3
a3 Ptr BoxHull
out =
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a3 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p3 ->
  Float -> Float -> Float -> Ptr Vec3 -> Ptr BoxHull -> IO ()
c_b3MakeOffsetBoxHull Float
a0 Float
a1 Float
a2 Ptr Vec3
p3 Ptr BoxHull
out

{- | Make a transformed box as a hull. Do not call b3DestroyHull on this.

Binds @b3MakeTransformedBoxHull@.
-}
makeTransformedBoxHull
  :: Float
  -- ^ @hx@
  -> Float
  -- ^ @hy@
  -> Float
  -- ^ @hz@
  -> Transform
  -- ^ @transform@: local transform of box
  -> Ptr BoxHull
  -- ^ Result buffer.
  -> IO ()
makeTransformedBoxHull :: Float -> Float -> Float -> Transform -> Ptr BoxHull -> IO ()
makeTransformedBoxHull Float
a0 Float
a1 Float
a2 Transform
a3 Ptr BoxHull
out =
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a3 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p3 ->
  Float -> Float -> Float -> Ptr Transform -> Ptr BoxHull -> IO ()
c_b3MakeTransformedBoxHull Float
a0 Float
a1 Float
a2 Ptr Transform
p3 Ptr BoxHull
out

{- | This makes a transformed box hull with post scaling. This is useful for boxes that are scaled in
a level editor. Such scaling can have reflection and shear. In the case of shear the result
may be approximate. If you need to support shear consider using b3CreateHull.
Do not call b3DestroyHull on this.

Binds @b3MakeScaledBoxHull@.
-}
makeScaledBoxHull
  :: Vec3
  -- ^ @halfWidths@: positive half widths
  -> Transform
  -- ^ @transform@: local transform of box
  -> Vec3
  -- ^ @postScale@: scale applied after the transform, may be negative
  -> Ptr BoxHull
  -- ^ Result buffer.
  -> IO ()
makeScaledBoxHull :: Vec3 -> Transform -> Vec3 -> Ptr BoxHull -> IO ()
makeScaledBoxHull Vec3
a0 Transform
a1 Vec3
a2 Ptr BoxHull
out =
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a0 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p0 ->
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a2 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p2 ->
  Ptr Vec3 -> Ptr Transform -> Ptr Vec3 -> Ptr BoxHull -> IO ()
c_b3MakeScaledBoxHull Ptr Vec3
p0 Ptr Transform
p1 Ptr Vec3
p2 Ptr BoxHull
out

{- | This takes a box with a transform and post scale and converts it into a box with the post scale
resolved with new half-widths and transform. This accepts non-uniform and negative scale.
This is approximate if there is shear.

Binds @b3ScaleBox@.
-}
scaleBox
  :: Ptr Vec3
  -- ^ @halfWidths@: \[in\/out\] the box half widths
  -> Ptr Transform
  -- ^ @transform@: \[in\/out\] the box transform with rotation and translation
  -> Vec3
  -- ^ @postScale@: the post scale being applied to the box after the transform
  -> Float
  -- ^ @minHalfWidth@: the minimum half width after scale is applied
  -> IO ()
scaleBox :: Ptr Vec3 -> Ptr Transform -> Vec3 -> Float -> IO ()
scaleBox Ptr Vec3
a0 Ptr Transform
a1 Vec3
a2 Float
a3 =
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a2 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p2 ->
  Ptr Vec3 -> Ptr Transform -> Ptr Vec3 -> Float -> IO ()
c_b3ScaleBox Ptr Vec3
a0 Ptr Transform
a1 Ptr Vec3
p2 Float
a3

{- | Get the height of the mesh BVH.

Binds @b3GetHeight@.
-}
getHeight
  :: Ptr MeshData
  -> IO Int
getHeight :: Ptr MeshData -> IO Int
getHeight Ptr MeshData
a0 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr MeshData -> IO CInt
c_b3GetHeight Ptr MeshData
a0)

{- | Save input height data to a file

Binds @b3DumpHeightData@.
-}
dumpHeightData
  :: Ptr HeightFieldDef
  -- ^ @data@
  -> CString
  -- ^ @fileName@
  -> IO ()
dumpHeightData :: Ptr HeightFieldDef -> CString -> IO ()
dumpHeightData Ptr HeightFieldDef
a0 CString
a1 =
  Ptr HeightFieldDef -> CString -> IO ()
c_b3DumpHeightData Ptr HeightFieldDef
a0 CString
a1

{- | Create a height field by loading a previously saved height data

Binds @b3LoadHeightField@.
-}
loadHeightField
  :: CString
  -- ^ @fileName@
  -> IO (Ptr HeightFieldData)
loadHeightField :: CString -> IO (Ptr HeightFieldData)
loadHeightField CString
a0 =
  CString -> IO (Ptr HeightFieldData)
c_b3LoadHeightField CString
a0

{- | Get a child shape of a compound.

Binds @b3GetCompoundChild@.
-}
getCompoundChild
  :: Ptr CompoundData
  -> Int
  -- ^ @childIndex@
  -> Ptr ChildShape
  -- ^ Result buffer.
  -> IO ()
getCompoundChild :: Ptr CompoundData -> Int -> Ptr ChildShape -> IO ()
getCompoundChild Ptr CompoundData
a0 Int
a1 Ptr ChildShape
out =
  Ptr CompoundData -> CInt -> Ptr ChildShape -> IO ()
c_b3GetCompoundChild Ptr CompoundData
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr ChildShape
out

{- | Query a compound shape for children that overlap an AABB.

Binds @b3QueryCompound@.
-}
queryCompound
  :: Ptr CompoundData
  -> AABB
  -> FunPtr CompoundQueryFcn
  -> Ptr ()
  -- ^ @context@
  -> IO ()
queryCompound :: Ptr CompoundData
-> AABB -> FunPtr CompoundQueryFcn -> Ptr () -> IO ()
queryCompound Ptr CompoundData
a0 AABB
a1 FunPtr CompoundQueryFcn
a2 Ptr ()
a3 =
  AABB -> (Ptr AABB -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with AABB
a1 ((Ptr AABB -> IO ()) -> IO ()) -> (Ptr AABB -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
p1 ->
  Ptr CompoundData
-> Ptr AABB -> FunPtr CompoundQueryFcn -> Ptr () -> IO ()
c_b3QueryCompound Ptr CompoundData
a0 Ptr AABB
p1 FunPtr CompoundQueryFcn
a2 Ptr ()
a3

{- | Access a child capsule by index.

Binds @b3GetCompoundCapsule@.
-}
getCompoundCapsule
  :: Ptr CompoundData
  -> Int
  -- ^ @index@
  -> Ptr CompoundCapsule
  -- ^ Result buffer.
  -> IO ()
getCompoundCapsule :: Ptr CompoundData -> Int -> Ptr CompoundCapsule -> IO ()
getCompoundCapsule Ptr CompoundData
a0 Int
a1 Ptr CompoundCapsule
out =
  Ptr CompoundData -> CInt -> Ptr CompoundCapsule -> IO ()
c_b3GetCompoundCapsule Ptr CompoundData
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr CompoundCapsule
out

{- | Access a child hull by index.

Binds @b3GetCompoundHull@.
-}
getCompoundHull
  :: Ptr CompoundData
  -> Int
  -- ^ @index@
  -> Ptr CompoundHull
  -- ^ Result buffer.
  -> IO ()
getCompoundHull :: Ptr CompoundData -> Int -> Ptr CompoundHull -> IO ()
getCompoundHull Ptr CompoundData
a0 Int
a1 Ptr CompoundHull
out =
  Ptr CompoundData -> CInt -> Ptr CompoundHull -> IO ()
c_b3GetCompoundHull Ptr CompoundData
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr CompoundHull
out

{- | Access a child mesh by index.

Binds @b3GetCompoundMesh@.
-}
getCompoundMesh
  :: Ptr CompoundData
  -> Int
  -- ^ @index@
  -> Ptr CompoundMesh
  -- ^ Result buffer.
  -> IO ()
getCompoundMesh :: Ptr CompoundData -> Int -> Ptr CompoundMesh -> IO ()
getCompoundMesh Ptr CompoundData
a0 Int
a1 Ptr CompoundMesh
out =
  Ptr CompoundData -> CInt -> Ptr CompoundMesh -> IO ()
c_b3GetCompoundMesh Ptr CompoundData
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr CompoundMesh
out

{- | Access a child sphere by index.

Binds @b3GetCompoundSphere@.
-}
getCompoundSphere
  :: Ptr CompoundData
  -> Int
  -- ^ @index@
  -> Ptr CompoundSphere
  -- ^ Result buffer.
  -> IO ()
getCompoundSphere :: Ptr CompoundData -> Int -> Ptr CompoundSphere -> IO ()
getCompoundSphere Ptr CompoundData
a0 Int
a1 Ptr CompoundSphere
out =
  Ptr CompoundData -> CInt -> Ptr CompoundSphere -> IO ()
c_b3GetCompoundSphere Ptr CompoundData
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr CompoundSphere
out

{- | Access the compound material array.

Binds @b3GetCompoundMaterials@.
-}
getCompoundMaterials
  :: Ptr CompoundData
  -> IO (Ptr SurfaceMaterial)
getCompoundMaterials :: Ptr CompoundData -> IO (Ptr SurfaceMaterial)
getCompoundMaterials Ptr CompoundData
a0 =
  Ptr CompoundData -> IO (Ptr SurfaceMaterial)
c_b3GetCompoundMaterials Ptr CompoundData
a0

{- | If bytes is null then this returns the number of required bytes. This clones all the
data into the bytes buffer. This is expected to run offline or asynchronously.
This mutates the compound to nullify pointers, leaving the compound in an unusable state.

Binds @b3ConvertCompoundToBytes@.
-}
convertCompoundToBytes
  :: Ptr CompoundData
  -> IO (Ptr Word8)
convertCompoundToBytes :: Ptr CompoundData -> IO (Ptr Word8)
convertCompoundToBytes Ptr CompoundData
a0 =
  Ptr CompoundData -> IO (Ptr Word8)
c_b3ConvertCompoundToBytes Ptr CompoundData
a0

{- | Convert bytes to compound. This does not clone. The bytes must remain in scope while the
compound is used. This is done to improve run-time performance and allow for instancing.
The bytes are mutated to fixup pointers.

Binds @b3ConvertBytesToCompound@.
-}
convertBytesToCompound
  :: Ptr Word8
  -- ^ @bytes@
  -> Int
  -- ^ @byteCount@
  -> IO (Ptr CompoundData)
convertBytesToCompound :: Ptr Word8 -> Int -> IO (Ptr CompoundData)
convertBytesToCompound Ptr Word8
a0 Int
a1 =
  Ptr Word8 -> CInt -> IO (Ptr CompoundData)
c_b3ConvertBytesToCompound Ptr Word8
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1)

{- | Compute mass properties of a sphere

Binds @b3ComputeSphereMass@.
-}
computeSphereMass
  :: Sphere
  -- ^ @shape@
  -> Float
  -- ^ @density@
  -> IO MassData
computeSphereMass :: Sphere -> Float -> IO MassData
computeSphereMass Sphere
a0 Float
a1 =
  Sphere -> (Ptr Sphere -> IO MassData) -> IO MassData
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a0 ((Ptr Sphere -> IO MassData) -> IO MassData)
-> (Ptr Sphere -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p0 ->
  (Ptr MassData -> IO MassData) -> IO MassData
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr MassData -> IO MassData) -> IO MassData)
-> (Ptr MassData -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr MassData
pOut -> Ptr Sphere -> Float -> Ptr MassData -> IO ()
c_b3ComputeSphereMass Ptr Sphere
p0 Float
a1 Ptr MassData
pOut IO () -> IO MassData -> IO MassData
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr MassData -> IO MassData
forall a. Storable a => Ptr a -> IO a
peek Ptr MassData
pOut

{- | Compute mass properties of a capsule

Binds @b3ComputeCapsuleMass@.
-}
computeCapsuleMass
  :: Capsule
  -- ^ @shape@
  -> Float
  -- ^ @density@
  -> IO MassData
computeCapsuleMass :: Capsule -> Float -> IO MassData
computeCapsuleMass Capsule
a0 Float
a1 =
  Capsule -> (Ptr Capsule -> IO MassData) -> IO MassData
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a0 ((Ptr Capsule -> IO MassData) -> IO MassData)
-> (Ptr Capsule -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p0 ->
  (Ptr MassData -> IO MassData) -> IO MassData
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr MassData -> IO MassData) -> IO MassData)
-> (Ptr MassData -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr MassData
pOut -> Ptr Capsule -> Float -> Ptr MassData -> IO ()
c_b3ComputeCapsuleMass Ptr Capsule
p0 Float
a1 Ptr MassData
pOut IO () -> IO MassData -> IO MassData
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr MassData -> IO MassData
forall a. Storable a => Ptr a -> IO a
peek Ptr MassData
pOut

{- | Compute mass properties of a hull

Binds @b3ComputeHullMass@.
-}
computeHullMass
  :: Ptr HullData
  -- ^ @shape@
  -> Float
  -- ^ @density@
  -> IO MassData
computeHullMass :: Ptr HullData -> Float -> IO MassData
computeHullMass Ptr HullData
a0 Float
a1 =
  (Ptr MassData -> IO MassData) -> IO MassData
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr MassData -> IO MassData) -> IO MassData)
-> (Ptr MassData -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr MassData
pOut -> Ptr HullData -> Float -> Ptr MassData -> IO ()
c_b3ComputeHullMass Ptr HullData
a0 Float
a1 Ptr MassData
pOut IO () -> IO MassData -> IO MassData
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr MassData -> IO MassData
forall a. Storable a => Ptr a -> IO a
peek Ptr MassData
pOut

-- | Like 'computeHullMass', but the result is written into a caller-supplied buffer.
computeHullMassInto
  :: Ptr HullData
  -- ^ @shape@
  -> Float
  -- ^ @density@
  -> Ptr MassData
  -- ^ Result buffer.
  -> IO ()
computeHullMassInto :: Ptr HullData -> Float -> Ptr MassData -> IO ()
computeHullMassInto Ptr HullData
a0 Float
a1 Ptr MassData
out =
  Ptr HullData -> Float -> Ptr MassData -> IO ()
c_b3ComputeHullMass Ptr HullData
a0 Float
a1 Ptr MassData
out

{- | Compute the bounding box of a transformed sphere

Binds @b3ComputeSphereAABB@.
-}
computeSphereAABB
  :: Sphere
  -- ^ @shape@
  -> Transform
  -> IO AABB
computeSphereAABB :: Sphere -> Transform -> IO AABB
computeSphereAABB Sphere
a0 Transform
a1 =
  Sphere -> (Ptr Sphere -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a0 ((Ptr Sphere -> IO AABB) -> IO AABB)
-> (Ptr Sphere -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p0 ->
  Transform -> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO AABB) -> IO AABB)
-> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> Ptr Sphere -> Ptr Transform -> Ptr AABB -> IO ()
c_b3ComputeSphereAABB Ptr Sphere
p0 Ptr Transform
p1 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

{- | Compute the bounding box of a transformed capsule

Binds @b3ComputeCapsuleAABB@.
-}
computeCapsuleAABB
  :: Capsule
  -- ^ @shape@
  -> Transform
  -> IO AABB
computeCapsuleAABB :: Capsule -> Transform -> IO AABB
computeCapsuleAABB Capsule
a0 Transform
a1 =
  Capsule -> (Ptr Capsule -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a0 ((Ptr Capsule -> IO AABB) -> IO AABB)
-> (Ptr Capsule -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p0 ->
  Transform -> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO AABB) -> IO AABB)
-> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> Ptr Capsule -> Ptr Transform -> Ptr AABB -> IO ()
c_b3ComputeCapsuleAABB Ptr Capsule
p0 Ptr Transform
p1 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

{- | Compute the bounding box of a transformed hull

Binds @b3ComputeHullAABB@.
-}
computeHullAABB
  :: Ptr HullData
  -- ^ @shape@
  -> Transform
  -> IO AABB
computeHullAABB :: Ptr HullData -> Transform -> IO AABB
computeHullAABB Ptr HullData
a0 Transform
a1 =
  Transform -> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO AABB) -> IO AABB)
-> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> Ptr HullData -> Ptr Transform -> Ptr AABB -> IO ()
c_b3ComputeHullAABB Ptr HullData
a0 Ptr Transform
p1 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

{- | Compute the bounding box of a transformed mesh. Scale may be non-uniform and have negative components.

Binds @b3ComputeMeshAABB@.
-}
computeMeshAABB
  :: Ptr MeshData
  -- ^ @shape@
  -> Transform
  -> Vec3
  -- ^ @scale@
  -> IO AABB
computeMeshAABB :: Ptr MeshData -> Transform -> Vec3 -> IO AABB
computeMeshAABB Ptr MeshData
a0 Transform
a1 Vec3
a2 =
  Transform -> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO AABB) -> IO AABB)
-> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  Vec3 -> (Ptr Vec3 -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a2 ((Ptr Vec3 -> IO AABB) -> IO AABB)
-> (Ptr Vec3 -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p2 ->
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> Ptr MeshData -> Ptr Transform -> Ptr Vec3 -> Ptr AABB -> IO ()
c_b3ComputeMeshAABB Ptr MeshData
a0 Ptr Transform
p1 Ptr Vec3
p2 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

{- | Compute the bounding box of a transformed height-field

Binds @b3ComputeHeightFieldAABB@.
-}
computeHeightFieldAABB
  :: Ptr HeightFieldData
  -- ^ @shape@
  -> Transform
  -> IO AABB
computeHeightFieldAABB :: Ptr HeightFieldData -> Transform -> IO AABB
computeHeightFieldAABB Ptr HeightFieldData
a0 Transform
a1 =
  Transform -> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO AABB) -> IO AABB)
-> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> Ptr HeightFieldData -> Ptr Transform -> Ptr AABB -> IO ()
c_b3ComputeHeightFieldAABB Ptr HeightFieldData
a0 Ptr Transform
p1 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

{- | Compute the bounding box of a compound

Binds @b3ComputeCompoundAABB@.
-}
computeCompoundAABB
  :: Ptr CompoundData
  -- ^ @shape@
  -> Transform
  -> IO AABB
computeCompoundAABB :: Ptr CompoundData -> Transform -> IO AABB
computeCompoundAABB Ptr CompoundData
a0 Transform
a1 =
  Transform -> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO AABB) -> IO AABB)
-> (Ptr Transform -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> Ptr CompoundData -> Ptr Transform -> Ptr AABB -> IO ()
c_b3ComputeCompoundAABB Ptr CompoundData
a0 Ptr Transform
p1 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

{- | Use this to ensure your ray cast input is valid and avoid internal assertions.

Binds @b3IsValidRay@.
-}
isValidRay
  :: RayCastInput
  -> IO Bool
isValidRay :: RayCastInput -> IO Bool
isValidRay RayCastInput
a0 =
  RayCastInput -> (Ptr RayCastInput -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a0 ((Ptr RayCastInput -> IO Bool) -> IO Bool)
-> (Ptr RayCastInput -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p0 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RayCastInput -> IO CBool
c_b3IsValidRay Ptr RayCastInput
p0)

{- | Overlap shape versus capsule

Binds @b3OverlapCapsule@.
-}
overlapCapsule
  :: Capsule
  -- ^ @shape@
  -> Transform
  -- ^ @shapeTransform@
  -> Ptr ShapeProxy
  -> IO Bool
overlapCapsule :: Capsule -> Transform -> Ptr ShapeProxy -> IO Bool
overlapCapsule Capsule
a0 Transform
a1 Ptr ShapeProxy
a2 =
  Capsule -> (Ptr Capsule -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a0 ((Ptr Capsule -> IO Bool) -> IO Bool)
-> (Ptr Capsule -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p0 ->
  Transform -> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO Bool) -> IO Bool)
-> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Capsule -> Ptr Transform -> Ptr ShapeProxy -> IO CBool
c_b3OverlapCapsule Ptr Capsule
p0 Ptr Transform
p1 Ptr ShapeProxy
a2)

{- | Overlap shape versus compound

Binds @b3OverlapCompound@.
-}
overlapCompound
  :: Ptr CompoundData
  -- ^ @shape@
  -> Transform
  -- ^ @shapeTransform@
  -> Ptr ShapeProxy
  -> IO Bool
overlapCompound :: Ptr CompoundData -> Transform -> Ptr ShapeProxy -> IO Bool
overlapCompound Ptr CompoundData
a0 Transform
a1 Ptr ShapeProxy
a2 =
  Transform -> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO Bool) -> IO Bool)
-> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr CompoundData -> Ptr Transform -> Ptr ShapeProxy -> IO CBool
c_b3OverlapCompound Ptr CompoundData
a0 Ptr Transform
p1 Ptr ShapeProxy
a2)

{- | Overlap shape versus height field

Binds @b3OverlapHeightField@.
-}
overlapHeightField
  :: Ptr HeightFieldData
  -- ^ @shape@
  -> Transform
  -- ^ @shapeTransform@
  -> Ptr ShapeProxy
  -> IO Bool
overlapHeightField :: Ptr HeightFieldData -> Transform -> Ptr ShapeProxy -> IO Bool
overlapHeightField Ptr HeightFieldData
a0 Transform
a1 Ptr ShapeProxy
a2 =
  Transform -> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO Bool) -> IO Bool)
-> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr HeightFieldData -> Ptr Transform -> Ptr ShapeProxy -> IO CBool
c_b3OverlapHeightField Ptr HeightFieldData
a0 Ptr Transform
p1 Ptr ShapeProxy
a2)

{- | Overlap shape versus hull

Binds @b3OverlapHull@.
-}
overlapHull
  :: Ptr HullData
  -- ^ @shape@
  -> Transform
  -- ^ @shapeTransform@
  -> Ptr ShapeProxy
  -> IO Bool
overlapHull :: Ptr HullData -> Transform -> Ptr ShapeProxy -> IO Bool
overlapHull Ptr HullData
a0 Transform
a1 Ptr ShapeProxy
a2 =
  Transform -> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO Bool) -> IO Bool)
-> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr HullData -> Ptr Transform -> Ptr ShapeProxy -> IO CBool
c_b3OverlapHull Ptr HullData
a0 Ptr Transform
p1 Ptr ShapeProxy
a2)

{- | Overlap shape versus mesh

Binds @b3OverlapMesh@.
-}
overlapMesh
  :: Ptr Mesh
  -- ^ @shape@
  -> Transform
  -- ^ @shapeTransform@
  -> Ptr ShapeProxy
  -> IO Bool
overlapMesh :: Ptr Mesh -> Transform -> Ptr ShapeProxy -> IO Bool
overlapMesh Ptr Mesh
a0 Transform
a1 Ptr ShapeProxy
a2 =
  Transform -> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO Bool) -> IO Bool)
-> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Mesh -> Ptr Transform -> Ptr ShapeProxy -> IO CBool
c_b3OverlapMesh Ptr Mesh
a0 Ptr Transform
p1 Ptr ShapeProxy
a2)

{- | Overlap shape versus sphere

Binds @b3OverlapSphere@.
-}
overlapSphere
  :: Sphere
  -- ^ @shape@
  -> Transform
  -- ^ @shapeTransform@
  -> Ptr ShapeProxy
  -> IO Bool
overlapSphere :: Sphere -> Transform -> Ptr ShapeProxy -> IO Bool
overlapSphere Sphere
a0 Transform
a1 Ptr ShapeProxy
a2 =
  Sphere -> (Ptr Sphere -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a0 ((Ptr Sphere -> IO Bool) -> IO Bool)
-> (Ptr Sphere -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p0 ->
  Transform -> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a1 ((Ptr Transform -> IO Bool) -> IO Bool)
-> (Ptr Transform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p1 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Sphere -> Ptr Transform -> Ptr ShapeProxy -> IO CBool
c_b3OverlapSphere Ptr Sphere
p0 Ptr Transform
p1 Ptr ShapeProxy
a2)

{- | Ray cast versus sphere in local space. A zero length ray is a point query. Initial overlap
reports a hit at the ray origin with zero fraction and zero normal.

Binds @b3RayCastSphere@.
-}
rayCastSphere
  :: Sphere
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastSphere :: Sphere -> RayCastInput -> IO CastOutput
rayCastSphere Sphere
a0 RayCastInput
a1 =
  Sphere -> (Ptr Sphere -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a0 ((Ptr Sphere -> IO CastOutput) -> IO CastOutput)
-> (Ptr Sphere -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p0 ->
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Sphere -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastSphere Ptr Sphere
p0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Ray cast versus a hollow sphere shell in local space. Unlike the solid sphere a ray starting
inside is not an overlap: it passes through and hits the far wall.

Binds @b3RayCastHollowSphere@.
-}
rayCastHollowSphere
  :: Sphere
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastHollowSphere :: Sphere -> RayCastInput -> IO CastOutput
rayCastHollowSphere Sphere
a0 RayCastInput
a1 =
  Sphere -> (Ptr Sphere -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a0 ((Ptr Sphere -> IO CastOutput) -> IO CastOutput)
-> (Ptr Sphere -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p0 ->
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Sphere -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastHollowSphere Ptr Sphere
p0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Ray cast versus capsule in local space. A zero length ray is a point query. Initial overlap
reports a hit at the ray origin with zero fraction and zero normal.

Binds @b3RayCastCapsule@.
-}
rayCastCapsule
  :: Capsule
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastCapsule :: Capsule -> RayCastInput -> IO CastOutput
rayCastCapsule Capsule
a0 RayCastInput
a1 =
  Capsule -> (Ptr Capsule -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a0 ((Ptr Capsule -> IO CastOutput) -> IO CastOutput)
-> (Ptr Capsule -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p0 ->
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Capsule -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastCapsule Ptr Capsule
p0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Ray cast versus compound in local space. A zero length ray is a point query. Initial overlap
with a child reports a hit at the ray origin with zero fraction and zero normal.

Binds @b3RayCastCompound@.
-}
rayCastCompound
  :: Ptr CompoundData
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastCompound :: Ptr CompoundData -> RayCastInput -> IO CastOutput
rayCastCompound Ptr CompoundData
a0 RayCastInput
a1 =
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr CompoundData -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastCompound Ptr CompoundData
a0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Ray cast versus hull shape in local space. A zero length ray is a point query. Initial overlap
reports a hit at the ray origin with zero fraction and zero normal.

Binds @b3RayCastHull@.
-}
rayCastHull
  :: Ptr HullData
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastHull :: Ptr HullData -> RayCastInput -> IO CastOutput
rayCastHull Ptr HullData
a0 RayCastInput
a1 =
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr HullData -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastHull Ptr HullData
a0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Ray cast versus mesh in local space. A thin surface with no interior, so there is no overlap case.

Binds @b3RayCastMesh@.
-}
rayCastMesh
  :: Ptr Mesh
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastMesh :: Ptr Mesh -> RayCastInput -> IO CastOutput
rayCastMesh Ptr Mesh
a0 RayCastInput
a1 =
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Mesh -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastMesh Ptr Mesh
a0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Ray cast versus height field in local space. A thin surface with no interior, so there is no overlap case.

Binds @b3RayCastHeightField@.
-}
rayCastHeightField
  :: Ptr HeightFieldData
  -- ^ @shape@
  -> RayCastInput
  -> IO CastOutput
rayCastHeightField :: Ptr HeightFieldData -> RayCastInput -> IO CastOutput
rayCastHeightField Ptr HeightFieldData
a0 RayCastInput
a1 =
  RayCastInput
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RayCastInput
a1 ((Ptr RayCastInput -> IO CastOutput) -> IO CastOutput)
-> (Ptr RayCastInput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr RayCastInput
p1 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr HeightFieldData -> Ptr RayCastInput -> Ptr CastOutput -> IO ()
c_b3RayCastHeightField Ptr HeightFieldData
a0 Ptr RayCastInput
p1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Shape cast versus a sphere. Initial overlap is treated as a miss.

Binds @b3ShapeCastSphere@.
-}
shapeCastSphere
  :: Sphere
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> IO CastOutput
shapeCastSphere :: Sphere -> Ptr ShapeCastInput -> IO CastOutput
shapeCastSphere Sphere
a0 Ptr ShapeCastInput
a1 =
  Sphere -> (Ptr Sphere -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a0 ((Ptr Sphere -> IO CastOutput) -> IO CastOutput)
-> (Ptr Sphere -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p0 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Sphere -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastSphere Ptr Sphere
p0 Ptr ShapeCastInput
a1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Shape cast versus a capsule. Initial overlap is treated as a miss.

Binds @b3ShapeCastCapsule@.
-}
shapeCastCapsule
  :: Capsule
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> IO CastOutput
shapeCastCapsule :: Capsule -> Ptr ShapeCastInput -> IO CastOutput
shapeCastCapsule Capsule
a0 Ptr ShapeCastInput
a1 =
  Capsule -> (Ptr Capsule -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a0 ((Ptr Capsule -> IO CastOutput) -> IO CastOutput)
-> (Ptr Capsule -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p0 ->
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Capsule -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastCapsule Ptr Capsule
p0 Ptr ShapeCastInput
a1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

{- | Shape cast versus compound. Initial overlap is treated as a miss.

Binds @b3ShapeCastCompound@.
-}
shapeCastCompound
  :: Ptr CompoundData
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> IO CastOutput
shapeCastCompound :: Ptr CompoundData -> Ptr ShapeCastInput -> IO CastOutput
shapeCastCompound Ptr CompoundData
a0 Ptr ShapeCastInput
a1 =
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr CompoundData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastCompound Ptr CompoundData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

-- | Like 'shapeCastCompound', but the result is written into a caller-supplied buffer.
shapeCastCompoundInto
  :: Ptr CompoundData
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> Ptr CastOutput
  -- ^ Result buffer.
  -> IO ()
shapeCastCompoundInto :: Ptr CompoundData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
shapeCastCompoundInto Ptr CompoundData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out =
  Ptr CompoundData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastCompound Ptr CompoundData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out

{- | Shape cast versus a hull. Initial overlap is treated as a miss.

Binds @b3ShapeCastHull@.
-}
shapeCastHull
  :: Ptr HullData
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> IO CastOutput
shapeCastHull :: Ptr HullData -> Ptr ShapeCastInput -> IO CastOutput
shapeCastHull Ptr HullData
a0 Ptr ShapeCastInput
a1 =
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr HullData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastHull Ptr HullData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

-- | Like 'shapeCastHull', but the result is written into a caller-supplied buffer.
shapeCastHullInto
  :: Ptr HullData
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> Ptr CastOutput
  -- ^ Result buffer.
  -> IO ()
shapeCastHullInto :: Ptr HullData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
shapeCastHullInto Ptr HullData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out =
  Ptr HullData -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastHull Ptr HullData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out

{- | Shape cast versus a mesh. Initial overlap is treated as a miss.

Binds @b3ShapeCastMesh@.
-}
shapeCastMesh
  :: Ptr Mesh
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> IO CastOutput
shapeCastMesh :: Ptr Mesh -> Ptr ShapeCastInput -> IO CastOutput
shapeCastMesh Ptr Mesh
a0 Ptr ShapeCastInput
a1 =
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr Mesh -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastMesh Ptr Mesh
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

-- | Like 'shapeCastMesh', but the result is written into a caller-supplied buffer.
shapeCastMeshInto
  :: Ptr Mesh
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> Ptr CastOutput
  -- ^ Result buffer.
  -> IO ()
shapeCastMeshInto :: Ptr Mesh -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
shapeCastMeshInto Ptr Mesh
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out =
  Ptr Mesh -> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastMesh Ptr Mesh
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out

{- | Shape cast versus a height field. Initial overlap is treated as a miss.

Binds @b3ShapeCastHeightField@.
-}
shapeCastHeightField
  :: Ptr HeightFieldData
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> IO CastOutput
shapeCastHeightField :: Ptr HeightFieldData -> Ptr ShapeCastInput -> IO CastOutput
shapeCastHeightField Ptr HeightFieldData
a0 Ptr ShapeCastInput
a1 =
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr HeightFieldData
-> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastHeightField Ptr HeightFieldData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

-- | Like 'shapeCastHeightField', but the result is written into a caller-supplied buffer.
shapeCastHeightFieldInto
  :: Ptr HeightFieldData
  -- ^ @shape@
  -> Ptr ShapeCastInput
  -> Ptr CastOutput
  -- ^ Result buffer.
  -> IO ()
shapeCastHeightFieldInto :: Ptr HeightFieldData
-> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
shapeCastHeightFieldInto Ptr HeightFieldData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out =
  Ptr HeightFieldData
-> Ptr ShapeCastInput -> Ptr CastOutput -> IO ()
c_b3ShapeCastHeightField Ptr HeightFieldData
a0 Ptr ShapeCastInput
a1 Ptr CastOutput
out

{- | Query a mesh for triangles overlapping a bounding box in local space. May have false positives. Useful for debug draw.

Binds @b3QueryMesh@.
-}
queryMesh
  :: Ptr Mesh
  -- ^ @mesh@: the mesh to query, includes scale
  -> AABB
  -- ^ @bounds@: the bounding box in local space
  -> FunPtr MeshQueryFcn
  -- ^ @fcn@: a user function to collect triangles
  -> Ptr ()
  -- ^ @context@: the context sent to the user function.
  -> IO ()
queryMesh :: Ptr Mesh -> AABB -> FunPtr MeshQueryFcn -> Ptr () -> IO ()
queryMesh Ptr Mesh
a0 AABB
a1 FunPtr MeshQueryFcn
a2 Ptr ()
a3 =
  AABB -> (Ptr AABB -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with AABB
a1 ((Ptr AABB -> IO ()) -> IO ()) -> (Ptr AABB -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
p1 ->
  Ptr Mesh -> Ptr AABB -> FunPtr MeshQueryFcn -> Ptr () -> IO ()
c_b3QueryMesh Ptr Mesh
a0 Ptr AABB
p1 FunPtr MeshQueryFcn
a2 Ptr ()
a3

{- | Query a height field for triangles overlapping a bounding box in local space. May have false positives. Useful for debug draw.

Binds @b3QueryHeightField@.
-}
queryHeightField
  :: Ptr HeightFieldData
  -- ^ @heightField@: the height field to query
  -> AABB
  -- ^ @bounds@: the bounding box in local space
  -> FunPtr MeshQueryFcn
  -- ^ @fcn@: a user function to collect triangles
  -> Ptr ()
  -- ^ @context@: the context sent to the user function.
  -> IO ()
queryHeightField :: Ptr HeightFieldData
-> AABB -> FunPtr MeshQueryFcn -> Ptr () -> IO ()
queryHeightField Ptr HeightFieldData
a0 AABB
a1 FunPtr MeshQueryFcn
a2 Ptr ()
a3 =
  AABB -> (Ptr AABB -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with AABB
a1 ((Ptr AABB -> IO ()) -> IO ()) -> (Ptr AABB -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
p1 ->
  Ptr HeightFieldData
-> Ptr AABB -> FunPtr MeshQueryFcn -> Ptr () -> IO ()
c_b3QueryHeightField Ptr HeightFieldData
a0 Ptr AABB
p1 FunPtr MeshQueryFcn
a2 Ptr ()
a3

{- | Compute the closest points between two shapes represented as point clouds.
b3SimplexCache cache is input\/output. On the first call set b3SimplexCache.count to zero.
The query runs in frame A, so the witness points and normal are returned in frame A.
The underlying GJK algorithm may be debugged by passing in debug simplexes and capacity. You may pass in NULL and 0 for these.

Binds @b3ShapeDistance@.
-}
shapeDistance
  :: Ptr DistanceInput
  -> Ptr SimplexCache
  -> Ptr Simplex
  -- ^ @simplexes@
  -> Int
  -- ^ @simplexCapacity@
  -> Ptr DistanceOutput
  -- ^ Result buffer.
  -> IO ()
shapeDistance :: Ptr DistanceInput
-> Ptr SimplexCache
-> Ptr Simplex
-> Int
-> Ptr DistanceOutput
-> IO ()
shapeDistance Ptr DistanceInput
a0 Ptr SimplexCache
a1 Ptr Simplex
a2 Int
a3 Ptr DistanceOutput
out =
  Ptr DistanceInput
-> Ptr SimplexCache
-> Ptr Simplex
-> CInt
-> Ptr DistanceOutput
-> IO ()
c_b3ShapeDistance Ptr DistanceInput
a0 Ptr SimplexCache
a1 Ptr Simplex
a2 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a3) Ptr DistanceOutput
out

{- | Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction.
The query runs in frame A, so the hit point and normal are returned in frame A. Initially touching shapes are a miss.

Binds @b3ShapeCast@.
-}
shapeCast
  :: Ptr ShapeCastPairInput
  -> IO CastOutput
shapeCast :: Ptr ShapeCastPairInput -> IO CastOutput
shapeCast Ptr ShapeCastPairInput
a0 =
  (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CastOutput -> IO CastOutput) -> IO CastOutput)
-> (Ptr CastOutput -> IO CastOutput) -> IO CastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr CastOutput
pOut -> Ptr ShapeCastPairInput -> Ptr CastOutput -> IO ()
c_b3ShapeCast Ptr ShapeCastPairInput
a0 Ptr CastOutput
pOut IO () -> IO CastOutput -> IO CastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CastOutput -> IO CastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr CastOutput
pOut

-- | Like 'shapeCast', but the result is written into a caller-supplied buffer.
shapeCastInto
  :: Ptr ShapeCastPairInput
  -> Ptr CastOutput
  -- ^ Result buffer.
  -> IO ()
shapeCastInto :: Ptr ShapeCastPairInput -> Ptr CastOutput -> IO ()
shapeCastInto Ptr ShapeCastPairInput
a0 Ptr CastOutput
out =
  Ptr ShapeCastPairInput -> Ptr CastOutput -> IO ()
c_b3ShapeCast Ptr ShapeCastPairInput
a0 Ptr CastOutput
out

{- | Evaluate the transform sweep at a specific time.

Binds @b3GetSweepTransform@.
-}
getSweepTransform
  :: Sweep
  -> Float
  -- ^ @time@
  -> IO Transform
getSweepTransform :: Sweep -> Float -> IO Transform
getSweepTransform Sweep
a0 Float
a1 =
  Sweep -> (Ptr Sweep -> IO Transform) -> IO Transform
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sweep
a0 ((Ptr Sweep -> IO Transform) -> IO Transform)
-> (Ptr Sweep -> IO Transform) -> IO Transform
forall a b. (a -> b) -> a -> b
$ \Ptr Sweep
p0 ->
  (Ptr Transform -> IO Transform) -> IO Transform
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Transform -> IO Transform) -> IO Transform)
-> (Ptr Transform -> IO Transform) -> IO Transform
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
pOut -> Ptr Sweep -> Float -> Ptr Transform -> IO ()
c_b3GetSweepTransform Ptr Sweep
p0 Float
a1 Ptr Transform
pOut IO () -> IO Transform -> IO Transform
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Transform -> IO Transform
forall a. Storable a => Ptr a -> IO a
peek Ptr Transform
pOut

{- | Compute the upper bound on time before two shapes penetrate. Time is represented as
a fraction between \[0,tMax\]. This uses a swept separating axis and may miss some intermediate,
non-tunneling collisions. If you change the time interval, you should call this function
again.

Binds @b3TimeOfImpact@.
-}
timeOfImpact
  :: Ptr TOIInput
  -> Ptr TOIOutput
  -- ^ Result buffer.
  -> IO ()
timeOfImpact :: Ptr TOIInput -> Ptr TOIOutput -> IO ()
timeOfImpact Ptr TOIInput
a0 Ptr TOIOutput
out =
  Ptr TOIInput -> Ptr TOIOutput -> IO ()
c_b3TimeOfImpact Ptr TOIInput
a0 Ptr TOIOutput
out

{- | Collide two spheres.

Binds @b3CollideSpheres@.
-}
collideSpheres
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Sphere
  -- ^ @sphereA@
  -> Sphere
  -- ^ @sphereB@
  -> Transform
  -- ^ @transformBtoA@
  -> IO ()
collideSpheres :: Ptr LocalManifold -> Int -> Sphere -> Sphere -> Transform -> IO ()
collideSpheres Ptr LocalManifold
a0 Int
a1 Sphere
a2 Sphere
a3 Transform
a4 =
  Sphere -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a2 ((Ptr Sphere -> IO ()) -> IO ()) -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p2 ->
  Sphere -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a3 ((Ptr Sphere -> IO ()) -> IO ()) -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p3 ->
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a4 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p4 ->
  Ptr LocalManifold
-> CInt -> Ptr Sphere -> Ptr Sphere -> Ptr Transform -> IO ()
c_b3CollideSpheres Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr Sphere
p2 Ptr Sphere
p3 Ptr Transform
p4

{- | Collide a capsule and a sphere.

Binds @b3CollideCapsuleAndSphere@.
-}
collideCapsuleAndSphere
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Capsule
  -- ^ @capsuleA@
  -> Sphere
  -- ^ @sphereB@
  -> Transform
  -- ^ @transformBtoA@
  -> IO ()
collideCapsuleAndSphere :: Ptr LocalManifold -> Int -> Capsule -> Sphere -> Transform -> IO ()
collideCapsuleAndSphere Ptr LocalManifold
a0 Int
a1 Capsule
a2 Sphere
a3 Transform
a4 =
  Capsule -> (Ptr Capsule -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a2 ((Ptr Capsule -> IO ()) -> IO ())
-> (Ptr Capsule -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p2 ->
  Sphere -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a3 ((Ptr Sphere -> IO ()) -> IO ()) -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p3 ->
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a4 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p4 ->
  Ptr LocalManifold
-> CInt -> Ptr Capsule -> Ptr Sphere -> Ptr Transform -> IO ()
c_b3CollideCapsuleAndSphere Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr Capsule
p2 Ptr Sphere
p3 Ptr Transform
p4

{- | Collide a hull and a sphere.

Binds @b3CollideHullAndSphere@.
-}
collideHullAndSphere
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Ptr HullData
  -- ^ @hullA@
  -> Sphere
  -- ^ @sphereB@
  -> Transform
  -- ^ @transformBtoA@
  -> Ptr SimplexCache
  -> IO ()
collideHullAndSphere :: Ptr LocalManifold
-> Int
-> Ptr HullData
-> Sphere
-> Transform
-> Ptr SimplexCache
-> IO ()
collideHullAndSphere Ptr LocalManifold
a0 Int
a1 Ptr HullData
a2 Sphere
a3 Transform
a4 Ptr SimplexCache
a5 =
  Sphere -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a3 ((Ptr Sphere -> IO ()) -> IO ()) -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p3 ->
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a4 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p4 ->
  Ptr LocalManifold
-> CInt
-> Ptr HullData
-> Ptr Sphere
-> Ptr Transform
-> Ptr SimplexCache
-> IO ()
c_b3CollideHullAndSphere Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr HullData
a2 Ptr Sphere
p3 Ptr Transform
p4 Ptr SimplexCache
a5

{- | Collide two capsules.

Binds @b3CollideCapsules@.
-}
collideCapsules
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Capsule
  -- ^ @capsuleA@
  -> Capsule
  -- ^ @capsuleB@
  -> Transform
  -- ^ @transformBtoA@
  -> IO ()
collideCapsules :: Ptr LocalManifold
-> Int -> Capsule -> Capsule -> Transform -> IO ()
collideCapsules Ptr LocalManifold
a0 Int
a1 Capsule
a2 Capsule
a3 Transform
a4 =
  Capsule -> (Ptr Capsule -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a2 ((Ptr Capsule -> IO ()) -> IO ())
-> (Ptr Capsule -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p2 ->
  Capsule -> (Ptr Capsule -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a3 ((Ptr Capsule -> IO ()) -> IO ())
-> (Ptr Capsule -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p3 ->
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a4 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p4 ->
  Ptr LocalManifold
-> CInt -> Ptr Capsule -> Ptr Capsule -> Ptr Transform -> IO ()
c_b3CollideCapsules Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr Capsule
p2 Ptr Capsule
p3 Ptr Transform
p4

{- | Collide a hull and a capsule.

Binds @b3CollideHullAndCapsule@.
-}
collideHullAndCapsule
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Ptr HullData
  -- ^ @hullA@
  -> Capsule
  -- ^ @capsuleB@
  -> Transform
  -- ^ @transformBtoA@
  -> Ptr SimplexCache
  -> IO ()
collideHullAndCapsule :: Ptr LocalManifold
-> Int
-> Ptr HullData
-> Capsule
-> Transform
-> Ptr SimplexCache
-> IO ()
collideHullAndCapsule Ptr LocalManifold
a0 Int
a1 Ptr HullData
a2 Capsule
a3 Transform
a4 Ptr SimplexCache
a5 =
  Capsule -> (Ptr Capsule -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a3 ((Ptr Capsule -> IO ()) -> IO ())
-> (Ptr Capsule -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p3 ->
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a4 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p4 ->
  Ptr LocalManifold
-> CInt
-> Ptr HullData
-> Ptr Capsule
-> Ptr Transform
-> Ptr SimplexCache
-> IO ()
c_b3CollideHullAndCapsule Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr HullData
a2 Ptr Capsule
p3 Ptr Transform
p4 Ptr SimplexCache
a5

{- | Collide two hulls.

Binds @b3CollideHulls@.
-}
collideHulls
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Ptr HullData
  -- ^ @hullA@
  -> Ptr HullData
  -- ^ @hullB@
  -> Transform
  -- ^ @transformBtoA@
  -> Ptr SATCache
  -> IO ()
collideHulls :: Ptr LocalManifold
-> Int
-> Ptr HullData
-> Ptr HullData
-> Transform
-> Ptr SATCache
-> IO ()
collideHulls Ptr LocalManifold
a0 Int
a1 Ptr HullData
a2 Ptr HullData
a3 Transform
a4 Ptr SATCache
a5 =
  Transform -> (Ptr Transform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Transform
a4 ((Ptr Transform -> IO ()) -> IO ())
-> (Ptr Transform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Transform
p4 ->
  Ptr LocalManifold
-> CInt
-> Ptr HullData
-> Ptr HullData
-> Ptr Transform
-> Ptr SATCache
-> IO ()
c_b3CollideHulls Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr HullData
a2 Ptr HullData
a3 Ptr Transform
p4 Ptr SATCache
a5

{- | Collide a capsule and a triangle.

Binds @b3CollideCapsuleAndTriangle@.
-}
collideCapsuleAndTriangle
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Capsule
  -- ^ @capsuleA@
  -> Ptr Vec3
  -- ^ @triangleB@
  -> Ptr SimplexCache
  -> IO ()
collideCapsuleAndTriangle :: Ptr LocalManifold
-> Int -> Capsule -> Ptr Vec3 -> Ptr SimplexCache -> IO ()
collideCapsuleAndTriangle Ptr LocalManifold
a0 Int
a1 Capsule
a2 Ptr Vec3
a3 Ptr SimplexCache
a4 =
  Capsule -> (Ptr Capsule -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a2 ((Ptr Capsule -> IO ()) -> IO ())
-> (Ptr Capsule -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p2 ->
  Ptr LocalManifold
-> CInt -> Ptr Capsule -> Ptr Vec3 -> Ptr SimplexCache -> IO ()
c_b3CollideCapsuleAndTriangle Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr Capsule
p2 Ptr Vec3
a3 Ptr SimplexCache
a4

{- | Collide a hull and a triangle.

Binds @b3CollideHullAndTriangle@.
-}
collideHullAndTriangle
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Ptr HullData
  -- ^ @hullA@
  -> Vec3
  -- ^ @v1@
  -> Vec3
  -- ^ @v2@
  -> Vec3
  -- ^ @v3@
  -> Int
  -- ^ @triangleFlags@
  -> Ptr SATCache
  -> IO ()
collideHullAndTriangle :: Ptr LocalManifold
-> Int
-> Ptr HullData
-> Vec3
-> Vec3
-> Vec3
-> Int
-> Ptr SATCache
-> IO ()
collideHullAndTriangle Ptr LocalManifold
a0 Int
a1 Ptr HullData
a2 Vec3
a3 Vec3
a4 Vec3
a5 Int
a6 Ptr SATCache
a7 =
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a3 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p3 ->
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a4 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p4 ->
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a5 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p5 ->
  Ptr LocalManifold
-> CInt
-> Ptr HullData
-> Ptr Vec3
-> Ptr Vec3
-> Ptr Vec3
-> CInt
-> Ptr SATCache
-> IO ()
c_b3CollideHullAndTriangle Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr HullData
a2 Ptr Vec3
p3 Ptr Vec3
p4 Ptr Vec3
p5 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a6) Ptr SATCache
a7

{- | Collide a sphere and a triangle.

Binds @b3CollideSphereAndTriangle@.
-}
collideSphereAndTriangle
  :: Ptr LocalManifold
  -> Int
  -- ^ @capacity@
  -> Sphere
  -- ^ @sphereA@
  -> Ptr Vec3
  -- ^ @triangleB@
  -> IO ()
collideSphereAndTriangle :: Ptr LocalManifold -> Int -> Sphere -> Ptr Vec3 -> IO ()
collideSphereAndTriangle Ptr LocalManifold
a0 Int
a1 Sphere
a2 Ptr Vec3
a3 =
  Sphere -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Sphere
a2 ((Ptr Sphere -> IO ()) -> IO ()) -> (Ptr Sphere -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Sphere
p2 ->
  Ptr LocalManifold -> CInt -> Ptr Sphere -> Ptr Vec3 -> IO ()
c_b3CollideSphereAndTriangle Ptr LocalManifold
a0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1) Ptr Sphere
p2 Ptr Vec3
a3

{- | Solves the position of a mover that satisfies the given collision planes.

Binds @b3SolvePlanes@.
-}
solvePlanes
  :: Vec3
  -- ^ @targetDelta@: the desired translation from the position used to generate the collision planes
  -> Ptr CollisionPlane
  -- ^ @planes@: the collision planes
  -> Int
  -- ^ @count@: the number of collision planes
  -> Ptr PlaneSolverResult
  -- ^ Result buffer.
  -> IO ()
solvePlanes :: Vec3 -> Ptr CollisionPlane -> Int -> Ptr PlaneSolverResult -> IO ()
solvePlanes Vec3
a0 Ptr CollisionPlane
a1 Int
a2 Ptr PlaneSolverResult
out =
  Vec3 -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a0 ((Ptr Vec3 -> IO ()) -> IO ()) -> (Ptr Vec3 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p0 ->
  Ptr Vec3
-> Ptr CollisionPlane -> CInt -> Ptr PlaneSolverResult -> IO ()
c_b3SolvePlanes Ptr Vec3
p0 Ptr CollisionPlane
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2) Ptr PlaneSolverResult
out

{- | Clips the velocity against the given collision planes. Planes with zero push or clipVelocity
set to false are skipped.

Binds @b3ClipVector@.
-}
clipVector
  :: Vec3
  -- ^ @vector@
  -> Ptr CollisionPlane
  -- ^ @planes@
  -> Int
  -- ^ @count@
  -> IO Vec3
clipVector :: Vec3 -> Ptr CollisionPlane -> Int -> IO Vec3
clipVector Vec3
a0 Ptr CollisionPlane
a1 Int
a2 =
  Vec3 -> (Ptr Vec3 -> IO Vec3) -> IO Vec3
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec3
a0 ((Ptr Vec3 -> IO Vec3) -> IO Vec3)
-> (Ptr Vec3 -> IO Vec3) -> IO Vec3
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
p0 ->
  (Ptr Vec3 -> IO Vec3) -> IO Vec3
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Vec3 -> IO Vec3) -> IO Vec3)
-> (Ptr Vec3 -> IO Vec3) -> IO Vec3
forall a b. (a -> b) -> a -> b
$ \Ptr Vec3
pOut -> Ptr Vec3 -> Ptr CollisionPlane -> CInt -> Ptr Vec3 -> IO ()
c_b3ClipVector Ptr Vec3
p0 Ptr CollisionPlane
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2) Ptr Vec3
pOut IO () -> IO Vec3 -> IO Vec3
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Vec3 -> IO Vec3
forall a. Storable a => Ptr a -> IO a
peek Ptr Vec3
pOut