{-# LANGUAGE TypeApplications #-}
#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif
module GI.Graphene.Structs.Box
(
Box(..) ,
newZeroBox ,
#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point as Graphene.Point
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
import {-# SOURCE #-} qualified GI.Graphene.Structs.Rect as Graphene.Rect
import {-# SOURCE #-} qualified GI.Graphene.Structs.Size as Graphene.Size
import {-# SOURCE #-} qualified GI.Graphene.Structs.Sphere as Graphene.Sphere
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec2 as Graphene.Vec2
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec4 as Graphene.Vec4
#else
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
#endif
newtype Box = Box (SP.ManagedPtr Box)
deriving (Box -> Box -> Bool
(Box -> Box -> Bool) -> (Box -> Box -> Bool) -> Eq Box
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Box -> Box -> Bool
== :: Box -> Box -> Bool
$c/= :: Box -> Box -> Bool
/= :: Box -> Box -> Bool
Eq)
instance SP.ManagedPtrNewtype Box where
toManagedPtr :: Box -> ManagedPtr Box
toManagedPtr (Box ManagedPtr Box
p) = ManagedPtr Box
p
foreign import ccall "graphene_box_get_type" c_graphene_box_get_type ::
IO GType
type instance O.ParentTypes Box = '[]
instance O.HasParentTypes Box
instance B.Types.TypedObject Box where
glibType :: IO GType
glibType = IO GType
c_graphene_box_get_type
instance B.Types.GBoxed Box
instance B.GValue.IsGValue (Maybe Box) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_graphene_box_get_type
gvalueSet_ :: Ptr GValue -> Maybe Box -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Box
P.Nothing = Ptr GValue -> Ptr Box -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Box
forall a. Ptr a
FP.nullPtr :: FP.Ptr Box)
gvalueSet_ Ptr GValue
gv (P.Just Box
obj) = Box -> (Ptr Box -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Box
obj (Ptr GValue -> Ptr Box -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Box)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Box)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Box)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newBoxed Box ptr
else return P.Nothing
newZeroBox :: MonadIO m => m Box
newZeroBox :: forall (m :: * -> *). MonadIO m => m Box
newZeroBox = IO Box -> m Box
forall a. IO a -> m a
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. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
32 IO (Ptr Box) -> (Ptr Box -> IO Box) -> IO Box
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Box
instance tag ~ 'AttrSet => Constructible Box tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Box -> Box) -> [AttrOp Box tag] -> m Box
new ManagedPtr Box -> Box
_ [AttrOp Box tag]
attrs = do
o <- m Box
forall (m :: * -> *). MonadIO m => m Box
newZeroBox
GI.Attributes.set o attrs
return o
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Box
type instance O.AttributeList Box = BoxAttributeList
type BoxAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "graphene_box_alloc" graphene_box_alloc ::
IO (Ptr Box)
boxAlloc ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxAlloc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxAlloc = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_alloc
checkUnexpectedReturnNULL "boxAlloc" result
result' <- (wrapBoxed Box) result
return 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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Box -> m Bool
boxContainsBox Box
a Box
b = IO Bool -> m Bool
forall a. IO a -> m a
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
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
b' <- unsafeManagedPtrGetPtr b
result <- graphene_box_contains_box a' b'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr a
touchManagedPtr b
return result'
#if defined(ENABLE_OVERLOADING)
data BoxContainsBoxMethodInfo
instance (signature ~ (Box -> m Bool), MonadIO m) => O.OverloadedMethod BoxContainsBoxMethodInfo Box signature where
overloadedMethod = boxContainsBox
instance O.OverloadedMethodInfo BoxContainsBoxMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxContainsBox",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Point3D -> m Bool
boxContainsPoint Box
box Point3D
point = IO Bool -> m Bool
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
point' <- unsafeManagedPtrGetPtr point
result <- graphene_box_contains_point box' point'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr box
touchManagedPtr point
return result'
#if defined(ENABLE_OVERLOADING)
data BoxContainsPointMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Bool), MonadIO m) => O.OverloadedMethod BoxContainsPointMethodInfo Box signature where
overloadedMethod = boxContainsPoint
instance O.OverloadedMethodInfo BoxContainsPointMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxContainsPoint",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Box -> m Bool
boxEqual Box
a Box
b = IO Bool -> m Bool
forall a. IO a -> m a
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
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
b' <- unsafeManagedPtrGetPtr b
result <- graphene_box_equal a' b'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr a
touchManagedPtr b
return result'
#if defined(ENABLE_OVERLOADING)
data BoxEqualMethodInfo
instance (signature ~ (Box -> m Bool), MonadIO m) => O.OverloadedMethod BoxEqualMethodInfo Box signature where
overloadedMethod = boxEqual
instance O.OverloadedMethodInfo BoxEqualMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxEqual",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Point3D -> m Box
boxExpand Box
box Point3D
point = IO Box -> m Box
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
point' <- unsafeManagedPtrGetPtr point
res <- SP.callocBoxedBytes 32 :: IO (Ptr Box)
graphene_box_expand box' point' res
res' <- (wrapBoxed Box) res
touchManagedPtr box
touchManagedPtr point
return res'
#if defined(ENABLE_OVERLOADING)
data BoxExpandMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m (Box)), MonadIO m) => O.OverloadedMethod BoxExpandMethodInfo Box signature where
overloadedMethod = boxExpand
instance O.OverloadedMethodInfo BoxExpandMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxExpand",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Float -> m Box
boxExpandScalar Box
box Float
scalar = IO Box -> m Box
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
let scalar' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
scalar
res <- SP.callocBoxedBytes 32 :: IO (Ptr Box)
graphene_box_expand_scalar box' scalar' res
res' <- (wrapBoxed Box) res
touchManagedPtr box
return res'
#if defined(ENABLE_OVERLOADING)
data BoxExpandScalarMethodInfo
instance (signature ~ (Float -> m (Box)), MonadIO m) => O.OverloadedMethod BoxExpandScalarMethodInfo Box signature where
overloadedMethod = boxExpandScalar
instance O.OverloadedMethodInfo BoxExpandScalarMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxExpandScalar",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Vec3 -> m Box
boxExpandVec3 Box
box Vec3
vec = IO Box -> m Box
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
vec' <- unsafeManagedPtrGetPtr vec
res <- SP.callocBoxedBytes 32 :: IO (Ptr Box)
graphene_box_expand_vec3 box' vec' res
res' <- (wrapBoxed Box) res
touchManagedPtr box
touchManagedPtr vec
return res'
#if defined(ENABLE_OVERLOADING)
data BoxExpandVec3MethodInfo
instance (signature ~ (Graphene.Vec3.Vec3 -> m (Box)), MonadIO m) => O.OverloadedMethod BoxExpandVec3MethodInfo Box signature where
overloadedMethod = boxExpandVec3
instance O.OverloadedMethodInfo BoxExpandVec3MethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxExpandVec3",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v:boxExpandVec3"
})
#endif
foreign import ccall "graphene_box_free" graphene_box_free ::
Ptr Box ->
IO ()
boxFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Box
-> m ()
boxFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m ()
boxFree Box
box = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
graphene_box_free box'
touchManagedPtr box
return ()
#if defined(ENABLE_OVERLOADING)
data BoxFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod BoxFreeMethodInfo Box signature where
overloadedMethod = boxFree
instance O.OverloadedMethodInfo BoxFreeMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Sphere
boxGetBoundingSphere Box
box = IO Sphere -> m Sphere
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
sphere <- SP.callocBoxedBytes 20 :: IO (Ptr Graphene.Sphere.Sphere)
graphene_box_get_bounding_sphere box' sphere
sphere' <- (wrapBoxed Graphene.Sphere.Sphere) sphere
touchManagedPtr box
return sphere'
#if defined(ENABLE_OVERLOADING)
data BoxGetBoundingSphereMethodInfo
instance (signature ~ (m (Graphene.Sphere.Sphere)), MonadIO m) => O.OverloadedMethod BoxGetBoundingSphereMethodInfo Box signature where
overloadedMethod = boxGetBoundingSphere
instance O.OverloadedMethodInfo BoxGetBoundingSphereMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetBoundingSphere",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Point3D
boxGetCenter Box
box = IO Point3D -> m Point3D
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
center <- SP.callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
graphene_box_get_center box' center
center' <- (wrapBoxed Graphene.Point3D.Point3D) center
touchManagedPtr box
return center'
#if defined(ENABLE_OVERLOADING)
data BoxGetCenterMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod BoxGetCenterMethodInfo Box signature where
overloadedMethod = boxGetCenter
instance O.OverloadedMethodInfo BoxGetCenterMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetCenter",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Float
boxGetDepth Box
box = IO Float -> m Float
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
result <- graphene_box_get_depth box'
let result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
touchManagedPtr box
return result'
#if defined(ENABLE_OVERLOADING)
data BoxGetDepthMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.OverloadedMethod BoxGetDepthMethodInfo Box signature where
overloadedMethod = boxGetDepth
instance O.OverloadedMethodInfo BoxGetDepthMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetDepth",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Float
boxGetHeight Box
box = IO Float -> m Float
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
result <- graphene_box_get_height box'
let result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
touchManagedPtr box
return result'
#if defined(ENABLE_OVERLOADING)
data BoxGetHeightMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.OverloadedMethod BoxGetHeightMethodInfo Box signature where
overloadedMethod = boxGetHeight
instance O.OverloadedMethodInfo BoxGetHeightMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetHeight",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Point3D
boxGetMax Box
box = IO Point3D -> m Point3D
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
max <- SP.callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
graphene_box_get_max box' max
max' <- (wrapBoxed Graphene.Point3D.Point3D) max
touchManagedPtr box
return max'
#if defined(ENABLE_OVERLOADING)
data BoxGetMaxMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod BoxGetMaxMethodInfo Box signature where
overloadedMethod = boxGetMax
instance O.OverloadedMethodInfo BoxGetMaxMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetMax",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Point3D
boxGetMin Box
box = IO Point3D -> m Point3D
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
min <- SP.callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
graphene_box_get_min box' min
min' <- (wrapBoxed Graphene.Point3D.Point3D) min
touchManagedPtr box
return min'
#if defined(ENABLE_OVERLOADING)
data BoxGetMinMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod BoxGetMinMethodInfo Box signature where
overloadedMethod = boxGetMin
instance O.OverloadedMethodInfo BoxGetMinMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetMin",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Vec3
boxGetSize Box
box = IO Vec3 -> m Vec3
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
size <- SP.callocBoxedBytes 16 :: IO (Ptr Graphene.Vec3.Vec3)
graphene_box_get_size box' size
size' <- (wrapBoxed Graphene.Vec3.Vec3) size
touchManagedPtr box
return size'
#if defined(ENABLE_OVERLOADING)
data BoxGetSizeMethodInfo
instance (signature ~ (m (Graphene.Vec3.Vec3)), MonadIO m) => O.OverloadedMethod BoxGetSizeMethodInfo Box signature where
overloadedMethod = boxGetSize
instance O.OverloadedMethodInfo BoxGetSizeMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Box -> m Float
boxGetWidth Box
box = IO Float -> m Float
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
result <- graphene_box_get_width box'
let result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
touchManagedPtr box
return result'
#if defined(ENABLE_OVERLOADING)
data BoxGetWidthMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.OverloadedMethod BoxGetWidthMethodInfo Box signature where
overloadedMethod = boxGetWidth
instance O.OverloadedMethodInfo BoxGetWidthMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxGetWidth",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Maybe Point3D -> Maybe Point3D -> m Box
boxInit Box
box Maybe Point3D
min Maybe Point3D
max = IO Box -> m Box
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
maybeMin <- case min of
Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
FP.nullPtr
Just Point3D
jMin -> do
jMin' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jMin
return jMin'
maybeMax <- case max of
Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
FP.nullPtr
Just Point3D
jMax -> do
jMax' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jMax
return jMax'
result <- graphene_box_init box' maybeMin maybeMax
checkUnexpectedReturnNULL "boxInit" result
result' <- (newBoxed Box) result
touchManagedPtr box
whenJust min touchManagedPtr
whenJust max touchManagedPtr
return result'
#if defined(ENABLE_OVERLOADING)
data BoxInitMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> Maybe (Graphene.Point3D.Point3D) -> m Box), MonadIO m) => O.OverloadedMethod BoxInitMethodInfo Box signature where
overloadedMethod = boxInit
instance O.OverloadedMethodInfo BoxInitMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxInit",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Box -> m Box
boxInitFromBox Box
box Box
src = IO Box -> m Box
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
src' <- unsafeManagedPtrGetPtr src
result <- graphene_box_init_from_box box' src'
checkUnexpectedReturnNULL "boxInitFromBox" result
result' <- (newBoxed Box) result
touchManagedPtr box
touchManagedPtr src
return result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromBoxMethodInfo
instance (signature ~ (Box -> m Box), MonadIO m) => O.OverloadedMethod BoxInitFromBoxMethodInfo Box signature where
overloadedMethod = boxInitFromBox
instance O.OverloadedMethodInfo BoxInitFromBoxMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxInitFromBox",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> [Point3D] -> m Box
boxInitFromPoints Box
box [Point3D]
points = IO Box -> m Box
forall a. IO a -> m a
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 a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Point3D]
points
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
points' <- mapM unsafeManagedPtrGetPtr points
points'' <- packBlockArray 12 points'
result <- graphene_box_init_from_points box' nPoints points''
checkUnexpectedReturnNULL "boxInitFromPoints" result
result' <- (newBoxed Box) result
touchManagedPtr box
mapM_ touchManagedPtr points
freeMem points''
return result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromPointsMethodInfo
instance (signature ~ ([Graphene.Point3D.Point3D] -> m Box), MonadIO m) => O.OverloadedMethod BoxInitFromPointsMethodInfo Box signature where
overloadedMethod = boxInitFromPoints
instance O.OverloadedMethodInfo BoxInitFromPointsMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxInitFromPoints",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Maybe Vec3 -> Maybe Vec3 -> m Box
boxInitFromVec3 Box
box Maybe Vec3
min Maybe Vec3
max = IO Box -> m Box
forall a. IO a -> m a
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
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
maybeMin <- case min of
Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
FP.nullPtr
Just Vec3
jMin -> do
jMin' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jMin
return jMin'
maybeMax <- case max of
Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
FP.nullPtr
Just Vec3
jMax -> do
jMax' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jMax
return jMax'
result <- graphene_box_init_from_vec3 box' maybeMin maybeMax
checkUnexpectedReturnNULL "boxInitFromVec3" result
result' <- (newBoxed Box) result
touchManagedPtr box
whenJust min touchManagedPtr
whenJust max touchManagedPtr
return result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromVec3MethodInfo
instance (signature ~ (Maybe (Graphene.Vec3.Vec3) -> Maybe (Graphene.Vec3.Vec3) -> m Box), MonadIO m) => O.OverloadedMethod BoxInitFromVec3MethodInfo Box signature where
overloadedMethod = boxInitFromVec3
instance O.OverloadedMethodInfo BoxInitFromVec3MethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxInitFromVec3",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> [Vec3] -> m Box
boxInitFromVectors Box
box [Vec3]
vectors = IO Box -> m Box
forall a. IO a -> m a
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 a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Vec3]
vectors
box' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
box
vectors' <- mapM unsafeManagedPtrGetPtr vectors
vectors'' <- packBlockArray 16 vectors'
result <- graphene_box_init_from_vectors box' nVectors vectors''
checkUnexpectedReturnNULL "boxInitFromVectors" result
result' <- (newBoxed Box) result
touchManagedPtr box
mapM_ touchManagedPtr vectors
freeMem vectors''
return result'
#if defined(ENABLE_OVERLOADING)
data BoxInitFromVectorsMethodInfo
instance (signature ~ ([Graphene.Vec3.Vec3] -> m Box), MonadIO m) => O.OverloadedMethod BoxInitFromVectorsMethodInfo Box signature where
overloadedMethod = boxInitFromVectors
instance O.OverloadedMethodInfo BoxInitFromVectorsMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxInitFromVectors",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Box -> m (Bool, Box)
boxIntersection Box
a Box
b = IO (Bool, Box) -> m (Bool, Box)
forall a. IO a -> m a
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
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
b' <- unsafeManagedPtrGetPtr b
res <- SP.callocBoxedBytes 32 :: IO (Ptr Box)
result <- graphene_box_intersection a' b' res
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
res' <- (wrapBoxed Box) res
touchManagedPtr a
touchManagedPtr b
return (result', res')
#if defined(ENABLE_OVERLOADING)
data BoxIntersectionMethodInfo
instance (signature ~ (Box -> m ((Bool, Box))), MonadIO m) => O.OverloadedMethod BoxIntersectionMethodInfo Box signature where
overloadedMethod = boxIntersection
instance O.OverloadedMethodInfo BoxIntersectionMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxIntersection",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Box -> Box -> m Box
boxUnion Box
a Box
b = IO Box -> m Box
forall a. IO a -> m a
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
a' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
a
b' <- unsafeManagedPtrGetPtr b
res <- SP.callocBoxedBytes 32 :: IO (Ptr Box)
graphene_box_union a' b' res
res' <- (wrapBoxed Box) res
touchManagedPtr a
touchManagedPtr b
return res'
#if defined(ENABLE_OVERLOADING)
data BoxUnionMethodInfo
instance (signature ~ (Box -> m (Box)), MonadIO m) => O.OverloadedMethod BoxUnionMethodInfo Box signature where
overloadedMethod = boxUnion
instance O.OverloadedMethodInfo BoxUnionMethodInfo Box where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Box.boxUnion",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Box.html#v:boxUnion"
})
#endif
foreign import ccall "graphene_box_empty" graphene_box_empty ::
IO (Ptr Box)
boxEmpty ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Box
boxEmpty :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxEmpty = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_empty
checkUnexpectedReturnNULL "boxEmpty" result
result' <- (newBoxed Box) result
return 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxInfinite = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_infinite
checkUnexpectedReturnNULL "boxInfinite" result
result' <- (newBoxed Box) result
return 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxMinusOne = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_minus_one
checkUnexpectedReturnNULL "boxMinusOne" result
result' <- (newBoxed Box) result
return 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxOne = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_one
checkUnexpectedReturnNULL "boxOne" result
result' <- (newBoxed Box) result
return 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxOneMinusOne = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_one_minus_one
checkUnexpectedReturnNULL "boxOneMinusOne" result
result' <- (newBoxed Box) result
return 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Box
boxZero = IO Box -> m Box
forall a. IO a -> m a
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
result <- IO (Ptr Box)
graphene_box_zero
checkUnexpectedReturnNULL "boxZero" result
result' <- (newBoxed Box) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveBoxMethod (t :: Symbol) (o :: DK.Type) :: DK.Type 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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveBoxMethod t Box, O.OverloadedMethod info Box p, R.HasField t Box p) => R.HasField t Box p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveBoxMethod t Box, O.OverloadedMethodInfo info Box) => OL.IsLabel t (O.MethodProxy info Box) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif