{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Graphene.Structs.Box
(
Box(..) ,
newZeroBox ,
noBox ,
#if defined(ENABLE_OVERLOADING)
ResolveBoxMethod ,
#endif
boxAlloc ,
#if defined(ENABLE_OVERLOADING)
BoxContainsBoxMethodInfo ,
#endif
boxContainsBox ,
#if defined(ENABLE_OVERLOADING)
BoxContainsPointMethodInfo ,
#endif
boxContainsPoint ,
boxEmpty ,
#if defined(ENABLE_OVERLOADING)
BoxEqualMethodInfo ,
#endif
boxEqual ,
#if defined(ENABLE_OVERLOADING)
BoxExpandMethodInfo ,
#endif
boxExpand ,
#if defined(ENABLE_OVERLOADING)
BoxExpandScalarMethodInfo ,
#endif
boxExpandScalar ,
#if defined(ENABLE_OVERLOADING)
BoxExpandVec3MethodInfo ,
#endif
boxExpandVec3 ,
#if defined(ENABLE_OVERLOADING)
BoxFreeMethodInfo ,
#endif
boxFree ,
#if defined(ENABLE_OVERLOADING)
BoxGetBoundingSphereMethodInfo ,
#endif
boxGetBoundingSphere ,
#if defined(ENABLE_OVERLOADING)
BoxGetCenterMethodInfo ,
#endif
boxGetCenter ,
#if defined(ENABLE_OVERLOADING)
BoxGetDepthMethodInfo ,
#endif
boxGetDepth ,
#if defined(ENABLE_OVERLOADING)
BoxGetHeightMethodInfo ,
#endif
boxGetHeight ,
#if defined(ENABLE_OVERLOADING)
BoxGetMaxMethodInfo ,
#endif
boxGetMax ,
#if defined(ENABLE_OVERLOADING)
BoxGetMinMethodInfo ,
#endif
boxGetMin ,
#if defined(ENABLE_OVERLOADING)
BoxGetSizeMethodInfo ,
#endif
boxGetSize ,
#if defined(ENABLE_OVERLOADING)
BoxGetWidthMethodInfo ,
#endif
boxGetWidth ,
boxInfinite ,
#if defined(ENABLE_OVERLOADING)
BoxInitMethodInfo ,
#endif
boxInit ,
#if defined(ENABLE_OVERLOADING)
BoxInitFromBoxMethodInfo ,
#endif
boxInitFromBox ,
#if defined(ENABLE_OVERLOADING)
BoxInitFromPointsMethodInfo ,
#endif
boxInitFromPoints ,
#if defined(ENABLE_OVERLOADING)
BoxInitFromVec3MethodInfo ,
#endif
boxInitFromVec3 ,
#if defined(ENABLE_OVERLOADING)
BoxInitFromVectorsMethodInfo ,
#endif
boxInitFromVectors ,
#if defined(ENABLE_OVERLOADING)
BoxIntersectionMethodInfo ,
#endif
boxIntersection ,
boxMinusOne ,
boxOne ,
boxOneMinusOne ,
#if defined(ENABLE_OVERLOADING)
BoxUnionMethodInfo ,
#endif
boxUnion ,
boxZero ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
import {-# SOURCE #-} qualified GI.Graphene.Structs.Sphere as Graphene.Sphere
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3
newtype Box = Box (ManagedPtr Box)
deriving (Box -> Box -> Bool
(Box -> Box -> Bool) -> (Box -> Box -> Bool) -> Eq Box
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Box -> Box -> Bool
$c/= :: Box -> Box -> Bool
== :: Box -> Box -> Bool
$c== :: Box -> Box -> Bool
Eq)
foreign import ccall "graphene_box_get_type" c_graphene_box_get_type ::
IO GType
instance BoxedObject Box where
boxedType :: Box -> IO GType
boxedType _ = IO GType
c_graphene_box_get_type
instance B.GValue.IsGValue Box where
toGValue :: Box -> IO GValue
toGValue o :: Box
o = do
GType
gtype <- IO GType
c_graphene_box_get_type
Box -> (Ptr Box -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Box
o (GType -> (GValue -> Ptr Box -> IO ()) -> Ptr Box -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Box -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Box
fromGValue gv :: GValue
gv = do
Ptr Box
ptr <- GValue -> IO (Ptr Box)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Box)
(ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Box -> Box
Box Ptr Box
ptr
newZeroBox :: MonadIO m => m Box
newZeroBox :: m Box
newZeroBox = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Box)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 IO (Ptr Box) -> (Ptr Box -> IO Box) -> IO Box
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box
instance tag ~ 'AttrSet => Constructible Box tag where
new :: (ManagedPtr Box -> Box) -> [AttrOp Box tag] -> m Box
new _ attrs :: [AttrOp Box tag]
attrs = do
Box
o <- m Box
forall (m :: * -> *). MonadIO m => m Box
newZeroBox
Box -> [AttrOp Box 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Box
o [AttrOp Box tag]
[AttrOp Box 'AttrSet]
attrs
Box -> m Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
o
noBox :: Maybe Box
noBox :: Maybe Box
noBox = Maybe Box
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Box
type instance O.AttributeList Box = BoxAttributeList
type BoxAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "graphene_box_alloc" graphene_box_alloc ::
IO (Ptr Box)
boxAlloc ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxAlloc :: m Box
boxAlloc = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_alloc
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxAlloc" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_box_contains_box" graphene_box_contains_box ::
Ptr Box ->
Ptr Box ->
IO CInt
boxContainsBox ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Box
-> m Bool
boxContainsBox :: Box -> Box -> m Bool
boxContainsBox a :: Box
a b :: Box
b = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
Ptr Box
b' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
b
CInt
result <- Ptr Box -> Ptr Box -> IO CInt
graphene_box_contains_box Ptr Box
a' Ptr Box
b'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
a
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
b
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data BoxContainsBoxMethodInfo
instance (signature ~ (Box -> m Bool), MonadIO m) => O.MethodInfo BoxContainsBoxMethodInfo Box signature where
overloadedMethod = boxContainsBox
#endif
foreign import ccall "graphene_box_contains_point" graphene_box_contains_point ::
Ptr Box ->
Ptr Graphene.Point3D.Point3D ->
IO CInt
boxContainsPoint ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Graphene.Point3D.Point3D
-> m Bool
boxContainsPoint :: Box -> Point3D -> m Bool
boxContainsPoint box :: Box
box point :: Point3D
point = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Point3D
point' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
point
CInt
result <- Ptr Box -> Ptr Point3D -> IO CInt
graphene_box_contains_point Ptr Box
box' Ptr Point3D
point'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
point
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data BoxContainsPointMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Bool), MonadIO m) => O.MethodInfo BoxContainsPointMethodInfo Box signature where
overloadedMethod = boxContainsPoint
#endif
foreign import ccall "graphene_box_equal" graphene_box_equal ::
Ptr Box ->
Ptr Box ->
IO CInt
boxEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Box
-> m Bool
boxEqual :: Box -> Box -> m Bool
boxEqual a :: Box
a b :: Box
b = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
Ptr Box
b' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
b
CInt
result <- Ptr Box -> Ptr Box -> IO CInt
graphene_box_equal Ptr Box
a' Ptr Box
b'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
a
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
b
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data BoxEqualMethodInfo
instance (signature ~ (Box -> m Bool), MonadIO m) => O.MethodInfo BoxEqualMethodInfo Box signature where
overloadedMethod = boxEqual
#endif
foreign import ccall "graphene_box_expand" graphene_box_expand ::
Ptr Box ->
Ptr Graphene.Point3D.Point3D ->
Ptr Box ->
IO ()
boxExpand ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Graphene.Point3D.Point3D
-> m (Box)
boxExpand :: Box -> Point3D -> m Box
boxExpand box :: Box
box point :: Point3D
point = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Point3D
point' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
point
Ptr Box
res <- Int -> IO (Ptr Box)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 :: IO (Ptr Box)
Ptr Box -> Ptr Point3D -> Ptr Box -> IO ()
graphene_box_expand Ptr Box
box' Ptr Point3D
point' Ptr Box
res
Box
res' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box) Ptr Box
res
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
point
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
res'
#if defined(ENABLE_OVERLOADING)
data BoxExpandMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m (Box)), MonadIO m) => O.MethodInfo BoxExpandMethodInfo Box signature where
overloadedMethod = boxExpand
#endif
foreign import ccall "graphene_box_expand_scalar" graphene_box_expand_scalar ::
Ptr Box ->
CFloat ->
Ptr Box ->
IO ()
boxExpandScalar ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Float
-> m (Box)
boxExpandScalar :: Box -> Float -> m Box
boxExpandScalar box :: Box
box scalar :: Float
scalar = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
let scalar' :: CFloat
scalar' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
scalar
Ptr Box
res <- Int -> IO (Ptr Box)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 :: IO (Ptr Box)
Ptr Box -> CFloat -> Ptr Box -> IO ()
graphene_box_expand_scalar Ptr Box
box' CFloat
scalar' Ptr Box
res
Box
res' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box) Ptr Box
res
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
res'
#if defined(ENABLE_OVERLOADING)
data BoxExpandScalarMethodInfo
instance (signature ~ (Float -> m (Box)), MonadIO m) => O.MethodInfo BoxExpandScalarMethodInfo Box signature where
overloadedMethod = boxExpandScalar
#endif
foreign import ccall "graphene_box_expand_vec3" graphene_box_expand_vec3 ::
Ptr Box ->
Ptr Graphene.Vec3.Vec3 ->
Ptr Box ->
IO ()
boxExpandVec3 ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Graphene.Vec3.Vec3
-> m (Box)
boxExpandVec3 :: Box -> Vec3 -> m Box
boxExpandVec3 box :: Box
box vec :: Vec3
vec = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Vec3
vec' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
vec
Ptr Box
res <- Int -> IO (Ptr Box)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 :: IO (Ptr Box)
Ptr Box -> Ptr Vec3 -> Ptr Box -> IO ()
graphene_box_expand_vec3 Ptr Box
box' Ptr Vec3
vec' Ptr Box
res
Box
res' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box) Ptr Box
res
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec3
vec
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
res'
#if defined(ENABLE_OVERLOADING)
data BoxExpandVec3MethodInfo
instance (signature ~ (Graphene.Vec3.Vec3 -> m (Box)), MonadIO m) => O.MethodInfo BoxExpandVec3MethodInfo Box signature where
overloadedMethod = boxExpandVec3
#endif
foreign import ccall "graphene_box_free" graphene_box_free ::
Ptr Box ->
IO ()
boxFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m ()
boxFree :: Box -> m ()
boxFree box :: Box
box = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Box -> IO ()
graphene_box_free Ptr Box
box'
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data BoxFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo BoxFreeMethodInfo Box signature where
overloadedMethod = boxFree
#endif
foreign import ccall "graphene_box_get_bounding_sphere" graphene_box_get_bounding_sphere ::
Ptr Box ->
Ptr Graphene.Sphere.Sphere ->
IO ()
boxGetBoundingSphere ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m (Graphene.Sphere.Sphere)
boxGetBoundingSphere :: Box -> m Sphere
boxGetBoundingSphere box :: Box
box = IO Sphere -> m Sphere
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Sphere
sphere <- Int -> IO (Ptr Sphere)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 :: IO (Ptr Graphene.Sphere.Sphere)
Ptr Box -> Ptr Sphere -> IO ()
graphene_box_get_bounding_sphere Ptr Box
box' Ptr Sphere
sphere
Sphere
sphere' <- ((ManagedPtr Sphere -> Sphere) -> Ptr Sphere -> IO Sphere
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Sphere -> Sphere
Graphene.Sphere.Sphere) Ptr Sphere
sphere
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Sphere -> IO Sphere
forall (m :: * -> *) a. Monad m => a -> m a
return Sphere
sphere'
#if defined(ENABLE_OVERLOADING)
data BoxGetBoundingSphereMethodInfo
instance (signature ~ (m (Graphene.Sphere.Sphere)), MonadIO m) => O.MethodInfo BoxGetBoundingSphereMethodInfo Box signature where
overloadedMethod = boxGetBoundingSphere
#endif
foreign import ccall "graphene_box_get_center" graphene_box_get_center ::
Ptr Box ->
Ptr Graphene.Point3D.Point3D ->
IO ()
boxGetCenter ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m (Graphene.Point3D.Point3D)
boxGetCenter :: Box -> m Point3D
boxGetCenter box :: Box
box = IO Point3D -> m Point3D
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Point3D -> m Point3D) -> IO Point3D -> m Point3D
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Point3D
center <- Int -> IO (Ptr Point3D)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
Ptr Box -> Ptr Point3D -> IO ()
graphene_box_get_center Ptr Box
box' Ptr Point3D
center
Point3D
center' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
center
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
center'
#if defined(ENABLE_OVERLOADING)
data BoxGetCenterMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.MethodInfo BoxGetCenterMethodInfo Box signature where
overloadedMethod = boxGetCenter
#endif
foreign import ccall "graphene_box_get_depth" graphene_box_get_depth ::
Ptr Box ->
IO CFloat
boxGetDepth ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m Float
boxGetDepth :: Box -> m Float
boxGetDepth box :: Box
box = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
CFloat
result <- Ptr Box -> IO CFloat
graphene_box_get_depth Ptr Box
box'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data BoxGetDepthMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo BoxGetDepthMethodInfo Box signature where
overloadedMethod = boxGetDepth
#endif
foreign import ccall "graphene_box_get_height" graphene_box_get_height ::
Ptr Box ->
IO CFloat
boxGetHeight ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m Float
boxGetHeight :: Box -> m Float
boxGetHeight box :: Box
box = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
CFloat
result <- Ptr Box -> IO CFloat
graphene_box_get_height Ptr Box
box'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data BoxGetHeightMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo BoxGetHeightMethodInfo Box signature where
overloadedMethod = boxGetHeight
#endif
foreign import ccall "graphene_box_get_max" graphene_box_get_max ::
Ptr Box ->
Ptr Graphene.Point3D.Point3D ->
IO ()
boxGetMax ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m (Graphene.Point3D.Point3D)
boxGetMax :: Box -> m Point3D
boxGetMax box :: Box
box = IO Point3D -> m Point3D
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Point3D -> m Point3D) -> IO Point3D -> m Point3D
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Point3D
max <- Int -> IO (Ptr Point3D)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
Ptr Box -> Ptr Point3D -> IO ()
graphene_box_get_max Ptr Box
box' Ptr Point3D
max
Point3D
max' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
max
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
max'
#if defined(ENABLE_OVERLOADING)
data BoxGetMaxMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.MethodInfo BoxGetMaxMethodInfo Box signature where
overloadedMethod = boxGetMax
#endif
foreign import ccall "graphene_box_get_min" graphene_box_get_min ::
Ptr Box ->
Ptr Graphene.Point3D.Point3D ->
IO ()
boxGetMin ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m (Graphene.Point3D.Point3D)
boxGetMin :: Box -> m Point3D
boxGetMin box :: Box
box = IO Point3D -> m Point3D
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Point3D -> m Point3D) -> IO Point3D -> m Point3D
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Point3D
min <- Int -> IO (Ptr Point3D)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
Ptr Box -> Ptr Point3D -> IO ()
graphene_box_get_min Ptr Box
box' Ptr Point3D
min
Point3D
min' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
min
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
min'
#if defined(ENABLE_OVERLOADING)
data BoxGetMinMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.MethodInfo BoxGetMinMethodInfo Box signature where
overloadedMethod = boxGetMin
#endif
foreign import ccall "graphene_box_get_size" graphene_box_get_size ::
Ptr Box ->
Ptr Graphene.Vec3.Vec3 ->
IO ()
boxGetSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m (Graphene.Vec3.Vec3)
boxGetSize :: Box -> m Vec3
boxGetSize box :: Box
box = IO Vec3 -> m Vec3
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec3 -> m Vec3) -> IO Vec3 -> m Vec3
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Vec3
size <- Int -> IO (Ptr Vec3)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Graphene.Vec3.Vec3)
Ptr Box -> Ptr Vec3 -> IO ()
graphene_box_get_size Ptr Box
box' Ptr Vec3
size
Vec3
size' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
size
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Vec3 -> IO Vec3
forall (m :: * -> *) a. Monad m => a -> m a
return Vec3
size'
#if defined(ENABLE_OVERLOADING)
data BoxGetSizeMethodInfo
instance (signature ~ (m (Graphene.Vec3.Vec3)), MonadIO m) => O.MethodInfo BoxGetSizeMethodInfo Box signature where
overloadedMethod = boxGetSize
#endif
foreign import ccall "graphene_box_get_width" graphene_box_get_width ::
Ptr Box ->
IO CFloat
boxGetWidth ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m Float
boxGetWidth :: Box -> m Float
boxGetWidth box :: Box
box = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
CFloat
result <- Ptr Box -> IO CFloat
graphene_box_get_width Ptr Box
box'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data BoxGetWidthMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo BoxGetWidthMethodInfo Box signature where
overloadedMethod = boxGetWidth
#endif
foreign import ccall "graphene_box_init" graphene_box_init ::
Ptr Box ->
Ptr Graphene.Point3D.Point3D ->
Ptr Graphene.Point3D.Point3D ->
IO (Ptr Box)
boxInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Maybe (Graphene.Point3D.Point3D)
-> Maybe (Graphene.Point3D.Point3D)
-> m Box
boxInit :: Box -> Maybe Point3D -> Maybe Point3D -> m Box
boxInit box :: Box
box min :: Maybe Point3D
min max :: Maybe Point3D
max = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Point3D
maybeMin <- case Maybe Point3D
min of
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
Just jMin :: Point3D
jMin -> do
Ptr Point3D
jMin' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jMin
Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jMin'
Ptr Point3D
maybeMax <- case Maybe Point3D
max of
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
Just jMax :: Point3D
jMax -> do
Ptr Point3D
jMax' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jMax
Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jMax'
Ptr Box
result <- Ptr Box -> Ptr Point3D -> Ptr Point3D -> IO (Ptr Box)
graphene_box_init Ptr Box
box' Ptr Point3D
maybeMin Ptr Point3D
maybeMax
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxInit" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
min Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
max Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
data BoxInitMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> Maybe (Graphene.Point3D.Point3D) -> m Box), MonadIO m) => O.MethodInfo BoxInitMethodInfo Box signature where
overloadedMethod = boxInit
#endif
foreign import ccall "graphene_box_init_from_box" graphene_box_init_from_box ::
Ptr Box ->
Ptr Box ->
IO (Ptr Box)
boxInitFromBox ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Box
-> m Box
boxInitFromBox :: Box -> Box -> m Box
boxInitFromBox box :: Box
box src :: Box
src = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Box
src' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
src
Ptr Box
result <- Ptr Box -> Ptr Box -> IO (Ptr Box)
graphene_box_init_from_box Ptr Box
box' Ptr Box
src'
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxInitFromBox" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
src
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromBoxMethodInfo
instance (signature ~ (Box -> m Box), MonadIO m) => O.MethodInfo BoxInitFromBoxMethodInfo Box signature where
overloadedMethod = boxInitFromBox
#endif
foreign import ccall "graphene_box_init_from_points" graphene_box_init_from_points ::
Ptr Box ->
Word32 ->
Ptr Graphene.Point3D.Point3D ->
IO (Ptr Box)
boxInitFromPoints ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> [Graphene.Point3D.Point3D]
-> m Box
boxInitFromPoints :: Box -> [Point3D] -> m Box
boxInitFromPoints box :: Box
box points :: [Point3D]
points = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
let nPoints :: Word32
nPoints = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [Point3D] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Point3D]
points
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
[Ptr Point3D]
points' <- (Point3D -> IO (Ptr Point3D)) -> [Point3D] -> IO [Ptr Point3D]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [Point3D]
points
Ptr Point3D
points'' <- Int -> [Ptr Point3D] -> IO (Ptr Point3D)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray 12 [Ptr Point3D]
points'
Ptr Box
result <- Ptr Box -> Word32 -> Ptr Point3D -> IO (Ptr Box)
graphene_box_init_from_points Ptr Box
box' Word32
nPoints Ptr Point3D
points''
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxInitFromPoints" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
(Point3D -> IO ()) -> [Point3D] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [Point3D]
points
Ptr Point3D -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Point3D
points''
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromPointsMethodInfo
instance (signature ~ ([Graphene.Point3D.Point3D] -> m Box), MonadIO m) => O.MethodInfo BoxInitFromPointsMethodInfo Box signature where
overloadedMethod = boxInitFromPoints
#endif
foreign import ccall "graphene_box_init_from_vec3" graphene_box_init_from_vec3 ::
Ptr Box ->
Ptr Graphene.Vec3.Vec3 ->
Ptr Graphene.Vec3.Vec3 ->
IO (Ptr Box)
boxInitFromVec3 ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Maybe (Graphene.Vec3.Vec3)
-> Maybe (Graphene.Vec3.Vec3)
-> m Box
boxInitFromVec3 :: Box -> Maybe Vec3 -> Maybe Vec3 -> m Box
boxInitFromVec3 box :: Box
box min :: Maybe Vec3
min max :: Maybe Vec3
max = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
Ptr Vec3
maybeMin <- case Maybe Vec3
min of
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
Just jMin :: Vec3
jMin -> do
Ptr Vec3
jMin' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jMin
Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jMin'
Ptr Vec3
maybeMax <- case Maybe Vec3
max of
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
Just jMax :: Vec3
jMax -> do
Ptr Vec3
jMax' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jMax
Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jMax'
Ptr Box
result <- Ptr Box -> Ptr Vec3 -> Ptr Vec3 -> IO (Ptr Box)
graphene_box_init_from_vec3 Ptr Box
box' Ptr Vec3
maybeMin Ptr Vec3
maybeMax
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxInitFromVec3" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
min Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
max Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromVec3MethodInfo
instance (signature ~ (Maybe (Graphene.Vec3.Vec3) -> Maybe (Graphene.Vec3.Vec3) -> m Box), MonadIO m) => O.MethodInfo BoxInitFromVec3MethodInfo Box signature where
overloadedMethod = boxInitFromVec3
#endif
foreign import ccall "graphene_box_init_from_vectors" graphene_box_init_from_vectors ::
Ptr Box ->
Word32 ->
Ptr Graphene.Vec3.Vec3 ->
IO (Ptr Box)
boxInitFromVectors ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> [Graphene.Vec3.Vec3]
-> m Box
boxInitFromVectors :: Box -> [Vec3] -> m Box
boxInitFromVectors box :: Box
box vectors :: [Vec3]
vectors = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
let nVectors :: Word32
nVectors = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [Vec3] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Vec3]
vectors
Ptr Box
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
[Ptr Vec3]
vectors' <- (Vec3 -> IO (Ptr Vec3)) -> [Vec3] -> IO [Ptr Vec3]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [Vec3]
vectors
Ptr Vec3
vectors'' <- Int -> [Ptr Vec3] -> IO (Ptr Vec3)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray 16 [Ptr Vec3]
vectors'
Ptr Box
result <- Ptr Box -> Word32 -> Ptr Vec3 -> IO (Ptr Box)
graphene_box_init_from_vectors Ptr Box
box' Word32
nVectors Ptr Vec3
vectors''
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxInitFromVectors" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
box
(Vec3 -> IO ()) -> [Vec3] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [Vec3]
vectors
Ptr Vec3 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Vec3
vectors''
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromVectorsMethodInfo
instance (signature ~ ([Graphene.Vec3.Vec3] -> m Box), MonadIO m) => O.MethodInfo BoxInitFromVectorsMethodInfo Box signature where
overloadedMethod = boxInitFromVectors
#endif
foreign import ccall "graphene_box_intersection" graphene_box_intersection ::
Ptr Box ->
Ptr Box ->
Ptr Box ->
IO CInt
boxIntersection ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Box
-> m ((Bool, Box))
boxIntersection :: Box -> Box -> m (Bool, Box)
boxIntersection a :: Box
a b :: Box
b = IO (Bool, Box) -> m (Bool, Box)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Box) -> m (Bool, Box))
-> IO (Bool, Box) -> m (Bool, Box)
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
Ptr Box
b' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
b
Ptr Box
res <- Int -> IO (Ptr Box)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 :: IO (Ptr Box)
CInt
result <- Ptr Box -> Ptr Box -> Ptr Box -> IO CInt
graphene_box_intersection Ptr Box
a' Ptr Box
b' Ptr Box
res
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Box
res' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box) Ptr Box
res
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
a
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
b
(Bool, Box) -> IO (Bool, Box)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Box
res')
#if defined(ENABLE_OVERLOADING)
data BoxIntersectionMethodInfo
instance (signature ~ (Box -> m ((Bool, Box))), MonadIO m) => O.MethodInfo BoxIntersectionMethodInfo Box signature where
overloadedMethod = boxIntersection
#endif
foreign import ccall "graphene_box_union" graphene_box_union ::
Ptr Box ->
Ptr Box ->
Ptr Box ->
IO ()
boxUnion ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> Box
-> m (Box)
boxUnion :: Box -> Box -> m Box
boxUnion a :: Box
a b :: Box
b = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
Ptr Box
b' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
b
Ptr Box
res <- Int -> IO (Ptr Box)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 32 :: IO (Ptr Box)
Ptr Box -> Ptr Box -> Ptr Box -> IO ()
graphene_box_union Ptr Box
a' Ptr Box
b' Ptr Box
res
Box
res' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box) Ptr Box
res
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
a
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
b
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
res'
#if defined(ENABLE_OVERLOADING)
data BoxUnionMethodInfo
instance (signature ~ (Box -> m (Box)), MonadIO m) => O.MethodInfo BoxUnionMethodInfo Box signature where
overloadedMethod = boxUnion
#endif
foreign import ccall "graphene_box_empty" graphene_box_empty ::
IO (Ptr Box)
boxEmpty ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxEmpty :: m Box
boxEmpty = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_empty
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxEmpty" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_box_infinite" graphene_box_infinite ::
IO (Ptr Box)
boxInfinite ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxInfinite :: m Box
boxInfinite = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_infinite
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxInfinite" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_box_minus_one" graphene_box_minus_one ::
IO (Ptr Box)
boxMinusOne ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxMinusOne :: m Box
boxMinusOne = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_minus_one
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxMinusOne" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_box_one" graphene_box_one ::
IO (Ptr Box)
boxOne ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxOne :: m Box
boxOne = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_one
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxOne" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_box_one_minus_one" graphene_box_one_minus_one ::
IO (Ptr Box)
boxOneMinusOne ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxOneMinusOne :: m Box
boxOneMinusOne = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_one_minus_one
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxOneMinusOne" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_box_zero" graphene_box_zero ::
IO (Ptr Box)
boxZero ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxZero :: m Box
boxZero = IO Box -> m Box
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
Ptr Box
result <- IO (Ptr Box)
graphene_box_zero
Text -> Ptr Box -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "boxZero" Ptr Box
result
Box
result' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Box -> Box
Box) Ptr Box
result
Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
result'
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveBoxMethod (t :: Symbol) (o :: *) :: * where
ResolveBoxMethod "containsBox" o = BoxContainsBoxMethodInfo
ResolveBoxMethod "containsPoint" o = BoxContainsPointMethodInfo
ResolveBoxMethod "equal" o = BoxEqualMethodInfo
ResolveBoxMethod "expand" o = BoxExpandMethodInfo
ResolveBoxMethod "expandScalar" o = BoxExpandScalarMethodInfo
ResolveBoxMethod "expandVec3" o = BoxExpandVec3MethodInfo
ResolveBoxMethod "free" o = BoxFreeMethodInfo
ResolveBoxMethod "init" o = BoxInitMethodInfo
ResolveBoxMethod "initFromBox" o = BoxInitFromBoxMethodInfo
ResolveBoxMethod "initFromPoints" o = BoxInitFromPointsMethodInfo
ResolveBoxMethod "initFromVec3" o = BoxInitFromVec3MethodInfo
ResolveBoxMethod "initFromVectors" o = BoxInitFromVectorsMethodInfo
ResolveBoxMethod "intersection" o = BoxIntersectionMethodInfo
ResolveBoxMethod "union" o = BoxUnionMethodInfo
ResolveBoxMethod "getBoundingSphere" o = BoxGetBoundingSphereMethodInfo
ResolveBoxMethod "getCenter" o = BoxGetCenterMethodInfo
ResolveBoxMethod "getDepth" o = BoxGetDepthMethodInfo
ResolveBoxMethod "getHeight" o = BoxGetHeightMethodInfo
ResolveBoxMethod "getMax" o = BoxGetMaxMethodInfo
ResolveBoxMethod "getMin" o = BoxGetMinMethodInfo
ResolveBoxMethod "getSize" o = BoxGetSizeMethodInfo
ResolveBoxMethod "getWidth" o = BoxGetWidthMethodInfo
ResolveBoxMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveBoxMethod t Box, O.MethodInfo info Box p) => OL.IsLabel t (Box -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif