{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Graphene.Structs.Plane
(
Plane(..) ,
newZeroPlane ,
noPlane ,
#if defined(ENABLE_OVERLOADING)
ResolvePlaneMethod ,
#endif
planeAlloc ,
#if defined(ENABLE_OVERLOADING)
PlaneDistanceMethodInfo ,
#endif
planeDistance ,
#if defined(ENABLE_OVERLOADING)
PlaneEqualMethodInfo ,
#endif
planeEqual ,
#if defined(ENABLE_OVERLOADING)
PlaneFreeMethodInfo ,
#endif
planeFree ,
#if defined(ENABLE_OVERLOADING)
PlaneGetConstantMethodInfo ,
#endif
planeGetConstant ,
#if defined(ENABLE_OVERLOADING)
PlaneGetNormalMethodInfo ,
#endif
planeGetNormal ,
#if defined(ENABLE_OVERLOADING)
PlaneInitMethodInfo ,
#endif
planeInit ,
#if defined(ENABLE_OVERLOADING)
PlaneInitFromPlaneMethodInfo ,
#endif
planeInitFromPlane ,
#if defined(ENABLE_OVERLOADING)
PlaneInitFromPointMethodInfo ,
#endif
planeInitFromPoint ,
#if defined(ENABLE_OVERLOADING)
PlaneInitFromPointsMethodInfo ,
#endif
planeInitFromPoints ,
#if defined(ENABLE_OVERLOADING)
PlaneInitFromVec4MethodInfo ,
#endif
planeInitFromVec4 ,
#if defined(ENABLE_OVERLOADING)
PlaneNegateMethodInfo ,
#endif
planeNegate ,
#if defined(ENABLE_OVERLOADING)
PlaneNormalizeMethodInfo ,
#endif
planeNormalize ,
) 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.Vec3 as Graphene.Vec3
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec4 as Graphene.Vec4
newtype Plane = Plane (ManagedPtr Plane)
deriving (Plane -> Plane -> Bool
(Plane -> Plane -> Bool) -> (Plane -> Plane -> Bool) -> Eq Plane
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Plane -> Plane -> Bool
$c/= :: Plane -> Plane -> Bool
== :: Plane -> Plane -> Bool
$c== :: Plane -> Plane -> Bool
Eq)
foreign import ccall "graphene_plane_get_type" c_graphene_plane_get_type ::
IO GType
instance BoxedObject Plane where
boxedType :: Plane -> IO GType
boxedType _ = IO GType
c_graphene_plane_get_type
instance B.GValue.IsGValue Plane where
toGValue :: Plane -> IO GValue
toGValue o :: Plane
o = do
GType
gtype <- IO GType
c_graphene_plane_get_type
Plane -> (Ptr Plane -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Plane
o (GType -> (GValue -> Ptr Plane -> IO ()) -> Ptr Plane -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Plane -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Plane
fromGValue gv :: GValue
gv = do
Ptr Plane
ptr <- GValue -> IO (Ptr Plane)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Plane)
(ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Plane -> Plane
Plane Ptr Plane
ptr
newZeroPlane :: MonadIO m => m Plane
newZeroPlane :: m Plane
newZeroPlane = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Plane)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 IO (Ptr Plane) -> (Ptr Plane -> IO Plane) -> IO Plane
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane
instance tag ~ 'AttrSet => Constructible Plane tag where
new :: (ManagedPtr Plane -> Plane) -> [AttrOp Plane tag] -> m Plane
new _ attrs :: [AttrOp Plane tag]
attrs = do
Plane
o <- m Plane
forall (m :: * -> *). MonadIO m => m Plane
newZeroPlane
Plane -> [AttrOp Plane 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Plane
o [AttrOp Plane tag]
[AttrOp Plane 'AttrSet]
attrs
Plane -> m Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
o
noPlane :: Maybe Plane
noPlane :: Maybe Plane
noPlane = Maybe Plane
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Plane
type instance O.AttributeList Plane = PlaneAttributeList
type PlaneAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "graphene_plane_alloc" graphene_plane_alloc ::
IO (Ptr Plane)
planeAlloc ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Plane
planeAlloc :: m Plane
planeAlloc = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
result <- IO (Ptr Plane)
graphene_plane_alloc
Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeAlloc" Ptr Plane
result
Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_plane_distance" graphene_plane_distance ::
Ptr Plane ->
Ptr Graphene.Point3D.Point3D ->
IO CFloat
planeDistance ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Graphene.Point3D.Point3D
-> m Float
planeDistance :: Plane -> Point3D -> m Float
planeDistance p :: Plane
p point :: Point3D
point = 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 Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Point3D
point' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
point
CFloat
result <- Ptr Plane -> Ptr Point3D -> IO CFloat
graphene_plane_distance Ptr Plane
p' Ptr Point3D
point'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
point
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data PlaneDistanceMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Float), MonadIO m) => O.MethodInfo PlaneDistanceMethodInfo Plane signature where
overloadedMethod = planeDistance
#endif
foreign import ccall "graphene_plane_equal" graphene_plane_equal ::
Ptr Plane ->
Ptr Plane ->
IO CInt
planeEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Plane
-> m Bool
planeEqual :: Plane -> Plane -> m Bool
planeEqual a :: Plane
a b :: Plane
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 Plane
a' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
a
Ptr Plane
b' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
b
CInt
result <- Ptr Plane -> Ptr Plane -> IO CInt
graphene_plane_equal Ptr Plane
a' Ptr Plane
b'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
a
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
b
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data PlaneEqualMethodInfo
instance (signature ~ (Plane -> m Bool), MonadIO m) => O.MethodInfo PlaneEqualMethodInfo Plane signature where
overloadedMethod = planeEqual
#endif
foreign import ccall "graphene_plane_free" graphene_plane_free ::
Ptr Plane ->
IO ()
planeFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> m ()
planeFree :: Plane -> m ()
planeFree p :: Plane
p = 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 Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Plane -> IO ()
graphene_plane_free Ptr Plane
p'
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PlaneFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo PlaneFreeMethodInfo Plane signature where
overloadedMethod = planeFree
#endif
foreign import ccall "graphene_plane_get_constant" graphene_plane_get_constant ::
Ptr Plane ->
IO CFloat
planeGetConstant ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> m Float
planeGetConstant :: Plane -> m Float
planeGetConstant p :: Plane
p = 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 Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
CFloat
result <- Ptr Plane -> IO CFloat
graphene_plane_get_constant Ptr Plane
p'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data PlaneGetConstantMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo PlaneGetConstantMethodInfo Plane signature where
overloadedMethod = planeGetConstant
#endif
foreign import ccall "graphene_plane_get_normal" graphene_plane_get_normal ::
Ptr Plane ->
Ptr Graphene.Vec3.Vec3 ->
IO ()
planeGetNormal ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> m (Graphene.Vec3.Vec3)
planeGetNormal :: Plane -> m Vec3
planeGetNormal p :: Plane
p = 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 Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Vec3
normal <- Int -> IO (Ptr Vec3)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Graphene.Vec3.Vec3)
Ptr Plane -> Ptr Vec3 -> IO ()
graphene_plane_get_normal Ptr Plane
p' Ptr Vec3
normal
Vec3
normal' <- ((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
normal
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Vec3 -> IO Vec3
forall (m :: * -> *) a. Monad m => a -> m a
return Vec3
normal'
#if defined(ENABLE_OVERLOADING)
data PlaneGetNormalMethodInfo
instance (signature ~ (m (Graphene.Vec3.Vec3)), MonadIO m) => O.MethodInfo PlaneGetNormalMethodInfo Plane signature where
overloadedMethod = planeGetNormal
#endif
foreign import ccall "graphene_plane_init" graphene_plane_init ::
Ptr Plane ->
Ptr Graphene.Vec3.Vec3 ->
CFloat ->
IO (Ptr Plane)
planeInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Maybe (Graphene.Vec3.Vec3)
-> Float
-> m Plane
planeInit :: Plane -> Maybe Vec3 -> Float -> m Plane
planeInit p :: Plane
p normal :: Maybe Vec3
normal constant :: Float
constant = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Vec3
maybeNormal <- case Maybe Vec3
normal of
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
Just jNormal :: Vec3
jNormal -> do
Ptr Vec3
jNormal' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jNormal
Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jNormal'
let constant' :: CFloat
constant' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
constant
Ptr Plane
result <- Ptr Plane -> Ptr Vec3 -> CFloat -> IO (Ptr Plane)
graphene_plane_init Ptr Plane
p' Ptr Vec3
maybeNormal CFloat
constant'
Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInit" Ptr Plane
result
Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
normal Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'
#if defined(ENABLE_OVERLOADING)
data PlaneInitMethodInfo
instance (signature ~ (Maybe (Graphene.Vec3.Vec3) -> Float -> m Plane), MonadIO m) => O.MethodInfo PlaneInitMethodInfo Plane signature where
overloadedMethod = planeInit
#endif
foreign import ccall "graphene_plane_init_from_plane" graphene_plane_init_from_plane ::
Ptr Plane ->
Ptr Plane ->
IO (Ptr Plane)
planeInitFromPlane ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Plane
-> m Plane
planeInitFromPlane :: Plane -> Plane -> m Plane
planeInitFromPlane p :: Plane
p src :: Plane
src = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Plane
src' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
src
Ptr Plane
result <- Ptr Plane -> Ptr Plane -> IO (Ptr Plane)
graphene_plane_init_from_plane Ptr Plane
p' Ptr Plane
src'
Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromPlane" Ptr Plane
result
Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
src
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'
#if defined(ENABLE_OVERLOADING)
data PlaneInitFromPlaneMethodInfo
instance (signature ~ (Plane -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromPlaneMethodInfo Plane signature where
overloadedMethod = planeInitFromPlane
#endif
foreign import ccall "graphene_plane_init_from_point" graphene_plane_init_from_point ::
Ptr Plane ->
Ptr Graphene.Vec3.Vec3 ->
Ptr Graphene.Point3D.Point3D ->
IO (Ptr Plane)
planeInitFromPoint ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Graphene.Vec3.Vec3
-> Graphene.Point3D.Point3D
-> m Plane
planeInitFromPoint :: Plane -> Vec3 -> Point3D -> m Plane
planeInitFromPoint p :: Plane
p normal :: Vec3
normal point :: Point3D
point = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Vec3
normal' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
normal
Ptr Point3D
point' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
point
Ptr Plane
result <- Ptr Plane -> Ptr Vec3 -> Ptr Point3D -> IO (Ptr Plane)
graphene_plane_init_from_point Ptr Plane
p' Ptr Vec3
normal' Ptr Point3D
point'
Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromPoint" Ptr Plane
result
Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec3
normal
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
point
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'
#if defined(ENABLE_OVERLOADING)
data PlaneInitFromPointMethodInfo
instance (signature ~ (Graphene.Vec3.Vec3 -> Graphene.Point3D.Point3D -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromPointMethodInfo Plane signature where
overloadedMethod = planeInitFromPoint
#endif
foreign import ccall "graphene_plane_init_from_points" graphene_plane_init_from_points ::
Ptr Plane ->
Ptr Graphene.Point3D.Point3D ->
Ptr Graphene.Point3D.Point3D ->
Ptr Graphene.Point3D.Point3D ->
IO (Ptr Plane)
planeInitFromPoints ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Graphene.Point3D.Point3D
-> Graphene.Point3D.Point3D
-> Graphene.Point3D.Point3D
-> m Plane
planeInitFromPoints :: Plane -> Point3D -> Point3D -> Point3D -> m Plane
planeInitFromPoints p :: Plane
p a :: Point3D
a b :: Point3D
b c :: Point3D
c = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Point3D
a' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
a
Ptr Point3D
b' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
b
Ptr Point3D
c' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
c
Ptr Plane
result <- Ptr Plane
-> Ptr Point3D -> Ptr Point3D -> Ptr Point3D -> IO (Ptr Plane)
graphene_plane_init_from_points Ptr Plane
p' Ptr Point3D
a' Ptr Point3D
b' Ptr Point3D
c'
Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromPoints" Ptr Plane
result
Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
a
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
b
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
c
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'
#if defined(ENABLE_OVERLOADING)
data PlaneInitFromPointsMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> Graphene.Point3D.Point3D -> Graphene.Point3D.Point3D -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromPointsMethodInfo Plane signature where
overloadedMethod = planeInitFromPoints
#endif
foreign import ccall "graphene_plane_init_from_vec4" graphene_plane_init_from_vec4 ::
Ptr Plane ->
Ptr Graphene.Vec4.Vec4 ->
IO (Ptr Plane)
planeInitFromVec4 ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> Graphene.Vec4.Vec4
-> m Plane
planeInitFromVec4 :: Plane -> Vec4 -> m Plane
planeInitFromVec4 p :: Plane
p src :: Vec4
src = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Vec4
src' <- Vec4 -> IO (Ptr Vec4)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec4
src
Ptr Plane
result <- Ptr Plane -> Ptr Vec4 -> IO (Ptr Plane)
graphene_plane_init_from_vec4 Ptr Plane
p' Ptr Vec4
src'
Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromVec4" Ptr Plane
result
Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Vec4 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec4
src
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'
#if defined(ENABLE_OVERLOADING)
data PlaneInitFromVec4MethodInfo
instance (signature ~ (Graphene.Vec4.Vec4 -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromVec4MethodInfo Plane signature where
overloadedMethod = planeInitFromVec4
#endif
foreign import ccall "graphene_plane_negate" graphene_plane_negate ::
Ptr Plane ->
Ptr Plane ->
IO ()
planeNegate ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> m (Plane)
planeNegate :: Plane -> m Plane
planeNegate p :: Plane
p = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Plane
res <- Int -> IO (Ptr Plane)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 :: IO (Ptr Plane)
Ptr Plane -> Ptr Plane -> IO ()
graphene_plane_negate Ptr Plane
p' Ptr Plane
res
Plane
res' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
res
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
res'
#if defined(ENABLE_OVERLOADING)
data PlaneNegateMethodInfo
instance (signature ~ (m (Plane)), MonadIO m) => O.MethodInfo PlaneNegateMethodInfo Plane signature where
overloadedMethod = planeNegate
#endif
foreign import ccall "graphene_plane_normalize" graphene_plane_normalize ::
Ptr Plane ->
Ptr Plane ->
IO ()
planeNormalize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Plane
-> m (Plane)
planeNormalize :: Plane -> m Plane
planeNormalize p :: Plane
p = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
Ptr Plane
res <- Int -> IO (Ptr Plane)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 :: IO (Ptr Plane)
Ptr Plane -> Ptr Plane -> IO ()
graphene_plane_normalize Ptr Plane
p' Ptr Plane
res
Plane
res' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
res
Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
res'
#if defined(ENABLE_OVERLOADING)
data PlaneNormalizeMethodInfo
instance (signature ~ (m (Plane)), MonadIO m) => O.MethodInfo PlaneNormalizeMethodInfo Plane signature where
overloadedMethod = planeNormalize
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolvePlaneMethod (t :: Symbol) (o :: *) :: * where
ResolvePlaneMethod "distance" o = PlaneDistanceMethodInfo
ResolvePlaneMethod "equal" o = PlaneEqualMethodInfo
ResolvePlaneMethod "free" o = PlaneFreeMethodInfo
ResolvePlaneMethod "init" o = PlaneInitMethodInfo
ResolvePlaneMethod "initFromPlane" o = PlaneInitFromPlaneMethodInfo
ResolvePlaneMethod "initFromPoint" o = PlaneInitFromPointMethodInfo
ResolvePlaneMethod "initFromPoints" o = PlaneInitFromPointsMethodInfo
ResolvePlaneMethod "initFromVec4" o = PlaneInitFromVec4MethodInfo
ResolvePlaneMethod "negate" o = PlaneNegateMethodInfo
ResolvePlaneMethod "normalize" o = PlaneNormalizeMethodInfo
ResolvePlaneMethod "getConstant" o = PlaneGetConstantMethodInfo
ResolvePlaneMethod "getNormal" o = PlaneGetNormalMethodInfo
ResolvePlaneMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePlaneMethod t Plane, O.MethodInfo info Plane p) => OL.IsLabel t (Plane -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif