{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Graphene.Structs.Ray
(
Ray(..) ,
newZeroRay ,
#if defined(ENABLE_OVERLOADING)
ResolveRayMethod ,
#endif
rayAlloc ,
#if defined(ENABLE_OVERLOADING)
RayEqualMethodInfo ,
#endif
rayEqual ,
#if defined(ENABLE_OVERLOADING)
RayFreeMethodInfo ,
#endif
rayFree ,
#if defined(ENABLE_OVERLOADING)
RayGetClosestPointToPointMethodInfo ,
#endif
rayGetClosestPointToPoint ,
#if defined(ENABLE_OVERLOADING)
RayGetDirectionMethodInfo ,
#endif
rayGetDirection ,
#if defined(ENABLE_OVERLOADING)
RayGetDistanceToPlaneMethodInfo ,
#endif
rayGetDistanceToPlane ,
#if defined(ENABLE_OVERLOADING)
RayGetDistanceToPointMethodInfo ,
#endif
rayGetDistanceToPoint ,
#if defined(ENABLE_OVERLOADING)
RayGetOriginMethodInfo ,
#endif
rayGetOrigin ,
#if defined(ENABLE_OVERLOADING)
RayGetPositionAtMethodInfo ,
#endif
rayGetPositionAt ,
#if defined(ENABLE_OVERLOADING)
RayInitMethodInfo ,
#endif
rayInit ,
#if defined(ENABLE_OVERLOADING)
RayInitFromRayMethodInfo ,
#endif
rayInitFromRay ,
#if defined(ENABLE_OVERLOADING)
RayInitFromVec3MethodInfo ,
#endif
rayInitFromVec3 ,
#if defined(ENABLE_OVERLOADING)
RayIntersectBoxMethodInfo ,
#endif
rayIntersectBox ,
#if defined(ENABLE_OVERLOADING)
RayIntersectSphereMethodInfo ,
#endif
rayIntersectSphere ,
#if defined(ENABLE_OVERLOADING)
RayIntersectTriangleMethodInfo ,
#endif
rayIntersectTriangle ,
#if defined(ENABLE_OVERLOADING)
RayIntersectsBoxMethodInfo ,
#endif
rayIntersectsBox ,
#if defined(ENABLE_OVERLOADING)
RayIntersectsSphereMethodInfo ,
#endif
rayIntersectsSphere ,
#if defined(ENABLE_OVERLOADING)
RayIntersectsTriangleMethodInfo ,
#endif
rayIntersectsTriangle ,
) 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.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.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 {-# SOURCE #-} qualified GI.Graphene.Enums as Graphene.Enums
import {-# SOURCE #-} qualified GI.Graphene.Structs.Box as Graphene.Box
import {-# SOURCE #-} qualified GI.Graphene.Structs.Plane as Graphene.Plane
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.Triangle as Graphene.Triangle
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3
newtype Ray = Ray (SP.ManagedPtr Ray)
deriving (Ray -> Ray -> Bool
(Ray -> Ray -> Bool) -> (Ray -> Ray -> Bool) -> Eq Ray
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ray -> Ray -> Bool
$c/= :: Ray -> Ray -> Bool
== :: Ray -> Ray -> Bool
$c== :: Ray -> Ray -> Bool
Eq)
instance SP.ManagedPtrNewtype Ray where
toManagedPtr :: Ray -> ManagedPtr Ray
toManagedPtr (Ray ManagedPtr Ray
p) = ManagedPtr Ray
p
foreign import ccall "graphene_ray_get_type" c_graphene_ray_get_type ::
IO GType
type instance O.ParentTypes Ray = '[]
instance O.HasParentTypes Ray
instance B.Types.TypedObject Ray where
glibType :: IO GType
glibType = IO GType
c_graphene_ray_get_type
instance B.Types.GBoxed Ray
instance B.GValue.IsGValue (Maybe Ray) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_graphene_ray_get_type
gvalueSet_ :: Ptr GValue -> Maybe Ray -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Ray
P.Nothing = Ptr GValue -> Ptr Ray -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Ray
forall a. Ptr a
FP.nullPtr :: FP.Ptr Ray)
gvalueSet_ Ptr GValue
gv (P.Just Ray
obj) = Ray -> (Ptr Ray -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Ray
obj (Ptr GValue -> Ptr Ray -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Ray)
gvalueGet_ Ptr GValue
gv = do
Ptr Ray
ptr <- Ptr GValue -> IO (Ptr Ray)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Ray)
if Ptr Ray
ptr Ptr Ray -> Ptr Ray -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Ray
forall a. Ptr a
FP.nullPtr
then Ray -> Maybe Ray
forall a. a -> Maybe a
P.Just (Ray -> Maybe Ray) -> IO Ray -> IO (Maybe Ray)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Ray -> Ray) -> Ptr Ray -> IO Ray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Ray -> Ray
Ray Ptr Ray
ptr
else Maybe Ray -> IO (Maybe Ray)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Ray
forall a. Maybe a
P.Nothing
newZeroRay :: MonadIO m => m Ray
newZeroRay :: forall (m :: * -> *). MonadIO m => m Ray
newZeroRay = IO Ray -> m Ray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Ray -> m Ray) -> IO Ray -> m Ray
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Ray)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
32 IO (Ptr Ray) -> (Ptr Ray -> IO Ray) -> IO Ray
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Ray -> Ray) -> Ptr Ray -> IO Ray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Ray -> Ray
Ray
instance tag ~ 'AttrSet => Constructible Ray tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Ray -> Ray) -> [AttrOp Ray tag] -> m Ray
new ManagedPtr Ray -> Ray
_ [AttrOp Ray tag]
attrs = do
Ray
o <- m Ray
forall (m :: * -> *). MonadIO m => m Ray
newZeroRay
Ray -> [AttrOp Ray 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Ray
o [AttrOp Ray tag]
[AttrOp Ray 'AttrSet]
attrs
Ray -> m Ray
forall (m :: * -> *) a. Monad m => a -> m a
return Ray
o
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Ray
type instance O.AttributeList Ray = RayAttributeList
type RayAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "graphene_ray_alloc" graphene_ray_alloc ::
IO (Ptr Ray)
rayAlloc ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Ray
rayAlloc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Ray
rayAlloc = IO Ray -> m Ray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Ray -> m Ray) -> IO Ray -> m Ray
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
result <- IO (Ptr Ray)
graphene_ray_alloc
Text -> Ptr Ray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rayAlloc" Ptr Ray
result
Ray
result' <- ((ManagedPtr Ray -> Ray) -> Ptr Ray -> IO Ray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Ray -> Ray
Ray) Ptr Ray
result
Ray -> IO Ray
forall (m :: * -> *) a. Monad m => a -> m a
return Ray
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_ray_equal" graphene_ray_equal ::
Ptr Ray ->
Ptr Ray ->
IO CInt
rayEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Ray
-> m Bool
rayEqual :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Ray -> m Bool
rayEqual Ray
a Ray
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 Ray
a' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
a
Ptr Ray
b' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
b
CInt
result <- Ptr Ray -> Ptr Ray -> IO CInt
graphene_ray_equal Ptr Ray
a' Ptr Ray
b'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
a
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
b
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data RayEqualMethodInfo
instance (signature ~ (Ray -> m Bool), MonadIO m) => O.OverloadedMethod RayEqualMethodInfo Ray signature where
overloadedMethod = rayEqual
instance O.OverloadedMethodInfo RayEqualMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayEqual",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayEqual"
})
#endif
foreign import ccall "graphene_ray_free" graphene_ray_free ::
Ptr Ray ->
IO ()
rayFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> m ()
rayFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ray -> m ()
rayFree Ray
r = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Ray -> IO ()
graphene_ray_free Ptr Ray
r'
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data RayFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod RayFreeMethodInfo Ray signature where
overloadedMethod = rayFree
instance O.OverloadedMethodInfo RayFreeMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayFree"
})
#endif
foreign import ccall "graphene_ray_get_closest_point_to_point" graphene_ray_get_closest_point_to_point ::
Ptr Ray ->
Ptr Graphene.Point3D.Point3D ->
Ptr Graphene.Point3D.Point3D ->
IO ()
rayGetClosestPointToPoint ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Point3D.Point3D
-> m (Graphene.Point3D.Point3D)
rayGetClosestPointToPoint :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Point3D -> m Point3D
rayGetClosestPointToPoint Ray
r Point3D
p = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Point3D
p' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
p
Ptr Point3D
res <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
Ptr Ray -> Ptr Point3D -> Ptr Point3D -> IO ()
graphene_ray_get_closest_point_to_point Ptr Ray
r' Ptr Point3D
p' Ptr Point3D
res
Point3D
res' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
res
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
p
Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
res'
#if defined(ENABLE_OVERLOADING)
data RayGetClosestPointToPointMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod RayGetClosestPointToPointMethodInfo Ray signature where
overloadedMethod = rayGetClosestPointToPoint
instance O.OverloadedMethodInfo RayGetClosestPointToPointMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayGetClosestPointToPoint",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayGetClosestPointToPoint"
})
#endif
foreign import ccall "graphene_ray_get_direction" graphene_ray_get_direction ::
Ptr Ray ->
Ptr Graphene.Vec3.Vec3 ->
IO ()
rayGetDirection ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> m (Graphene.Vec3.Vec3)
rayGetDirection :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ray -> m Vec3
rayGetDirection Ray
r = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Vec3
direction <- Int -> IO (Ptr Vec3)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec3.Vec3)
Ptr Ray -> Ptr Vec3 -> IO ()
graphene_ray_get_direction Ptr Ray
r' Ptr Vec3
direction
Vec3
direction' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
direction
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Vec3 -> IO Vec3
forall (m :: * -> *) a. Monad m => a -> m a
return Vec3
direction'
#if defined(ENABLE_OVERLOADING)
data RayGetDirectionMethodInfo
instance (signature ~ (m (Graphene.Vec3.Vec3)), MonadIO m) => O.OverloadedMethod RayGetDirectionMethodInfo Ray signature where
overloadedMethod = rayGetDirection
instance O.OverloadedMethodInfo RayGetDirectionMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayGetDirection",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayGetDirection"
})
#endif
foreign import ccall "graphene_ray_get_distance_to_plane" graphene_ray_get_distance_to_plane ::
Ptr Ray ->
Ptr Graphene.Plane.Plane ->
IO CFloat
rayGetDistanceToPlane ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Plane.Plane
-> m Float
rayGetDistanceToPlane :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Plane -> m Float
rayGetDistanceToPlane Ray
r 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
CFloat
result <- Ptr Ray -> Ptr Plane -> IO CFloat
graphene_ray_get_distance_to_plane Ptr Ray
r' Ptr Plane
p'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
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 RayGetDistanceToPlaneMethodInfo
instance (signature ~ (Graphene.Plane.Plane -> m Float), MonadIO m) => O.OverloadedMethod RayGetDistanceToPlaneMethodInfo Ray signature where
overloadedMethod = rayGetDistanceToPlane
instance O.OverloadedMethodInfo RayGetDistanceToPlaneMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayGetDistanceToPlane",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayGetDistanceToPlane"
})
#endif
foreign import ccall "graphene_ray_get_distance_to_point" graphene_ray_get_distance_to_point ::
Ptr Ray ->
Ptr Graphene.Point3D.Point3D ->
IO CFloat
rayGetDistanceToPoint ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Point3D.Point3D
-> m Float
rayGetDistanceToPoint :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Point3D -> m Float
rayGetDistanceToPoint Ray
r Point3D
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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Point3D
p' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
p
CFloat
result <- Ptr Ray -> Ptr Point3D -> IO CFloat
graphene_ray_get_distance_to_point Ptr Ray
r' Ptr Point3D
p'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
p
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data RayGetDistanceToPointMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Float), MonadIO m) => O.OverloadedMethod RayGetDistanceToPointMethodInfo Ray signature where
overloadedMethod = rayGetDistanceToPoint
instance O.OverloadedMethodInfo RayGetDistanceToPointMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayGetDistanceToPoint",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayGetDistanceToPoint"
})
#endif
foreign import ccall "graphene_ray_get_origin" graphene_ray_get_origin ::
Ptr Ray ->
Ptr Graphene.Point3D.Point3D ->
IO ()
rayGetOrigin ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> m (Graphene.Point3D.Point3D)
rayGetOrigin :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ray -> m Point3D
rayGetOrigin Ray
r = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Point3D
origin <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
Ptr Ray -> Ptr Point3D -> IO ()
graphene_ray_get_origin Ptr Ray
r' Ptr Point3D
origin
Point3D
origin' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
origin
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
origin'
#if defined(ENABLE_OVERLOADING)
data RayGetOriginMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod RayGetOriginMethodInfo Ray signature where
overloadedMethod = rayGetOrigin
instance O.OverloadedMethodInfo RayGetOriginMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayGetOrigin",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayGetOrigin"
})
#endif
foreign import ccall "graphene_ray_get_position_at" graphene_ray_get_position_at ::
Ptr Ray ->
CFloat ->
Ptr Graphene.Point3D.Point3D ->
IO ()
rayGetPositionAt ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Float
-> m (Graphene.Point3D.Point3D)
rayGetPositionAt :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Float -> m Point3D
rayGetPositionAt Ray
r Float
t = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
let t' :: CFloat
t' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
t
Ptr Point3D
position <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
Ptr Ray -> CFloat -> Ptr Point3D -> IO ()
graphene_ray_get_position_at Ptr Ray
r' CFloat
t' Ptr Point3D
position
Point3D
position' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
position
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
position'
#if defined(ENABLE_OVERLOADING)
data RayGetPositionAtMethodInfo
instance (signature ~ (Float -> m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod RayGetPositionAtMethodInfo Ray signature where
overloadedMethod = rayGetPositionAt
instance O.OverloadedMethodInfo RayGetPositionAtMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayGetPositionAt",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayGetPositionAt"
})
#endif
foreign import ccall "graphene_ray_init" graphene_ray_init ::
Ptr Ray ->
Ptr Graphene.Point3D.Point3D ->
Ptr Graphene.Vec3.Vec3 ->
IO (Ptr Ray)
rayInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Maybe (Graphene.Point3D.Point3D)
-> Maybe (Graphene.Vec3.Vec3)
-> m Ray
rayInit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Maybe Point3D -> Maybe Vec3 -> m Ray
rayInit Ray
r Maybe Point3D
origin Maybe Vec3
direction = IO Ray -> m Ray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Ray -> m Ray) -> IO Ray -> m Ray
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Point3D
maybeOrigin <- case Maybe Point3D
origin of
Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
Just Point3D
jOrigin -> do
Ptr Point3D
jOrigin' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jOrigin
Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jOrigin'
Ptr Vec3
maybeDirection <- case Maybe Vec3
direction of
Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
Just Vec3
jDirection -> do
Ptr Vec3
jDirection' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jDirection
Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jDirection'
Ptr Ray
result <- Ptr Ray -> Ptr Point3D -> Ptr Vec3 -> IO (Ptr Ray)
graphene_ray_init Ptr Ray
r' Ptr Point3D
maybeOrigin Ptr Vec3
maybeDirection
Text -> Ptr Ray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rayInit" Ptr Ray
result
Ray
result' <- ((ManagedPtr Ray -> Ray) -> Ptr Ray -> IO Ray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Ray -> Ray
Ray) Ptr Ray
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
origin Point3D -> 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
direction Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ray -> IO Ray
forall (m :: * -> *) a. Monad m => a -> m a
return Ray
result'
#if defined(ENABLE_OVERLOADING)
data RayInitMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> Maybe (Graphene.Vec3.Vec3) -> m Ray), MonadIO m) => O.OverloadedMethod RayInitMethodInfo Ray signature where
overloadedMethod = rayInit
instance O.OverloadedMethodInfo RayInitMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayInit",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayInit"
})
#endif
foreign import ccall "graphene_ray_init_from_ray" graphene_ray_init_from_ray ::
Ptr Ray ->
Ptr Ray ->
IO (Ptr Ray)
rayInitFromRay ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Ray
-> m Ray
rayInitFromRay :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Ray -> m Ray
rayInitFromRay Ray
r Ray
src = IO Ray -> m Ray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Ray -> m Ray) -> IO Ray -> m Ray
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Ray
src' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
src
Ptr Ray
result <- Ptr Ray -> Ptr Ray -> IO (Ptr Ray)
graphene_ray_init_from_ray Ptr Ray
r' Ptr Ray
src'
Text -> Ptr Ray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rayInitFromRay" Ptr Ray
result
Ray
result' <- ((ManagedPtr Ray -> Ray) -> Ptr Ray -> IO Ray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Ray -> Ray
Ray) Ptr Ray
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
src
Ray -> IO Ray
forall (m :: * -> *) a. Monad m => a -> m a
return Ray
result'
#if defined(ENABLE_OVERLOADING)
data RayInitFromRayMethodInfo
instance (signature ~ (Ray -> m Ray), MonadIO m) => O.OverloadedMethod RayInitFromRayMethodInfo Ray signature where
overloadedMethod = rayInitFromRay
instance O.OverloadedMethodInfo RayInitFromRayMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayInitFromRay",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayInitFromRay"
})
#endif
foreign import ccall "graphene_ray_init_from_vec3" graphene_ray_init_from_vec3 ::
Ptr Ray ->
Ptr Graphene.Vec3.Vec3 ->
Ptr Graphene.Vec3.Vec3 ->
IO (Ptr Ray)
rayInitFromVec3 ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Maybe (Graphene.Vec3.Vec3)
-> Maybe (Graphene.Vec3.Vec3)
-> m Ray
rayInitFromVec3 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Maybe Vec3 -> Maybe Vec3 -> m Ray
rayInitFromVec3 Ray
r Maybe Vec3
origin Maybe Vec3
direction = IO Ray -> m Ray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Ray -> m Ray) -> IO Ray -> m Ray
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Vec3
maybeOrigin <- case Maybe Vec3
origin of
Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
Just Vec3
jOrigin -> do
Ptr Vec3
jOrigin' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jOrigin
Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jOrigin'
Ptr Vec3
maybeDirection <- case Maybe Vec3
direction of
Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
Just Vec3
jDirection -> do
Ptr Vec3
jDirection' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jDirection
Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jDirection'
Ptr Ray
result <- Ptr Ray -> Ptr Vec3 -> Ptr Vec3 -> IO (Ptr Ray)
graphene_ray_init_from_vec3 Ptr Ray
r' Ptr Vec3
maybeOrigin Ptr Vec3
maybeDirection
Text -> Ptr Ray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rayInitFromVec3" Ptr Ray
result
Ray
result' <- ((ManagedPtr Ray -> Ray) -> Ptr Ray -> IO Ray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Ray -> Ray
Ray) Ptr Ray
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
origin 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
direction Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ray -> IO Ray
forall (m :: * -> *) a. Monad m => a -> m a
return Ray
result'
#if defined(ENABLE_OVERLOADING)
data RayInitFromVec3MethodInfo
instance (signature ~ (Maybe (Graphene.Vec3.Vec3) -> Maybe (Graphene.Vec3.Vec3) -> m Ray), MonadIO m) => O.OverloadedMethod RayInitFromVec3MethodInfo Ray signature where
overloadedMethod = rayInitFromVec3
instance O.OverloadedMethodInfo RayInitFromVec3MethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayInitFromVec3",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayInitFromVec3"
})
#endif
foreign import ccall "graphene_ray_intersect_box" graphene_ray_intersect_box ::
Ptr Ray ->
Ptr Graphene.Box.Box ->
Ptr CFloat ->
IO CUInt
rayIntersectBox ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Box.Box
-> m ((Graphene.Enums.RayIntersectionKind, Float))
rayIntersectBox :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Box -> m (RayIntersectionKind, Float)
rayIntersectBox Ray
r Box
b = IO (RayIntersectionKind, Float) -> m (RayIntersectionKind, Float)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (RayIntersectionKind, Float) -> m (RayIntersectionKind, Float))
-> IO (RayIntersectionKind, Float)
-> m (RayIntersectionKind, Float)
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Box
b' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
b
Ptr CFloat
tOut <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
CUInt
result <- Ptr Ray -> Ptr Box -> Ptr CFloat -> IO CUInt
graphene_ray_intersect_box Ptr Ray
r' Ptr Box
b' Ptr CFloat
tOut
let result' :: RayIntersectionKind
result' = (Int -> RayIntersectionKind
forall a. Enum a => Int -> a
toEnum (Int -> RayIntersectionKind)
-> (CUInt -> Int) -> CUInt -> RayIntersectionKind
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
CFloat
tOut' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
tOut
let tOut'' :: Float
tOut'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
tOut'
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Box -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Box
b
Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
tOut
(RayIntersectionKind, Float) -> IO (RayIntersectionKind, Float)
forall (m :: * -> *) a. Monad m => a -> m a
return (RayIntersectionKind
result', Float
tOut'')
#if defined(ENABLE_OVERLOADING)
data RayIntersectBoxMethodInfo
instance (signature ~ (Graphene.Box.Box -> m ((Graphene.Enums.RayIntersectionKind, Float))), MonadIO m) => O.OverloadedMethod RayIntersectBoxMethodInfo Ray signature where
overloadedMethod = rayIntersectBox
instance O.OverloadedMethodInfo RayIntersectBoxMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayIntersectBox",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayIntersectBox"
})
#endif
foreign import ccall "graphene_ray_intersect_sphere" graphene_ray_intersect_sphere ::
Ptr Ray ->
Ptr Graphene.Sphere.Sphere ->
Ptr CFloat ->
IO CUInt
rayIntersectSphere ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Sphere.Sphere
-> m ((Graphene.Enums.RayIntersectionKind, Float))
rayIntersectSphere :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Sphere -> m (RayIntersectionKind, Float)
rayIntersectSphere Ray
r Sphere
s = IO (RayIntersectionKind, Float) -> m (RayIntersectionKind, Float)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (RayIntersectionKind, Float) -> m (RayIntersectionKind, Float))
-> IO (RayIntersectionKind, Float)
-> m (RayIntersectionKind, Float)
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Sphere
s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
Ptr CFloat
tOut <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
CUInt
result <- Ptr Ray -> Ptr Sphere -> Ptr CFloat -> IO CUInt
graphene_ray_intersect_sphere Ptr Ray
r' Ptr Sphere
s' Ptr CFloat
tOut
let result' :: RayIntersectionKind
result' = (Int -> RayIntersectionKind
forall a. Enum a => Int -> a
toEnum (Int -> RayIntersectionKind)
-> (CUInt -> Int) -> CUInt -> RayIntersectionKind
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
CFloat
tOut' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
tOut
let tOut'' :: Float
tOut'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
tOut'
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Sphere -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sphere
s
Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
tOut
(RayIntersectionKind, Float) -> IO (RayIntersectionKind, Float)
forall (m :: * -> *) a. Monad m => a -> m a
return (RayIntersectionKind
result', Float
tOut'')
#if defined(ENABLE_OVERLOADING)
data RayIntersectSphereMethodInfo
instance (signature ~ (Graphene.Sphere.Sphere -> m ((Graphene.Enums.RayIntersectionKind, Float))), MonadIO m) => O.OverloadedMethod RayIntersectSphereMethodInfo Ray signature where
overloadedMethod = rayIntersectSphere
instance O.OverloadedMethodInfo RayIntersectSphereMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayIntersectSphere",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayIntersectSphere"
})
#endif
foreign import ccall "graphene_ray_intersect_triangle" graphene_ray_intersect_triangle ::
Ptr Ray ->
Ptr Graphene.Triangle.Triangle ->
Ptr CFloat ->
IO CUInt
rayIntersectTriangle ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Triangle.Triangle
-> m ((Graphene.Enums.RayIntersectionKind, Float))
rayIntersectTriangle :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Triangle -> m (RayIntersectionKind, Float)
rayIntersectTriangle Ray
r Triangle
t = IO (RayIntersectionKind, Float) -> m (RayIntersectionKind, Float)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (RayIntersectionKind, Float) -> m (RayIntersectionKind, Float))
-> IO (RayIntersectionKind, Float)
-> m (RayIntersectionKind, Float)
forall a b. (a -> b) -> a -> b
$ do
Ptr Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
Ptr CFloat
tOut <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
CUInt
result <- Ptr Ray -> Ptr Triangle -> Ptr CFloat -> IO CUInt
graphene_ray_intersect_triangle Ptr Ray
r' Ptr Triangle
t' Ptr CFloat
tOut
let result' :: RayIntersectionKind
result' = (Int -> RayIntersectionKind
forall a. Enum a => Int -> a
toEnum (Int -> RayIntersectionKind)
-> (CUInt -> Int) -> CUInt -> RayIntersectionKind
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
CFloat
tOut' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
tOut
let tOut'' :: Float
tOut'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
tOut'
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
tOut
(RayIntersectionKind, Float) -> IO (RayIntersectionKind, Float)
forall (m :: * -> *) a. Monad m => a -> m a
return (RayIntersectionKind
result', Float
tOut'')
#if defined(ENABLE_OVERLOADING)
data RayIntersectTriangleMethodInfo
instance (signature ~ (Graphene.Triangle.Triangle -> m ((Graphene.Enums.RayIntersectionKind, Float))), MonadIO m) => O.OverloadedMethod RayIntersectTriangleMethodInfo Ray signature where
overloadedMethod = rayIntersectTriangle
instance O.OverloadedMethodInfo RayIntersectTriangleMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayIntersectTriangle",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayIntersectTriangle"
})
#endif
foreign import ccall "graphene_ray_intersects_box" graphene_ray_intersects_box ::
Ptr Ray ->
Ptr Graphene.Box.Box ->
IO CInt
rayIntersectsBox ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Box.Box
-> m Bool
rayIntersectsBox :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Box -> m Bool
rayIntersectsBox Ray
r 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Box
b' <- Box -> IO (Ptr Box)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Box
b
CInt
result <- Ptr Ray -> Ptr Box -> IO CInt
graphene_ray_intersects_box Ptr Ray
r' Ptr Box
b'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
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 RayIntersectsBoxMethodInfo
instance (signature ~ (Graphene.Box.Box -> m Bool), MonadIO m) => O.OverloadedMethod RayIntersectsBoxMethodInfo Ray signature where
overloadedMethod = rayIntersectsBox
instance O.OverloadedMethodInfo RayIntersectsBoxMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayIntersectsBox",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayIntersectsBox"
})
#endif
foreign import ccall "graphene_ray_intersects_sphere" graphene_ray_intersects_sphere ::
Ptr Ray ->
Ptr Graphene.Sphere.Sphere ->
IO CInt
rayIntersectsSphere ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Sphere.Sphere
-> m Bool
rayIntersectsSphere :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Sphere -> m Bool
rayIntersectsSphere Ray
r Sphere
s = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Sphere
s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
CInt
result <- Ptr Ray -> Ptr Sphere -> IO CInt
graphene_ray_intersects_sphere Ptr Ray
r' Ptr Sphere
s'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Sphere -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sphere
s
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data RayIntersectsSphereMethodInfo
instance (signature ~ (Graphene.Sphere.Sphere -> m Bool), MonadIO m) => O.OverloadedMethod RayIntersectsSphereMethodInfo Ray signature where
overloadedMethod = rayIntersectsSphere
instance O.OverloadedMethodInfo RayIntersectsSphereMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayIntersectsSphere",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayIntersectsSphere"
})
#endif
foreign import ccall "graphene_ray_intersects_triangle" graphene_ray_intersects_triangle ::
Ptr Ray ->
Ptr Graphene.Triangle.Triangle ->
IO CInt
rayIntersectsTriangle ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ray
-> Graphene.Triangle.Triangle
-> m Bool
rayIntersectsTriangle :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ray -> Triangle -> m Bool
rayIntersectsTriangle Ray
r Triangle
t = 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 Ray
r' <- Ray -> IO (Ptr Ray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Ray
r
Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
CInt
result <- Ptr Ray -> Ptr Triangle -> IO CInt
graphene_ray_intersects_triangle Ptr Ray
r' Ptr Triangle
t'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Ray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Ray
r
Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data RayIntersectsTriangleMethodInfo
instance (signature ~ (Graphene.Triangle.Triangle -> m Bool), MonadIO m) => O.OverloadedMethod RayIntersectsTriangleMethodInfo Ray signature where
overloadedMethod = rayIntersectsTriangle
instance O.OverloadedMethodInfo RayIntersectsTriangleMethodInfo Ray where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Ray.rayIntersectsTriangle",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Ray.html#v:rayIntersectsTriangle"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRayMethod (t :: Symbol) (o :: *) :: * where
ResolveRayMethod "equal" o = RayEqualMethodInfo
ResolveRayMethod "free" o = RayFreeMethodInfo
ResolveRayMethod "init" o = RayInitMethodInfo
ResolveRayMethod "initFromRay" o = RayInitFromRayMethodInfo
ResolveRayMethod "initFromVec3" o = RayInitFromVec3MethodInfo
ResolveRayMethod "intersectBox" o = RayIntersectBoxMethodInfo
ResolveRayMethod "intersectSphere" o = RayIntersectSphereMethodInfo
ResolveRayMethod "intersectTriangle" o = RayIntersectTriangleMethodInfo
ResolveRayMethod "intersectsBox" o = RayIntersectsBoxMethodInfo
ResolveRayMethod "intersectsSphere" o = RayIntersectsSphereMethodInfo
ResolveRayMethod "intersectsTriangle" o = RayIntersectsTriangleMethodInfo
ResolveRayMethod "getClosestPointToPoint" o = RayGetClosestPointToPointMethodInfo
ResolveRayMethod "getDirection" o = RayGetDirectionMethodInfo
ResolveRayMethod "getDistanceToPlane" o = RayGetDistanceToPlaneMethodInfo
ResolveRayMethod "getDistanceToPoint" o = RayGetDistanceToPointMethodInfo
ResolveRayMethod "getOrigin" o = RayGetOriginMethodInfo
ResolveRayMethod "getPositionAt" o = RayGetPositionAtMethodInfo
ResolveRayMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRayMethod t Ray, O.OverloadedMethod info Ray p) => OL.IsLabel t (Ray -> 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 ~ ResolveRayMethod t Ray, O.OverloadedMethod info Ray p, R.HasField t Ray p) => R.HasField t Ray p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveRayMethod t Ray, O.OverloadedMethodInfo info Ray) => OL.IsLabel t (O.MethodProxy info Ray) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif