{-# language CPP #-}
-- | = Name
--
-- XR_MSFT_hand_tracking_mesh - instance extension
--
-- = Specification
--
-- See
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_MSFT_hand_tracking_mesh  XR_MSFT_hand_tracking_mesh>
-- in the main specification for complete information.
--
-- = Registered Extension Number
--
-- 53
--
-- = Revision
--
-- 2
--
-- = Extension and Version Dependencies
--
-- -   Requires OpenXR 1.0
--
-- -   Requires @@
--
-- = See Also
--
-- 'HandMeshIndexBufferMSFT', 'HandMeshMSFT',
-- 'HandMeshSpaceCreateInfoMSFT', 'HandMeshUpdateInfoMSFT',
-- 'HandMeshVertexBufferMSFT', 'HandMeshVertexMSFT',
-- 'HandPoseTypeInfoMSFT', 'HandPoseTypeMSFT',
-- 'SystemHandTrackingMeshPropertiesMSFT', 'createHandMeshSpaceMSFT',
-- 'updateHandMeshMSFT'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_MSFT_hand_tracking_mesh OpenXR Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module OpenXR.Extensions.XR_MSFT_hand_tracking_mesh  ( createHandMeshSpaceMSFT
                                                     , withHandMeshSpaceMSFT
                                                     , updateHandMeshMSFT
                                                     , HandMeshSpaceCreateInfoMSFT(..)
                                                     , HandMeshUpdateInfoMSFT(..)
                                                     , HandMeshMSFT(..)
                                                     , HandMeshIndexBufferMSFT(..)
                                                     , HandMeshVertexBufferMSFT(..)
                                                     , HandMeshVertexMSFT(..)
                                                     , SystemHandTrackingMeshPropertiesMSFT(..)
                                                     , HandPoseTypeInfoMSFT(..)
                                                     , HandPoseTypeMSFT( HAND_POSE_TYPE_TRACKED_MSFT
                                                                       , HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT
                                                                       , ..
                                                                       )
                                                     , MSFT_hand_tracking_mesh_SPEC_VERSION
                                                     , pattern MSFT_hand_tracking_mesh_SPEC_VERSION
                                                     , MSFT_HAND_TRACKING_MESH_EXTENSION_NAME
                                                     , pattern MSFT_HAND_TRACKING_MESH_EXTENSION_NAME
                                                     , HandTrackerEXT(..)
                                                     ) where

import OpenXR.Internal.Utils (enumReadPrec)
import OpenXR.Internal.Utils (enumShowsPrec)
import OpenXR.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import OpenXR.CStruct (FromCStruct)
import OpenXR.CStruct (FromCStruct(..))
import OpenXR.CStruct (ToCStruct)
import OpenXR.CStruct (ToCStruct(..))
import OpenXR.Zero (Zero)
import OpenXR.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import OpenXR.Core10.FundamentalTypes (bool32ToBool)
import OpenXR.Core10.FundamentalTypes (boolToBool32)
import OpenXR.Core10.Space (destroySpace)
import OpenXR.Core10.FundamentalTypes (Bool32)
import OpenXR.Extensions.Handles (HandTrackerEXT)
import OpenXR.Extensions.Handles (HandTrackerEXT(..))
import OpenXR.Extensions.Handles (HandTrackerEXT_T)
import OpenXR.Dynamic (InstanceCmds(pXrCreateHandMeshSpaceMSFT))
import OpenXR.Dynamic (InstanceCmds(pXrUpdateHandMeshMSFT))
import OpenXR.Exception (OpenXrException(..))
import OpenXR.Core10.Space (Posef)
import OpenXR.Core10.Enums.Result (Result)
import OpenXR.Core10.Enums.Result (Result(..))
import OpenXR.Core10.Handles (Space)
import OpenXR.Core10.Handles (Space(Space))
import OpenXR.Core10.Handles (Space_T)
import OpenXR.Core10.Enums.StructureType (StructureType)
import OpenXR.Core10.FundamentalTypes (Time)
import OpenXR.Core10.Space (Vector3f)
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_HAND_MESH_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_HAND_MESH_UPDATE_INFO_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_HAND_POSE_TYPE_INFO_MSFT))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT))
import OpenXR.Extensions.Handles (HandTrackerEXT(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrCreateHandMeshSpaceMSFT
  :: FunPtr (Ptr HandTrackerEXT_T -> Ptr HandMeshSpaceCreateInfoMSFT -> Ptr (Ptr Space_T) -> IO Result) -> Ptr HandTrackerEXT_T -> Ptr HandMeshSpaceCreateInfoMSFT -> Ptr (Ptr Space_T) -> IO Result

-- | xrCreateHandMeshSpaceMSFT - Create a space for hand mesh tracking
--
-- == Parameter Descriptions
--
-- = Description
--
-- A hand mesh space location is specified by runtime preference to
-- effectively represent hand mesh vertices without unnecessary
-- transformations. For example, an optical hand tracking system /can/
-- define the hand mesh space origin at the depth camera’s optical center.
--
-- An application should create separate hand mesh space handles for each
-- hand to retrieve the corresponding hand mesh data. The runtime /may/ use
-- the lifetime of this hand mesh space handle to manage the underlying
-- device resources. Therefore, the application /should/ destroy the hand
-- mesh handle after it is finished using the hand mesh.
--
-- The hand mesh space can be related to other spaces in the session, such
-- as view reference space, or grip action space from the
-- \/interaction_profiles\/khr\/simple_controller interaction profile. The
-- hand mesh space may be not locatable when the hand is outside of the
-- tracking range, or if focus is removed from the application. In these
-- cases, the runtime /must/ not set the
-- @XR_SPACE_LOCATION_POSITION_VALID_BIT@ and
-- @XR_SPACE_LOCATION_ORIENTATION_VALID_BIT@ bits on calls to
-- 'OpenXR.Core10.Space.locateSpace' with the hand mesh space, and the
-- application /should/ avoid using the returned poses or query for hand
-- mesh data.
--
-- If the underlying 'OpenXR.Extensions.Handles.HandTrackerEXT' is
-- destroyed, the runtime /must/ continue to support
-- 'OpenXR.Core10.Space.locateSpace' using the hand mesh space, and it
-- /must/ return space location with @XR_SPACE_LOCATION_POSITION_VALID_BIT@
-- and @XR_SPACE_LOCATION_ORIENTATION_VALID_BIT@ unset.
--
-- The application /may/ create a mesh space for the reference hand by
-- setting @handPoseType@ to 'HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT'.
-- Hand mesh spaces for the reference hand /must/ only be locatable in
-- reference to mesh spaces or joint spaces of the reference hand.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrCreateHandMeshSpaceMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to calling
--     'createHandMeshSpaceMSFT'
--
-- -   #VUID-xrCreateHandMeshSpaceMSFT-handTracker-parameter# @handTracker@
--     /must/ be a valid 'OpenXR.Extensions.Handles.HandTrackerEXT' handle
--
-- -   #VUID-xrCreateHandMeshSpaceMSFT-createInfo-parameter# @createInfo@
--     /must/ be a pointer to a valid 'HandMeshSpaceCreateInfoMSFT'
--     structure
--
-- -   #VUID-xrCreateHandMeshSpaceMSFT-space-parameter# @space@ /must/ be a
--     pointer to an 'OpenXR.Core10.Handles.Space' handle
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_POSE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FEATURE_UNSUPPORTED'
--
-- = See Also
--
-- 'HandMeshSpaceCreateInfoMSFT',
-- 'OpenXR.Extensions.Handles.HandTrackerEXT',
-- 'OpenXR.Core10.Handles.Space'
createHandMeshSpaceMSFT :: forall io
                         . (MonadIO io)
                        => -- | @handTracker@ is an 'OpenXR.Extensions.Handles.HandTrackerEXT' handle
                           -- previously created with the
                           -- 'OpenXR.Extensions.XR_EXT_hand_tracking.createHandTrackerEXT' function.
                           HandTrackerEXT
                        -> -- | @createInfo@ is the 'HandMeshSpaceCreateInfoMSFT' used to specify the
                           -- hand mesh space.
                           HandMeshSpaceCreateInfoMSFT
                        -> io (Result, Space)
createHandMeshSpaceMSFT :: HandTrackerEXT -> HandMeshSpaceCreateInfoMSFT -> io (Result, Space)
createHandMeshSpaceMSFT handTracker :: HandTrackerEXT
handTracker createInfo :: HandMeshSpaceCreateInfoMSFT
createInfo = IO (Result, Space) -> io (Result, Space)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, Space) -> io (Result, Space))
-> (ContT (Result, Space) IO (Result, Space) -> IO (Result, Space))
-> ContT (Result, Space) IO (Result, Space)
-> io (Result, Space)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT (Result, Space) IO (Result, Space) -> IO (Result, Space)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT (Result, Space) IO (Result, Space) -> io (Result, Space))
-> ContT (Result, Space) IO (Result, Space) -> io (Result, Space)
forall a b. (a -> b) -> a -> b
$ do
  let cmds :: InstanceCmds
cmds = HandTrackerEXT -> InstanceCmds
instanceCmds (HandTrackerEXT
handTracker :: HandTrackerEXT)
  let xrCreateHandMeshSpaceMSFTPtr :: FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshSpaceCreateInfoMSFT
   -> ("space" ::: Ptr (Ptr Space_T))
   -> IO Result)
xrCreateHandMeshSpaceMSFTPtr = InstanceCmds
-> FunPtr
     (Ptr HandTrackerEXT_T
      -> Ptr HandMeshSpaceCreateInfoMSFT
      -> ("space" ::: Ptr (Ptr Space_T))
      -> IO Result)
pXrCreateHandMeshSpaceMSFT InstanceCmds
cmds
  IO () -> ContT (Result, Space) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, Space) IO ())
-> IO () -> ContT (Result, Space) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshSpaceCreateInfoMSFT
   -> ("space" ::: Ptr (Ptr Space_T))
   -> IO Result)
xrCreateHandMeshSpaceMSFTPtr FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshSpaceCreateInfoMSFT
   -> ("space" ::: Ptr (Ptr Space_T))
   -> IO Result)
-> FunPtr
     (Ptr HandTrackerEXT_T
      -> Ptr HandMeshSpaceCreateInfoMSFT
      -> ("space" ::: Ptr (Ptr Space_T))
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshSpaceCreateInfoMSFT
   -> ("space" ::: Ptr (Ptr Space_T))
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for xrCreateHandMeshSpaceMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrCreateHandMeshSpaceMSFT' :: Ptr HandTrackerEXT_T
-> Ptr HandMeshSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result
xrCreateHandMeshSpaceMSFT' = FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshSpaceCreateInfoMSFT
   -> ("space" ::: Ptr (Ptr Space_T))
   -> IO Result)
-> Ptr HandTrackerEXT_T
-> Ptr HandMeshSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result
mkXrCreateHandMeshSpaceMSFT FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshSpaceCreateInfoMSFT
   -> ("space" ::: Ptr (Ptr Space_T))
   -> IO Result)
xrCreateHandMeshSpaceMSFTPtr
  Ptr HandMeshSpaceCreateInfoMSFT
createInfo' <- ((Ptr HandMeshSpaceCreateInfoMSFT -> IO (Result, Space))
 -> IO (Result, Space))
-> ContT (Result, Space) IO (Ptr HandMeshSpaceCreateInfoMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr HandMeshSpaceCreateInfoMSFT -> IO (Result, Space))
  -> IO (Result, Space))
 -> ContT (Result, Space) IO (Ptr HandMeshSpaceCreateInfoMSFT))
-> ((Ptr HandMeshSpaceCreateInfoMSFT -> IO (Result, Space))
    -> IO (Result, Space))
-> ContT (Result, Space) IO (Ptr HandMeshSpaceCreateInfoMSFT)
forall a b. (a -> b) -> a -> b
$ HandMeshSpaceCreateInfoMSFT
-> (Ptr HandMeshSpaceCreateInfoMSFT -> IO (Result, Space))
-> IO (Result, Space)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (HandMeshSpaceCreateInfoMSFT
createInfo)
  "space" ::: Ptr (Ptr Space_T)
pSpace <- ((("space" ::: Ptr (Ptr Space_T)) -> IO (Result, Space))
 -> IO (Result, Space))
-> ContT (Result, Space) IO ("space" ::: Ptr (Ptr Space_T))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("space" ::: Ptr (Ptr Space_T)) -> IO (Result, Space))
  -> IO (Result, Space))
 -> ContT (Result, Space) IO ("space" ::: Ptr (Ptr Space_T)))
-> ((("space" ::: Ptr (Ptr Space_T)) -> IO (Result, Space))
    -> IO (Result, Space))
-> ContT (Result, Space) IO ("space" ::: Ptr (Ptr Space_T))
forall a b. (a -> b) -> a -> b
$ IO ("space" ::: Ptr (Ptr Space_T))
-> (("space" ::: Ptr (Ptr Space_T)) -> IO ())
-> (("space" ::: Ptr (Ptr Space_T)) -> IO (Result, Space))
-> IO (Result, Space)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("space" ::: Ptr (Ptr Space_T))
forall a. Int -> IO (Ptr a)
callocBytes @(Ptr Space_T) 8) ("space" ::: Ptr (Ptr Space_T)) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result -> ContT (Result, Space) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT (Result, Space) IO Result)
-> IO Result -> ContT (Result, Space) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrCreateHandMeshSpaceMSFT" (Ptr HandTrackerEXT_T
-> Ptr HandMeshSpaceCreateInfoMSFT
-> ("space" ::: Ptr (Ptr Space_T))
-> IO Result
xrCreateHandMeshSpaceMSFT' (HandTrackerEXT -> Ptr HandTrackerEXT_T
handTrackerEXTHandle (HandTrackerEXT
handTracker)) Ptr HandMeshSpaceCreateInfoMSFT
createInfo' ("space" ::: Ptr (Ptr Space_T)
pSpace))
  IO () -> ContT (Result, Space) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, Space) IO ())
-> IO () -> ContT (Result, Space) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
  Ptr Space_T
space <- IO (Ptr Space_T) -> ContT (Result, Space) IO (Ptr Space_T)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (Ptr Space_T) -> ContT (Result, Space) IO (Ptr Space_T))
-> IO (Ptr Space_T) -> ContT (Result, Space) IO (Ptr Space_T)
forall a b. (a -> b) -> a -> b
$ ("space" ::: Ptr (Ptr Space_T)) -> IO (Ptr Space_T)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Space_T) "space" ::: Ptr (Ptr Space_T)
pSpace
  (Result, Space) -> ContT (Result, Space) IO (Result, Space)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, Space) -> ContT (Result, Space) IO (Result, Space))
-> (Result, Space) -> ContT (Result, Space) IO (Result, Space)
forall a b. (a -> b) -> a -> b
$ (Result
r, ((\h :: Ptr Space_T
h -> Ptr Space_T -> InstanceCmds -> Space
Space Ptr Space_T
h InstanceCmds
cmds ) Ptr Space_T
space))

-- | A convenience wrapper to make a compatible pair of calls to
-- 'createHandMeshSpaceMSFT' and 'destroySpace'
--
-- To ensure that 'destroySpace' is always called: pass
-- 'Control.Exception.bracket' (or the allocate function from your
-- favourite resource management library) as the last argument.
-- To just extract the pair pass '(,)' as the last argument.
--
withHandMeshSpaceMSFT :: forall io r . MonadIO io => HandTrackerEXT -> HandMeshSpaceCreateInfoMSFT -> (io (Result, Space) -> ((Result, Space) -> io ()) -> r) -> r
withHandMeshSpaceMSFT :: HandTrackerEXT
-> HandMeshSpaceCreateInfoMSFT
-> (io (Result, Space) -> ((Result, Space) -> io ()) -> r)
-> r
withHandMeshSpaceMSFT handTracker :: HandTrackerEXT
handTracker createInfo :: HandMeshSpaceCreateInfoMSFT
createInfo b :: io (Result, Space) -> ((Result, Space) -> io ()) -> r
b =
  io (Result, Space) -> ((Result, Space) -> io ()) -> r
b (HandTrackerEXT -> HandMeshSpaceCreateInfoMSFT -> io (Result, Space)
forall (io :: * -> *).
MonadIO io =>
HandTrackerEXT -> HandMeshSpaceCreateInfoMSFT -> io (Result, Space)
createHandMeshSpaceMSFT HandTrackerEXT
handTracker HandMeshSpaceCreateInfoMSFT
createInfo)
    (\(_, o1 :: Space
o1) -> Space -> io ()
forall (io :: * -> *). MonadIO io => Space -> io ()
destroySpace Space
o1)


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrUpdateHandMeshMSFT
  :: FunPtr (Ptr HandTrackerEXT_T -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result) -> Ptr HandTrackerEXT_T -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result

-- | xrUpdateHandMeshMSFT - Update hand mesh buffers
--
-- == Parameter Descriptions
--
-- = Description
--
-- The application /should/ preallocate the index buffer and vertex buffer
-- in 'HandMeshMSFT' using the @maxHandMeshIndexCount@ and
-- @maxHandMeshVertexCount@ from the 'SystemHandTrackingMeshPropertiesMSFT'
-- returned from the 'OpenXR.Core10.Device.getSystemProperties' function.
--
-- The application /should/ preallocate the 'HandMeshMSFT' structure and
-- reuse it for each frame so as to reduce the copies of data when
-- underlying tracking data is not changed. The application should use
-- @indexBufferChanged@ and @vertexBufferChanged@ in 'HandMeshMSFT' to
-- detect changes and avoid unnecessary data processing when there is no
-- changes.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrUpdateHandMeshMSFT-extension-notenabled# The @@ extension
--     /must/ be enabled prior to calling 'updateHandMeshMSFT'
--
-- -   #VUID-xrUpdateHandMeshMSFT-handTracker-parameter# @handTracker@
--     /must/ be a valid 'OpenXR.Extensions.Handles.HandTrackerEXT' handle
--
-- -   #VUID-xrUpdateHandMeshMSFT-updateInfo-parameter# @updateInfo@ /must/
--     be a pointer to a valid 'HandMeshUpdateInfoMSFT' structure
--
-- -   #VUID-xrUpdateHandMeshMSFT-handMesh-parameter# @handMesh@ /must/ be
--     a pointer to an 'HandMeshMSFT' structure
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_TIME_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FEATURE_UNSUPPORTED'
--
-- = See Also
--
-- 'HandMeshMSFT', 'HandMeshUpdateInfoMSFT',
-- 'OpenXR.Extensions.Handles.HandTrackerEXT'
updateHandMeshMSFT :: forall io
                    . (MonadIO io)
                   => -- | @handTracker@ is an 'OpenXR.Extensions.Handles.HandTrackerEXT' handle
                      -- previously created with
                      -- 'OpenXR.Extensions.XR_EXT_hand_tracking.createHandTrackerEXT'.
                      HandTrackerEXT
                   -> -- | @updateInfo@ is a 'HandMeshUpdateInfoMSFT' which contains information to
                      -- query the hand mesh.
                      HandMeshUpdateInfoMSFT
                   -> io (Result, HandMeshMSFT)
updateHandMeshMSFT :: HandTrackerEXT
-> HandMeshUpdateInfoMSFT -> io (Result, HandMeshMSFT)
updateHandMeshMSFT handTracker :: HandTrackerEXT
handTracker updateInfo :: HandMeshUpdateInfoMSFT
updateInfo = IO (Result, HandMeshMSFT) -> io (Result, HandMeshMSFT)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, HandMeshMSFT) -> io (Result, HandMeshMSFT))
-> (ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
    -> IO (Result, HandMeshMSFT))
-> ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
-> io (Result, HandMeshMSFT)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
-> IO (Result, HandMeshMSFT)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
 -> io (Result, HandMeshMSFT))
-> ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
-> io (Result, HandMeshMSFT)
forall a b. (a -> b) -> a -> b
$ do
  let xrUpdateHandMeshMSFTPtr :: FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
xrUpdateHandMeshMSFTPtr = InstanceCmds
-> FunPtr
     (Ptr HandTrackerEXT_T
      -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
pXrUpdateHandMeshMSFT (HandTrackerEXT -> InstanceCmds
instanceCmds (HandTrackerEXT
handTracker :: HandTrackerEXT))
  IO () -> ContT (Result, HandMeshMSFT) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, HandMeshMSFT) IO ())
-> IO () -> ContT (Result, HandMeshMSFT) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
xrUpdateHandMeshMSFTPtr FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
-> FunPtr
     (Ptr HandTrackerEXT_T
      -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for xrUpdateHandMeshMSFT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrUpdateHandMeshMSFT' :: Ptr HandTrackerEXT_T
-> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result
xrUpdateHandMeshMSFT' = FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
-> Ptr HandTrackerEXT_T
-> Ptr HandMeshUpdateInfoMSFT
-> Ptr HandMeshMSFT
-> IO Result
mkXrUpdateHandMeshMSFT FunPtr
  (Ptr HandTrackerEXT_T
   -> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result)
xrUpdateHandMeshMSFTPtr
  Ptr HandMeshUpdateInfoMSFT
updateInfo' <- ((Ptr HandMeshUpdateInfoMSFT -> IO (Result, HandMeshMSFT))
 -> IO (Result, HandMeshMSFT))
-> ContT (Result, HandMeshMSFT) IO (Ptr HandMeshUpdateInfoMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr HandMeshUpdateInfoMSFT -> IO (Result, HandMeshMSFT))
  -> IO (Result, HandMeshMSFT))
 -> ContT (Result, HandMeshMSFT) IO (Ptr HandMeshUpdateInfoMSFT))
-> ((Ptr HandMeshUpdateInfoMSFT -> IO (Result, HandMeshMSFT))
    -> IO (Result, HandMeshMSFT))
-> ContT (Result, HandMeshMSFT) IO (Ptr HandMeshUpdateInfoMSFT)
forall a b. (a -> b) -> a -> b
$ HandMeshUpdateInfoMSFT
-> (Ptr HandMeshUpdateInfoMSFT -> IO (Result, HandMeshMSFT))
-> IO (Result, HandMeshMSFT)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (HandMeshUpdateInfoMSFT
updateInfo)
  Ptr HandMeshMSFT
pHandMesh <- ((Ptr HandMeshMSFT -> IO (Result, HandMeshMSFT))
 -> IO (Result, HandMeshMSFT))
-> ContT (Result, HandMeshMSFT) IO (Ptr HandMeshMSFT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct HandMeshMSFT =>
(Ptr HandMeshMSFT -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @HandMeshMSFT)
  Result
r <- IO Result -> ContT (Result, HandMeshMSFT) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT (Result, HandMeshMSFT) IO Result)
-> IO Result -> ContT (Result, HandMeshMSFT) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrUpdateHandMeshMSFT" (Ptr HandTrackerEXT_T
-> Ptr HandMeshUpdateInfoMSFT -> Ptr HandMeshMSFT -> IO Result
xrUpdateHandMeshMSFT' (HandTrackerEXT -> Ptr HandTrackerEXT_T
handTrackerEXTHandle (HandTrackerEXT
handTracker)) Ptr HandMeshUpdateInfoMSFT
updateInfo' (Ptr HandMeshMSFT
pHandMesh))
  IO () -> ContT (Result, HandMeshMSFT) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Result, HandMeshMSFT) IO ())
-> IO () -> ContT (Result, HandMeshMSFT) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
  HandMeshMSFT
handMesh <- IO HandMeshMSFT -> ContT (Result, HandMeshMSFT) IO HandMeshMSFT
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO HandMeshMSFT -> ContT (Result, HandMeshMSFT) IO HandMeshMSFT)
-> IO HandMeshMSFT -> ContT (Result, HandMeshMSFT) IO HandMeshMSFT
forall a b. (a -> b) -> a -> b
$ Ptr HandMeshMSFT -> IO HandMeshMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @HandMeshMSFT Ptr HandMeshMSFT
pHandMesh
  (Result, HandMeshMSFT)
-> ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, HandMeshMSFT)
 -> ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT))
-> (Result, HandMeshMSFT)
-> ContT (Result, HandMeshMSFT) IO (Result, HandMeshMSFT)
forall a b. (a -> b) -> a -> b
$ (Result
r, HandMeshMSFT
handMesh)


-- | XrHandMeshSpaceCreateInfoMSFT - The information to create a hand mesh
-- space
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandMeshSpaceCreateInfoMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'HandMeshSpaceCreateInfoMSFT'
--
-- -   #VUID-XrHandMeshSpaceCreateInfoMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT'
--
-- -   #VUID-XrHandMeshSpaceCreateInfoMSFT-next-next# @next@ /must/ be
--     @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrHandMeshSpaceCreateInfoMSFT-handPoseType-parameter#
--     @handPoseType@ /must/ be a valid 'HandPoseTypeMSFT' value
--
-- = See Also
--
-- 'HandPoseTypeMSFT', 'OpenXR.Core10.Space.Posef',
-- 'OpenXR.Core10.Enums.StructureType.StructureType',
-- 'createHandMeshSpaceMSFT'
data HandMeshSpaceCreateInfoMSFT = HandMeshSpaceCreateInfoMSFT
  { -- | @handPoseType@ is an 'HandPoseTypeMSFT' used to specify the type of hand
    -- this mesh is tracking. Indices and vertices returned from
    -- 'updateHandMeshMSFT' for a hand type will be relative to the
    -- corresponding space create with the same hand type.
    HandMeshSpaceCreateInfoMSFT -> HandPoseTypeMSFT
handPoseType :: HandPoseTypeMSFT
  , -- | @poseInHandMeshSpace@ is an 'OpenXR.Core10.Space.Posef' defining the
    -- position and orientation of the new space’s origin within the natural
    -- reference frame of the hand mesh space.
    HandMeshSpaceCreateInfoMSFT -> Posef
poseInHandMeshSpace :: Posef
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandMeshSpaceCreateInfoMSFT)
#endif
deriving instance Show HandMeshSpaceCreateInfoMSFT

instance ToCStruct HandMeshSpaceCreateInfoMSFT where
  withCStruct :: HandMeshSpaceCreateInfoMSFT
-> (Ptr HandMeshSpaceCreateInfoMSFT -> IO b) -> IO b
withCStruct x :: HandMeshSpaceCreateInfoMSFT
x f :: Ptr HandMeshSpaceCreateInfoMSFT -> IO b
f = Int -> Int -> (Ptr HandMeshSpaceCreateInfoMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr HandMeshSpaceCreateInfoMSFT -> IO b) -> IO b)
-> (Ptr HandMeshSpaceCreateInfoMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandMeshSpaceCreateInfoMSFT
p -> Ptr HandMeshSpaceCreateInfoMSFT
-> HandMeshSpaceCreateInfoMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshSpaceCreateInfoMSFT
p HandMeshSpaceCreateInfoMSFT
x (Ptr HandMeshSpaceCreateInfoMSFT -> IO b
f Ptr HandMeshSpaceCreateInfoMSFT
p)
  pokeCStruct :: Ptr HandMeshSpaceCreateInfoMSFT
-> HandMeshSpaceCreateInfoMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandMeshSpaceCreateInfoMSFT
p HandMeshSpaceCreateInfoMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr HandPoseTypeMSFT)) (HandPoseTypeMSFT
handPoseType)
    Ptr Posef -> Posef -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Posef)) (Posef
poseInHandMeshSpace)
    IO b
f
  cStructSize :: Int
cStructSize = 48
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr HandMeshSpaceCreateInfoMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandMeshSpaceCreateInfoMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr HandPoseTypeMSFT)) (HandPoseTypeMSFT
forall a. Zero a => a
zero)
    Ptr Posef -> Posef -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Posef)) (Posef
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandMeshSpaceCreateInfoMSFT where
  peekCStruct :: Ptr HandMeshSpaceCreateInfoMSFT -> IO HandMeshSpaceCreateInfoMSFT
peekCStruct p :: Ptr HandMeshSpaceCreateInfoMSFT
p = do
    HandPoseTypeMSFT
handPoseType <- Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT
forall a. Storable a => Ptr a -> IO a
peek @HandPoseTypeMSFT ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr HandPoseTypeMSFT))
    Posef
poseInHandMeshSpace <- Ptr Posef -> IO Posef
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Posef ((Ptr HandMeshSpaceCreateInfoMSFT
p Ptr HandMeshSpaceCreateInfoMSFT -> Int -> Ptr Posef
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Posef))
    HandMeshSpaceCreateInfoMSFT -> IO HandMeshSpaceCreateInfoMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandMeshSpaceCreateInfoMSFT -> IO HandMeshSpaceCreateInfoMSFT)
-> HandMeshSpaceCreateInfoMSFT -> IO HandMeshSpaceCreateInfoMSFT
forall a b. (a -> b) -> a -> b
$ HandPoseTypeMSFT -> Posef -> HandMeshSpaceCreateInfoMSFT
HandMeshSpaceCreateInfoMSFT
             HandPoseTypeMSFT
handPoseType Posef
poseInHandMeshSpace

instance Storable HandMeshSpaceCreateInfoMSFT where
  sizeOf :: HandMeshSpaceCreateInfoMSFT -> Int
sizeOf ~HandMeshSpaceCreateInfoMSFT
_ = 48
  alignment :: HandMeshSpaceCreateInfoMSFT -> Int
alignment ~HandMeshSpaceCreateInfoMSFT
_ = 8
  peek :: Ptr HandMeshSpaceCreateInfoMSFT -> IO HandMeshSpaceCreateInfoMSFT
peek = Ptr HandMeshSpaceCreateInfoMSFT -> IO HandMeshSpaceCreateInfoMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandMeshSpaceCreateInfoMSFT
-> HandMeshSpaceCreateInfoMSFT -> IO ()
poke ptr :: Ptr HandMeshSpaceCreateInfoMSFT
ptr poked :: HandMeshSpaceCreateInfoMSFT
poked = Ptr HandMeshSpaceCreateInfoMSFT
-> HandMeshSpaceCreateInfoMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshSpaceCreateInfoMSFT
ptr HandMeshSpaceCreateInfoMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandMeshSpaceCreateInfoMSFT where
  zero :: HandMeshSpaceCreateInfoMSFT
zero = HandPoseTypeMSFT -> Posef -> HandMeshSpaceCreateInfoMSFT
HandMeshSpaceCreateInfoMSFT
           HandPoseTypeMSFT
forall a. Zero a => a
zero
           Posef
forall a. Zero a => a
zero


-- | XrHandMeshUpdateInfoMSFT - The information to update a hand mesh
--
-- == Member Descriptions
--
-- = Description
--
-- A runtime /may/ not maintain a full history of hand mesh data, therefore
-- the returned 'HandMeshMSFT' might return data that’s not exactly
-- corresponding to the @time@ input. If the runtime cannot return any
-- tracking data for the given @time@ at all, it /must/ set @isActive@ to
-- 'OpenXR.Core10.FundamentalTypes.FALSE' for the call to
-- 'updateHandMeshMSFT'. Otherwise, if the runtime returns @isActive@ as
-- 'OpenXR.Core10.FundamentalTypes.TRUE', the data in 'HandMeshMSFT' must
-- be valid to use.
--
-- An application can choose different @handPoseType@ values to query the
-- hand mesh data. The returned hand mesh /must/ be consistent to the hand
-- joint space location on the same
-- 'OpenXR.Extensions.Handles.HandTrackerEXT' when using the same
-- 'HandPoseTypeMSFT'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandMeshUpdateInfoMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using 'HandMeshUpdateInfoMSFT'
--
-- -   #VUID-XrHandMeshUpdateInfoMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_HAND_MESH_UPDATE_INFO_MSFT'
--
-- -   #VUID-XrHandMeshUpdateInfoMSFT-next-next# @next@ /must/ be @NULL@ or
--     a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrHandMeshUpdateInfoMSFT-handPoseType-parameter#
--     @handPoseType@ /must/ be a valid 'HandPoseTypeMSFT' value
--
-- = See Also
--
-- 'HandPoseTypeMSFT', 'OpenXR.Core10.Enums.StructureType.StructureType',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime >,
-- 'updateHandMeshMSFT'
data HandMeshUpdateInfoMSFT = HandMeshUpdateInfoMSFT
  { -- | @time@ is the
    -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime >
    -- that describes the time for which the application wishes to query the
    -- hand mesh state.
    HandMeshUpdateInfoMSFT -> Time
time :: Time
  , -- | @handPoseType@ is an 'HandPoseTypeMSFT' which describes the type of hand
    -- pose of the hand mesh to update.
    HandMeshUpdateInfoMSFT -> HandPoseTypeMSFT
handPoseType :: HandPoseTypeMSFT
  }
  deriving (Typeable, HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool
(HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool)
-> (HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool)
-> Eq HandMeshUpdateInfoMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool
$c/= :: HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool
== :: HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool
$c== :: HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandMeshUpdateInfoMSFT)
#endif
deriving instance Show HandMeshUpdateInfoMSFT

instance ToCStruct HandMeshUpdateInfoMSFT where
  withCStruct :: HandMeshUpdateInfoMSFT
-> (Ptr HandMeshUpdateInfoMSFT -> IO b) -> IO b
withCStruct x :: HandMeshUpdateInfoMSFT
x f :: Ptr HandMeshUpdateInfoMSFT -> IO b
f = Int -> Int -> (Ptr HandMeshUpdateInfoMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr HandMeshUpdateInfoMSFT -> IO b) -> IO b)
-> (Ptr HandMeshUpdateInfoMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandMeshUpdateInfoMSFT
p -> Ptr HandMeshUpdateInfoMSFT
-> HandMeshUpdateInfoMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshUpdateInfoMSFT
p HandMeshUpdateInfoMSFT
x (Ptr HandMeshUpdateInfoMSFT -> IO b
f Ptr HandMeshUpdateInfoMSFT
p)
  pokeCStruct :: Ptr HandMeshUpdateInfoMSFT
-> HandMeshUpdateInfoMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandMeshUpdateInfoMSFT
p HandMeshUpdateInfoMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_MESH_UPDATE_INFO_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Time -> Time -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Time)) (Time
time)
    Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr HandPoseTypeMSFT)) (HandPoseTypeMSFT
handPoseType)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr HandMeshUpdateInfoMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandMeshUpdateInfoMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_MESH_UPDATE_INFO_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Time -> Time -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Time)) (Time
forall a. Zero a => a
zero)
    Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr HandPoseTypeMSFT)) (HandPoseTypeMSFT
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandMeshUpdateInfoMSFT where
  peekCStruct :: Ptr HandMeshUpdateInfoMSFT -> IO HandMeshUpdateInfoMSFT
peekCStruct p :: Ptr HandMeshUpdateInfoMSFT
p = do
    Time
time <- Ptr Time -> IO Time
forall a. Storable a => Ptr a -> IO a
peek @Time ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Time))
    HandPoseTypeMSFT
handPoseType <- Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT
forall a. Storable a => Ptr a -> IO a
peek @HandPoseTypeMSFT ((Ptr HandMeshUpdateInfoMSFT
p Ptr HandMeshUpdateInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr HandPoseTypeMSFT))
    HandMeshUpdateInfoMSFT -> IO HandMeshUpdateInfoMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandMeshUpdateInfoMSFT -> IO HandMeshUpdateInfoMSFT)
-> HandMeshUpdateInfoMSFT -> IO HandMeshUpdateInfoMSFT
forall a b. (a -> b) -> a -> b
$ Time -> HandPoseTypeMSFT -> HandMeshUpdateInfoMSFT
HandMeshUpdateInfoMSFT
             Time
time HandPoseTypeMSFT
handPoseType

instance Storable HandMeshUpdateInfoMSFT where
  sizeOf :: HandMeshUpdateInfoMSFT -> Int
sizeOf ~HandMeshUpdateInfoMSFT
_ = 32
  alignment :: HandMeshUpdateInfoMSFT -> Int
alignment ~HandMeshUpdateInfoMSFT
_ = 8
  peek :: Ptr HandMeshUpdateInfoMSFT -> IO HandMeshUpdateInfoMSFT
peek = Ptr HandMeshUpdateInfoMSFT -> IO HandMeshUpdateInfoMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandMeshUpdateInfoMSFT -> HandMeshUpdateInfoMSFT -> IO ()
poke ptr :: Ptr HandMeshUpdateInfoMSFT
ptr poked :: HandMeshUpdateInfoMSFT
poked = Ptr HandMeshUpdateInfoMSFT
-> HandMeshUpdateInfoMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshUpdateInfoMSFT
ptr HandMeshUpdateInfoMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandMeshUpdateInfoMSFT where
  zero :: HandMeshUpdateInfoMSFT
zero = Time -> HandPoseTypeMSFT -> HandMeshUpdateInfoMSFT
HandMeshUpdateInfoMSFT
           Time
forall a. Zero a => a
zero
           HandPoseTypeMSFT
forall a. Zero a => a
zero


-- | XrHandMeshMSFT - The data of a hand mesh
--
-- == Member Descriptions
--
-- = Description
--
-- When the returned @isActive@ value is
-- 'OpenXR.Core10.FundamentalTypes.FALSE', the runtime indicates the hand
-- is not actively tracked, for example, the hand is outside of sensor’s
-- range, or the input focus is taken away from the application. When the
-- runtime returns 'OpenXR.Core10.FundamentalTypes.FALSE' to @isActive@, it
-- /must/ set @indexBufferChanged@ and @vertexBufferChanged@ to
-- 'OpenXR.Core10.FundamentalTypes.FALSE', and /must/ not change the
-- content in @indexBuffer@ or @vertexBuffer@,
--
-- When the returned @isActive@ value is
-- 'OpenXR.Core10.FundamentalTypes.TRUE', the hand tracking mesh
-- represented in @indexBuffer@ and @vertexBuffer@ are updated to the
-- latest data of the @time@ given to the 'updateHandMeshMSFT' function.
-- The runtime /must/ set @indexBufferChanged@ and @vertexBufferChanged@ to
-- reflect whether the index or vertex buffer’s content are changed during
-- the update. In this way, the application can easily avoid unnecessary
-- processing of buffers when there’s no new data.
--
-- The hand mesh is represented in triangle lists and each triangle’s
-- vertices are in counter-clockwise order when looking from outside of the
-- hand. When hand tracking is active, i.e. when @isActive@ is returned as
-- 'OpenXR.Core10.FundamentalTypes.TRUE', the returned
-- @indexBuffer.indexCountOutput@ value /must/ be positive and multiple of
-- 3, and @vertexBuffer.vertexCountOutput@ value /must/ be equal to or
-- larger than 3.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandMeshMSFT-extension-notenabled# The @@ extension /must/
--     be enabled prior to using 'HandMeshMSFT'
--
-- -   #VUID-XrHandMeshMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_HAND_MESH_MSFT'
--
-- -   #VUID-XrHandMeshMSFT-next-next# @next@ /must/ be @NULL@ or a valid
--     pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrHandMeshMSFT-indexBuffer-parameter# @indexBuffer@ /must/ be
--     a valid 'HandMeshIndexBufferMSFT' structure
--
-- -   #VUID-XrHandMeshMSFT-vertexBuffer-parameter# @vertexBuffer@ /must/
--     be a valid 'HandMeshVertexBufferMSFT' structure
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >,
-- 'HandMeshIndexBufferMSFT', 'HandMeshVertexBufferMSFT',
-- 'OpenXR.Core10.Enums.StructureType.StructureType', 'updateHandMeshMSFT'
data HandMeshMSFT = HandMeshMSFT
  { -- | @isActive@ is an
    -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >
    -- indicating if the current hand tracker is active.
    HandMeshMSFT -> Bool
isActive :: Bool
  , -- | @indexBufferChanged@ is an
    -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >
    -- indicating if the @indexBuffer@ content was changed during the update.
    HandMeshMSFT -> Bool
indexBufferChanged :: Bool
  , -- | @vertexBufferChanged@ is an
    -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >
    -- indicating if the @vertexBuffer@ content was changed during the update.
    HandMeshMSFT -> Bool
vertexBufferChanged :: Bool
  , -- | @indexBuffer@ is an 'HandMeshIndexBufferMSFT' returns the index buffer
    -- of the tracked hand mesh.
    HandMeshMSFT -> HandMeshIndexBufferMSFT
indexBuffer :: HandMeshIndexBufferMSFT
  , -- | @vertexBuffer@ is an 'HandMeshVertexBufferMSFT' returns the vertex
    -- buffer of the tracked hand mesh.
    HandMeshMSFT -> HandMeshVertexBufferMSFT
vertexBuffer :: HandMeshVertexBufferMSFT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandMeshMSFT)
#endif
deriving instance Show HandMeshMSFT

instance ToCStruct HandMeshMSFT where
  withCStruct :: HandMeshMSFT -> (Ptr HandMeshMSFT -> IO b) -> IO b
withCStruct x :: HandMeshMSFT
x f :: Ptr HandMeshMSFT -> IO b
f = Int -> Int -> (Ptr HandMeshMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 80 8 ((Ptr HandMeshMSFT -> IO b) -> IO b)
-> (Ptr HandMeshMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandMeshMSFT
p -> Ptr HandMeshMSFT -> HandMeshMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshMSFT
p HandMeshMSFT
x (Ptr HandMeshMSFT -> IO b
f Ptr HandMeshMSFT
p)
  pokeCStruct :: Ptr HandMeshMSFT -> HandMeshMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandMeshMSFT
p HandMeshMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_MESH_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
isActive))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
indexBufferChanged))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
vertexBufferChanged))
    Ptr HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr HandMeshIndexBufferMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr HandMeshIndexBufferMSFT)) (HandMeshIndexBufferMSFT
indexBuffer)
    Ptr HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr HandMeshVertexBufferMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr HandMeshVertexBufferMSFT)) (HandMeshVertexBufferMSFT
vertexBuffer)
    IO b
f
  cStructSize :: Int
cStructSize = 80
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr HandMeshMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandMeshMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_MESH_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    Ptr HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr HandMeshIndexBufferMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr HandMeshIndexBufferMSFT)) (HandMeshIndexBufferMSFT
forall a. Zero a => a
zero)
    Ptr HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr HandMeshVertexBufferMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr HandMeshVertexBufferMSFT)) (HandMeshVertexBufferMSFT
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandMeshMSFT where
  peekCStruct :: Ptr HandMeshMSFT -> IO HandMeshMSFT
peekCStruct p :: Ptr HandMeshMSFT
p = do
    Bool32
isActive <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    Bool32
indexBufferChanged <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32))
    Bool32
vertexBufferChanged <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Bool32))
    HandMeshIndexBufferMSFT
indexBuffer <- Ptr HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @HandMeshIndexBufferMSFT ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr HandMeshIndexBufferMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr HandMeshIndexBufferMSFT))
    HandMeshVertexBufferMSFT
vertexBuffer <- Ptr HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @HandMeshVertexBufferMSFT ((Ptr HandMeshMSFT
p Ptr HandMeshMSFT -> Int -> Ptr HandMeshVertexBufferMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr HandMeshVertexBufferMSFT))
    HandMeshMSFT -> IO HandMeshMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandMeshMSFT -> IO HandMeshMSFT)
-> HandMeshMSFT -> IO HandMeshMSFT
forall a b. (a -> b) -> a -> b
$ Bool
-> Bool
-> Bool
-> HandMeshIndexBufferMSFT
-> HandMeshVertexBufferMSFT
-> HandMeshMSFT
HandMeshMSFT
             (Bool32 -> Bool
bool32ToBool Bool32
isActive) (Bool32 -> Bool
bool32ToBool Bool32
indexBufferChanged) (Bool32 -> Bool
bool32ToBool Bool32
vertexBufferChanged) HandMeshIndexBufferMSFT
indexBuffer HandMeshVertexBufferMSFT
vertexBuffer

instance Storable HandMeshMSFT where
  sizeOf :: HandMeshMSFT -> Int
sizeOf ~HandMeshMSFT
_ = 80
  alignment :: HandMeshMSFT -> Int
alignment ~HandMeshMSFT
_ = 8
  peek :: Ptr HandMeshMSFT -> IO HandMeshMSFT
peek = Ptr HandMeshMSFT -> IO HandMeshMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandMeshMSFT -> HandMeshMSFT -> IO ()
poke ptr :: Ptr HandMeshMSFT
ptr poked :: HandMeshMSFT
poked = Ptr HandMeshMSFT -> HandMeshMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshMSFT
ptr HandMeshMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandMeshMSFT where
  zero :: HandMeshMSFT
zero = Bool
-> Bool
-> Bool
-> HandMeshIndexBufferMSFT
-> HandMeshVertexBufferMSFT
-> HandMeshMSFT
HandMeshMSFT
           Bool
forall a. Zero a => a
zero
           Bool
forall a. Zero a => a
zero
           Bool
forall a. Zero a => a
zero
           HandMeshIndexBufferMSFT
forall a. Zero a => a
zero
           HandMeshVertexBufferMSFT
forall a. Zero a => a
zero


-- | XrHandMeshIndexBufferMSFT - The index buffer of a hand mesh
--
-- == Member Descriptions
--
-- = Description
--
-- An application /should/ preallocate the indices array using the
-- @maxHandMeshIndexCount@ in 'SystemHandTrackingMeshPropertiesMSFT'
-- returned from 'OpenXR.Core10.Device.getSystemProperties'. In this way,
-- the application can avoid possible insufficient buffer sizees for each
-- query, and therefore avoid reallocating memory each frame.
--
-- The input @indexCapacityInput@ /must/ not be 0, and @indices@ /must/ not
-- be @NULL@, or else the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE' on calls to the
-- 'updateHandMeshMSFT' function.
--
-- If the input @indexCapacityInput@ is not sufficient to contain all
-- output indices, the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT' on calls to
-- 'updateHandMeshMSFT', not change the content in @indexBufferKey@ and
-- @indices@, and return 0 for @indexCountOutput@.
--
-- If the input @indexCapacityInput@ is equal to or larger than the
-- @maxHandMeshIndexCount@ in 'SystemHandTrackingMeshPropertiesMSFT'
-- returned from 'OpenXR.Core10.Device.getSystemProperties', the runtime
-- /must/ not return 'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
-- error on 'updateHandMeshMSFT' because of insufficient index buffer size.
--
-- If the input @indexBufferKey@ is 0, the capacity of indices array is
-- sufficient, and hand mesh tracking is active, the runtime /must/ return
-- the latest non-zero @indexBufferKey@, and fill in @indexCountOutput@ and
-- @indices@.
--
-- If the input @indexBufferKey@ is not 0, the runtime /can/ either return
-- without changing @indexCountOutput@ or content in @indices@, and return
-- 'OpenXR.Core10.FundamentalTypes.FALSE' for @indexBufferChanged@
-- indicating the indices are not changed; or return a new non-zero
-- @indexBufferKey@ and fill in latest data in @indexCountOutput@ and
-- @indices@, and return 'OpenXR.Core10.FundamentalTypes.TRUE' for
-- @indexBufferChanged@ indicating the indices are updated to a newer
-- version.
--
-- An application /can/ keep the 'HandMeshIndexBufferMSFT' structure for
-- each frame in a frame loop and use the returned @indexBufferKey@ to
-- identify different triangle list topology described in @indices@. The
-- application can therefore avoid unnecessary processing of indices, such
-- as coping them to GPU memory.
--
-- The runtime /must/ return the same @indexBufferKey@ for the same
-- 'OpenXR.Extensions.Handles.HandTrackerEXT' at a given time, regardless
-- of the input 'HandPoseTypeMSFT' in 'HandMeshUpdateInfoMSFT'. This
-- ensures the index buffer has the same mesh topology and allows the
-- application to reason about vertices across different hand pose types.
-- For example, the application /can/ build a procedure to perform UV
-- mapping on vertices of a hand mesh using
-- 'HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT', and apply the resultant UV
-- data on vertices to the mesh returned from the same hand tracker using
-- 'HAND_POSE_TYPE_TRACKED_MSFT'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandMeshIndexBufferMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using 'HandMeshIndexBufferMSFT'
--
-- -   #VUID-XrHandMeshIndexBufferMSFT-indices-parameter# @indices@ /must/
--     be a pointer to an array of @indexCapacityInput@ @uint32_t@ values
--
-- -   #VUID-XrHandMeshIndexBufferMSFT-indexCapacityInput-arraylength# The
--     @indexCapacityInput@ parameter /must/ be greater than @0@
--
-- = See Also
--
-- 'HandMeshMSFT'
data HandMeshIndexBufferMSFT = HandMeshIndexBufferMSFT
  { -- | @indexBufferKey@ is a @uint32_t@ serving as the key of the returned
    -- index buffer content or 0 to indicate a request to retrieve the latest
    -- indices regardless of existing content in @indices@.
    HandMeshIndexBufferMSFT -> Word32
indexBufferKey :: Word32
  , -- | @indexCapacityInput@ is a positive @uint32_t@ describes the capacity of
    -- the @indices@ array.
    HandMeshIndexBufferMSFT -> Word32
indexCapacityInput :: Word32
  , -- | @indexCountOutput@ is a @uint32_t@ returned by the runtime with the
    -- count of indices written in @indices@.
    HandMeshIndexBufferMSFT -> Word32
indexCountOutput :: Word32
  , -- | @indices@ is an array of indices filled in by the runtime, specifying
    -- the indices of the triangles list in the vertex buffer.
    HandMeshIndexBufferMSFT -> Ptr Word32
indices :: Ptr Word32
  }
  deriving (Typeable, HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool
(HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool)
-> (HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool)
-> Eq HandMeshIndexBufferMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool
$c/= :: HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool
== :: HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool
$c== :: HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandMeshIndexBufferMSFT)
#endif
deriving instance Show HandMeshIndexBufferMSFT

instance ToCStruct HandMeshIndexBufferMSFT where
  withCStruct :: HandMeshIndexBufferMSFT
-> (Ptr HandMeshIndexBufferMSFT -> IO b) -> IO b
withCStruct x :: HandMeshIndexBufferMSFT
x f :: Ptr HandMeshIndexBufferMSFT -> IO b
f = Int -> Int -> (Ptr HandMeshIndexBufferMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr HandMeshIndexBufferMSFT -> IO b) -> IO b)
-> (Ptr HandMeshIndexBufferMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandMeshIndexBufferMSFT
p -> Ptr HandMeshIndexBufferMSFT
-> HandMeshIndexBufferMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshIndexBufferMSFT
p HandMeshIndexBufferMSFT
x (Ptr HandMeshIndexBufferMSFT -> IO b
f Ptr HandMeshIndexBufferMSFT
p)
  pokeCStruct :: Ptr HandMeshIndexBufferMSFT
-> HandMeshIndexBufferMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandMeshIndexBufferMSFT
p HandMeshIndexBufferMSFT{..} f :: IO b
f = do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
indexBufferKey)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
indexCapacityInput)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
indexCountOutput)
    Ptr (Ptr Word32) -> Ptr Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr (Ptr Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr Word32))) (Ptr Word32
indices)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr HandMeshIndexBufferMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandMeshIndexBufferMSFT
p f :: IO b
f = do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr (Ptr Word32) -> Ptr Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr (Ptr Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr Word32))) (Ptr Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandMeshIndexBufferMSFT where
  peekCStruct :: Ptr HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT
peekCStruct p :: Ptr HandMeshIndexBufferMSFT
p = do
    Word32
indexBufferKey <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
    Word32
indexCapacityInput <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr Word32))
    Word32
indexCountOutput <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32))
    Ptr Word32
indices <- Ptr (Ptr Word32) -> IO (Ptr Word32)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word32) ((Ptr HandMeshIndexBufferMSFT
p Ptr HandMeshIndexBufferMSFT -> Int -> Ptr (Ptr Word32)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr Word32)))
    HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT)
-> HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT
forall a b. (a -> b) -> a -> b
$ Word32 -> Word32 -> Word32 -> Ptr Word32 -> HandMeshIndexBufferMSFT
HandMeshIndexBufferMSFT
             Word32
indexBufferKey Word32
indexCapacityInput Word32
indexCountOutput Ptr Word32
indices

instance Storable HandMeshIndexBufferMSFT where
  sizeOf :: HandMeshIndexBufferMSFT -> Int
sizeOf ~HandMeshIndexBufferMSFT
_ = 24
  alignment :: HandMeshIndexBufferMSFT -> Int
alignment ~HandMeshIndexBufferMSFT
_ = 8
  peek :: Ptr HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT
peek = Ptr HandMeshIndexBufferMSFT -> IO HandMeshIndexBufferMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandMeshIndexBufferMSFT -> HandMeshIndexBufferMSFT -> IO ()
poke ptr :: Ptr HandMeshIndexBufferMSFT
ptr poked :: HandMeshIndexBufferMSFT
poked = Ptr HandMeshIndexBufferMSFT
-> HandMeshIndexBufferMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshIndexBufferMSFT
ptr HandMeshIndexBufferMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandMeshIndexBufferMSFT where
  zero :: HandMeshIndexBufferMSFT
zero = Word32 -> Word32 -> Word32 -> Ptr Word32 -> HandMeshIndexBufferMSFT
HandMeshIndexBufferMSFT
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Ptr Word32
forall a. Zero a => a
zero


-- | XrHandMeshVertexBufferMSFT - The vertex buffer of a hand mesh
--
-- == Member Descriptions
--
-- = Description
--
-- An application /should/ preallocate the vertices array using the
-- @maxHandMeshVertexCount@ in 'SystemHandTrackingMeshPropertiesMSFT'
-- returned from 'OpenXR.Core10.Device.getSystemProperties'. In this way,
-- the application can avoid possible insufficient buffer sizes for each
-- query, and therefore avoid reallocating memory each frame.
--
-- The input @vertexCapacityInput@ /must/ not be 0, and @vertices@ /must/
-- not be @NULL@, or else the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE' on calls to the
-- 'updateHandMeshMSFT' function.
--
-- If the input @vertexCapacityInput@ is not sufficient to contain all
-- output vertices, the runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT' on calls to the
-- 'updateHandMeshMSFT', do not change content in @vertexUpdateTime@ and
-- @vertices@, and return 0 for @vertexCountOutput@.
--
-- If the input @vertexCapacityInput@ is equal to or larger than the
-- @maxHandMeshVertexCount@ in 'SystemHandTrackingMeshPropertiesMSFT'
-- returned from 'OpenXR.Core10.Device.getSystemProperties', the runtime
-- /must/ not return 'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
-- on calls to the 'updateHandMeshMSFT' because of insufficient vertex
-- buffer size.
--
-- If the input @vertexUpdateTime@ is 0, and the capacity of the vertices
-- array is sufficient, and hand mesh tracking is active, the runtime
-- /must/ return the latest non-zero @vertexUpdateTime@, and fill in the
-- @vertexCountOutput@ and @vertices@ fields.
--
-- If the input @vertexUpdateTime@ is not 0, the runtime /can/ either
-- return without changing @vertexCountOutput@ or the content in
-- @vertices@, and return 'OpenXR.Core10.FundamentalTypes.FALSE' for
-- @vertexBufferChanged@ indicating the vertices are not changed; or return
-- a new non-zero @vertexUpdateTime@ and fill in latest data in
-- @vertexCountOutput@ and @vertices@ and return
-- 'OpenXR.Core10.FundamentalTypes.TRUE' for @vertexBufferChanged@
-- indicating the vertices are updated to a newer version.
--
-- An application /can/ keep the 'HandMeshVertexBufferMSFT' structure for
-- each frame in frame loop and use the returned @vertexUpdateTime@ to
-- detect the changes of the content in @vertices@. The application can
-- therefore avoid unnecessary processing of vertices, such as coping them
-- to GPU memory.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandMeshVertexBufferMSFT-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'HandMeshVertexBufferMSFT'
--
-- -   #VUID-XrHandMeshVertexBufferMSFT-vertices-parameter# @vertices@
--     /must/ be a pointer to an array of @vertexCapacityInput@
--     'HandMeshVertexMSFT' structures
--
-- -   #VUID-XrHandMeshVertexBufferMSFT-vertexCapacityInput-arraylength#
--     The @vertexCapacityInput@ parameter /must/ be greater than @0@
--
-- = See Also
--
-- 'HandMeshMSFT', 'HandMeshVertexMSFT',
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime >
data HandMeshVertexBufferMSFT = HandMeshVertexBufferMSFT
  { -- | @vertexUpdateTime@ is an
    -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrTime >
    -- representing the time when the runtime receives the vertex buffer
    -- content or 0 to indicate a request to retrieve latest vertices
    -- regardless of existing content in @vertices@.
    HandMeshVertexBufferMSFT -> Time
vertexUpdateTime :: Time
  , -- | @vertexCapacityInput@ is a positive @uint32_t@ describes the capacity of
    -- the @vertices@ array.
    HandMeshVertexBufferMSFT -> Word32
vertexCapacityInput :: Word32
  , -- | @vertexCountOutput@ is a @uint32_t@ filled in by the runtime with the
    -- count of vertices written in @vertices@.
    HandMeshVertexBufferMSFT -> Word32
vertexCountOutput :: Word32
  , -- | @vertices@ is an array of 'HandMeshVertexMSFT' filled in by the runtime,
    -- specifying the vertices of the hand mesh including the position and
    -- normal vector in the hand mesh space.
    HandMeshVertexBufferMSFT -> Ptr HandMeshVertexMSFT
vertices :: Ptr HandMeshVertexMSFT
  }
  deriving (Typeable, HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool
(HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool)
-> (HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool)
-> Eq HandMeshVertexBufferMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool
$c/= :: HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool
== :: HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool
$c== :: HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandMeshVertexBufferMSFT)
#endif
deriving instance Show HandMeshVertexBufferMSFT

instance ToCStruct HandMeshVertexBufferMSFT where
  withCStruct :: HandMeshVertexBufferMSFT
-> (Ptr HandMeshVertexBufferMSFT -> IO b) -> IO b
withCStruct x :: HandMeshVertexBufferMSFT
x f :: Ptr HandMeshVertexBufferMSFT -> IO b
f = Int -> Int -> (Ptr HandMeshVertexBufferMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr HandMeshVertexBufferMSFT -> IO b) -> IO b)
-> (Ptr HandMeshVertexBufferMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandMeshVertexBufferMSFT
p -> Ptr HandMeshVertexBufferMSFT
-> HandMeshVertexBufferMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshVertexBufferMSFT
p HandMeshVertexBufferMSFT
x (Ptr HandMeshVertexBufferMSFT -> IO b
f Ptr HandMeshVertexBufferMSFT
p)
  pokeCStruct :: Ptr HandMeshVertexBufferMSFT
-> HandMeshVertexBufferMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandMeshVertexBufferMSFT
p HandMeshVertexBufferMSFT{..} f :: IO b
f = do
    Ptr Time -> Time -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Time)) (Time
vertexUpdateTime)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
vertexCapacityInput)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr Word32)) (Word32
vertexCountOutput)
    Ptr (Ptr HandMeshVertexMSFT) -> Ptr HandMeshVertexMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr (Ptr HandMeshVertexMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr HandMeshVertexMSFT))) (Ptr HandMeshVertexMSFT
vertices)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr HandMeshVertexBufferMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandMeshVertexBufferMSFT
p f :: IO b
f = do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr (Ptr HandMeshVertexMSFT) -> Ptr HandMeshVertexMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr (Ptr HandMeshVertexMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr HandMeshVertexMSFT))) (Ptr HandMeshVertexMSFT
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandMeshVertexBufferMSFT where
  peekCStruct :: Ptr HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT
peekCStruct p :: Ptr HandMeshVertexBufferMSFT
p = do
    Time
vertexUpdateTime <- Ptr Time -> IO Time
forall a. Storable a => Ptr a -> IO a
peek @Time ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Time
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Time))
    Word32
vertexCapacityInput <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr Word32))
    Word32
vertexCountOutput <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr Word32))
    Ptr HandMeshVertexMSFT
vertices <- Ptr (Ptr HandMeshVertexMSFT) -> IO (Ptr HandMeshVertexMSFT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr HandMeshVertexMSFT) ((Ptr HandMeshVertexBufferMSFT
p Ptr HandMeshVertexBufferMSFT -> Int -> Ptr (Ptr HandMeshVertexMSFT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr HandMeshVertexMSFT)))
    HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT)
-> HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT
forall a b. (a -> b) -> a -> b
$ Time
-> Word32
-> Word32
-> Ptr HandMeshVertexMSFT
-> HandMeshVertexBufferMSFT
HandMeshVertexBufferMSFT
             Time
vertexUpdateTime Word32
vertexCapacityInput Word32
vertexCountOutput Ptr HandMeshVertexMSFT
vertices

instance Storable HandMeshVertexBufferMSFT where
  sizeOf :: HandMeshVertexBufferMSFT -> Int
sizeOf ~HandMeshVertexBufferMSFT
_ = 24
  alignment :: HandMeshVertexBufferMSFT -> Int
alignment ~HandMeshVertexBufferMSFT
_ = 8
  peek :: Ptr HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT
peek = Ptr HandMeshVertexBufferMSFT -> IO HandMeshVertexBufferMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandMeshVertexBufferMSFT -> HandMeshVertexBufferMSFT -> IO ()
poke ptr :: Ptr HandMeshVertexBufferMSFT
ptr poked :: HandMeshVertexBufferMSFT
poked = Ptr HandMeshVertexBufferMSFT
-> HandMeshVertexBufferMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshVertexBufferMSFT
ptr HandMeshVertexBufferMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandMeshVertexBufferMSFT where
  zero :: HandMeshVertexBufferMSFT
zero = Time
-> Word32
-> Word32
-> Ptr HandMeshVertexMSFT
-> HandMeshVertexBufferMSFT
HandMeshVertexBufferMSFT
           Time
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Ptr HandMeshVertexMSFT
forall a. Zero a => a
zero


-- | XrHandMeshVertexMSFT - The vertex of hand mesh
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandMeshVertexMSFT-extension-notenabled# The @@ extension
--     /must/ be enabled prior to using 'HandMeshVertexMSFT'
--
-- = See Also
--
-- 'HandMeshVertexBufferMSFT', 'OpenXR.Core10.Space.Vector3f'
data HandMeshVertexMSFT = HandMeshVertexMSFT
  { -- | @position@ is an 'OpenXR.Core10.Space.Vector3f' structure representing
    -- the position of the vertex in the hand mesh space, measured in meters.
    HandMeshVertexMSFT -> Vector3f
position :: Vector3f
  , -- | @normal@ is an 'OpenXR.Core10.Space.Vector3f' structure representing the
    -- unweighted normal of the triangle surface at the vertex as a unit vector
    -- in hand mesh space.
    HandMeshVertexMSFT -> Vector3f
normal :: Vector3f
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandMeshVertexMSFT)
#endif
deriving instance Show HandMeshVertexMSFT

instance ToCStruct HandMeshVertexMSFT where
  withCStruct :: HandMeshVertexMSFT -> (Ptr HandMeshVertexMSFT -> IO b) -> IO b
withCStruct x :: HandMeshVertexMSFT
x f :: Ptr HandMeshVertexMSFT -> IO b
f = Int -> Int -> (Ptr HandMeshVertexMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 4 ((Ptr HandMeshVertexMSFT -> IO b) -> IO b)
-> (Ptr HandMeshVertexMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandMeshVertexMSFT
p -> Ptr HandMeshVertexMSFT -> HandMeshVertexMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshVertexMSFT
p HandMeshVertexMSFT
x (Ptr HandMeshVertexMSFT -> IO b
f Ptr HandMeshVertexMSFT
p)
  pokeCStruct :: Ptr HandMeshVertexMSFT -> HandMeshVertexMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandMeshVertexMSFT
p HandMeshVertexMSFT{..} f :: IO b
f = do
    Ptr Vector3f -> Vector3f -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexMSFT
p Ptr HandMeshVertexMSFT -> Int -> Ptr Vector3f
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Vector3f)) (Vector3f
position)
    Ptr Vector3f -> Vector3f -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexMSFT
p Ptr HandMeshVertexMSFT -> Int -> Ptr Vector3f
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr Vector3f)) (Vector3f
normal)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 4
  pokeZeroCStruct :: Ptr HandMeshVertexMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandMeshVertexMSFT
p f :: IO b
f = do
    Ptr Vector3f -> Vector3f -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexMSFT
p Ptr HandMeshVertexMSFT -> Int -> Ptr Vector3f
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Vector3f)) (Vector3f
forall a. Zero a => a
zero)
    Ptr Vector3f -> Vector3f -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandMeshVertexMSFT
p Ptr HandMeshVertexMSFT -> Int -> Ptr Vector3f
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr Vector3f)) (Vector3f
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandMeshVertexMSFT where
  peekCStruct :: Ptr HandMeshVertexMSFT -> IO HandMeshVertexMSFT
peekCStruct p :: Ptr HandMeshVertexMSFT
p = do
    Vector3f
position <- Ptr Vector3f -> IO Vector3f
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Vector3f ((Ptr HandMeshVertexMSFT
p Ptr HandMeshVertexMSFT -> Int -> Ptr Vector3f
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Vector3f))
    Vector3f
normal <- Ptr Vector3f -> IO Vector3f
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Vector3f ((Ptr HandMeshVertexMSFT
p Ptr HandMeshVertexMSFT -> Int -> Ptr Vector3f
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 12 :: Ptr Vector3f))
    HandMeshVertexMSFT -> IO HandMeshVertexMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandMeshVertexMSFT -> IO HandMeshVertexMSFT)
-> HandMeshVertexMSFT -> IO HandMeshVertexMSFT
forall a b. (a -> b) -> a -> b
$ Vector3f -> Vector3f -> HandMeshVertexMSFT
HandMeshVertexMSFT
             Vector3f
position Vector3f
normal

instance Storable HandMeshVertexMSFT where
  sizeOf :: HandMeshVertexMSFT -> Int
sizeOf ~HandMeshVertexMSFT
_ = 24
  alignment :: HandMeshVertexMSFT -> Int
alignment ~HandMeshVertexMSFT
_ = 4
  peek :: Ptr HandMeshVertexMSFT -> IO HandMeshVertexMSFT
peek = Ptr HandMeshVertexMSFT -> IO HandMeshVertexMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandMeshVertexMSFT -> HandMeshVertexMSFT -> IO ()
poke ptr :: Ptr HandMeshVertexMSFT
ptr poked :: HandMeshVertexMSFT
poked = Ptr HandMeshVertexMSFT -> HandMeshVertexMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandMeshVertexMSFT
ptr HandMeshVertexMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandMeshVertexMSFT where
  zero :: HandMeshVertexMSFT
zero = Vector3f -> Vector3f -> HandMeshVertexMSFT
HandMeshVertexMSFT
           Vector3f
forall a. Zero a => a
zero
           Vector3f
forall a. Zero a => a
zero


-- | XrSystemHandTrackingMeshPropertiesMSFT - System property for hand
-- tracking mesh
--
-- == Member Descriptions
--
-- = Description
--
-- If a runtime returns 'OpenXR.Core10.FundamentalTypes.FALSE' for
-- @supportsHandTrackingMesh@, the system does not support hand tracking
-- mesh input, and therefore /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_FEATURE_UNSUPPORTED' from
-- 'createHandMeshSpaceMSFT' and 'updateHandMeshMSFT'. The application
-- /should/ avoid using hand mesh functionality when
-- @supportsHandTrackingMesh@ is 'OpenXR.Core10.FundamentalTypes.FALSE'.
--
-- If a runtime returns 'OpenXR.Core10.FundamentalTypes.TRUE' for
-- @supportsHandTrackingMesh@, the system supports hand tracking mesh
-- input. In this case, the runtime /must/ return a positive number for
-- @maxHandMeshIndexCount@ and @maxHandMeshVertexCount@. An application
-- /should/ use @maxHandMeshIndexCount@ and @maxHandMeshVertexCount@ to
-- preallocate hand mesh buffers and reuse them in their render loop when
-- calling 'updateHandMeshMSFT' every frame.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrSystemHandTrackingMeshPropertiesMSFT-extension-notenabled#
--     The @@ extension /must/ be enabled prior to using
--     'SystemHandTrackingMeshPropertiesMSFT'
--
-- -   #VUID-XrSystemHandTrackingMeshPropertiesMSFT-type-type# @type@
--     /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT'
--
-- -   #VUID-XrSystemHandTrackingMeshPropertiesMSFT-next-next# @next@
--     /must/ be @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- = See Also
--
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >,
-- 'OpenXR.Core10.Enums.StructureType.StructureType'
data SystemHandTrackingMeshPropertiesMSFT = SystemHandTrackingMeshPropertiesMSFT
  { -- | @supportsHandTrackingMesh@ is an
    -- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrBool32 >,
    -- indicating if current system is capable of hand tracking mesh input.
    SystemHandTrackingMeshPropertiesMSFT -> Bool
supportsHandTrackingMesh :: Bool
  , -- | @maxHandMeshIndexCount@ is a @uint32_t@ returns the maximum count of
    -- indices that will be returned from the hand tracker.
    SystemHandTrackingMeshPropertiesMSFT -> Word32
maxHandMeshIndexCount :: Word32
  , -- | @maxHandMeshVertexCount@ is a @uint32_t@ returns the maximum count of
    -- vertices that will be returned from the hand tracker.
    SystemHandTrackingMeshPropertiesMSFT -> Word32
maxHandMeshVertexCount :: Word32
  }
  deriving (Typeable, SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> Bool
(SystemHandTrackingMeshPropertiesMSFT
 -> SystemHandTrackingMeshPropertiesMSFT -> Bool)
-> (SystemHandTrackingMeshPropertiesMSFT
    -> SystemHandTrackingMeshPropertiesMSFT -> Bool)
-> Eq SystemHandTrackingMeshPropertiesMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> Bool
$c/= :: SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> Bool
== :: SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> Bool
$c== :: SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SystemHandTrackingMeshPropertiesMSFT)
#endif
deriving instance Show SystemHandTrackingMeshPropertiesMSFT

instance ToCStruct SystemHandTrackingMeshPropertiesMSFT where
  withCStruct :: SystemHandTrackingMeshPropertiesMSFT
-> (Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b) -> IO b
withCStruct x :: SystemHandTrackingMeshPropertiesMSFT
x f :: Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b
f = Int
-> Int
-> (Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b) -> IO b)
-> (Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SystemHandTrackingMeshPropertiesMSFT
p -> Ptr SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SystemHandTrackingMeshPropertiesMSFT
p SystemHandTrackingMeshPropertiesMSFT
x (Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b
f Ptr SystemHandTrackingMeshPropertiesMSFT
p)
  pokeCStruct :: Ptr SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> IO b -> IO b
pokeCStruct p :: Ptr SystemHandTrackingMeshPropertiesMSFT
p SystemHandTrackingMeshPropertiesMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
supportsHandTrackingMesh))
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) (Word32
maxHandMeshIndexCount)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) (Word32
maxHandMeshVertexCount)
    IO b
f
  cStructSize :: Int
cStructSize = 32
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr SystemHandTrackingMeshPropertiesMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr SystemHandTrackingMeshPropertiesMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct SystemHandTrackingMeshPropertiesMSFT where
  peekCStruct :: Ptr SystemHandTrackingMeshPropertiesMSFT
-> IO SystemHandTrackingMeshPropertiesMSFT
peekCStruct p :: Ptr SystemHandTrackingMeshPropertiesMSFT
p = do
    Bool32
supportsHandTrackingMesh <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    Word32
maxHandMeshIndexCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Word32))
    Word32
maxHandMeshVertexCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr SystemHandTrackingMeshPropertiesMSFT
p Ptr SystemHandTrackingMeshPropertiesMSFT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32))
    SystemHandTrackingMeshPropertiesMSFT
-> IO SystemHandTrackingMeshPropertiesMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SystemHandTrackingMeshPropertiesMSFT
 -> IO SystemHandTrackingMeshPropertiesMSFT)
-> SystemHandTrackingMeshPropertiesMSFT
-> IO SystemHandTrackingMeshPropertiesMSFT
forall a b. (a -> b) -> a -> b
$ Bool -> Word32 -> Word32 -> SystemHandTrackingMeshPropertiesMSFT
SystemHandTrackingMeshPropertiesMSFT
             (Bool32 -> Bool
bool32ToBool Bool32
supportsHandTrackingMesh) Word32
maxHandMeshIndexCount Word32
maxHandMeshVertexCount

instance Storable SystemHandTrackingMeshPropertiesMSFT where
  sizeOf :: SystemHandTrackingMeshPropertiesMSFT -> Int
sizeOf ~SystemHandTrackingMeshPropertiesMSFT
_ = 32
  alignment :: SystemHandTrackingMeshPropertiesMSFT -> Int
alignment ~SystemHandTrackingMeshPropertiesMSFT
_ = 8
  peek :: Ptr SystemHandTrackingMeshPropertiesMSFT
-> IO SystemHandTrackingMeshPropertiesMSFT
peek = Ptr SystemHandTrackingMeshPropertiesMSFT
-> IO SystemHandTrackingMeshPropertiesMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> IO ()
poke ptr :: Ptr SystemHandTrackingMeshPropertiesMSFT
ptr poked :: SystemHandTrackingMeshPropertiesMSFT
poked = Ptr SystemHandTrackingMeshPropertiesMSFT
-> SystemHandTrackingMeshPropertiesMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SystemHandTrackingMeshPropertiesMSFT
ptr SystemHandTrackingMeshPropertiesMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero SystemHandTrackingMeshPropertiesMSFT where
  zero :: SystemHandTrackingMeshPropertiesMSFT
zero = Bool -> Word32 -> Word32 -> SystemHandTrackingMeshPropertiesMSFT
SystemHandTrackingMeshPropertiesMSFT
           Bool
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero
           Word32
forall a. Zero a => a
zero


-- | XrHandPoseTypeInfoMSFT - Describes what hand pose type for the hand
-- joint tracking.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrHandPoseTypeInfoMSFT-extension-notenabled# The @@ extension
--     /must/ be enabled prior to using 'HandPoseTypeInfoMSFT'
--
-- -   #VUID-XrHandPoseTypeInfoMSFT-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_HAND_POSE_TYPE_INFO_MSFT'
--
-- -   #VUID-XrHandPoseTypeInfoMSFT-next-next# @next@ /must/ be @NULL@ or a
--     valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrHandPoseTypeInfoMSFT-handPoseType-parameter# @handPoseType@
--     /must/ be a valid 'HandPoseTypeMSFT' value
--
-- = See Also
--
-- 'HandPoseTypeMSFT', 'OpenXR.Core10.Enums.StructureType.StructureType'
data HandPoseTypeInfoMSFT = HandPoseTypeInfoMSFT
  { -- | @handPoseType@ is an 'HandPoseTypeMSFT' that describes the type of hand
    -- pose of the hand tracking.
    HandPoseTypeInfoMSFT -> HandPoseTypeMSFT
handPoseType :: HandPoseTypeMSFT }
  deriving (Typeable, HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool
(HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool)
-> (HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool)
-> Eq HandPoseTypeInfoMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool
$c/= :: HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool
== :: HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool
$c== :: HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (HandPoseTypeInfoMSFT)
#endif
deriving instance Show HandPoseTypeInfoMSFT

instance ToCStruct HandPoseTypeInfoMSFT where
  withCStruct :: HandPoseTypeInfoMSFT -> (Ptr HandPoseTypeInfoMSFT -> IO b) -> IO b
withCStruct x :: HandPoseTypeInfoMSFT
x f :: Ptr HandPoseTypeInfoMSFT -> IO b
f = Int -> Int -> (Ptr HandPoseTypeInfoMSFT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr HandPoseTypeInfoMSFT -> IO b) -> IO b)
-> (Ptr HandPoseTypeInfoMSFT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr HandPoseTypeInfoMSFT
p -> Ptr HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandPoseTypeInfoMSFT
p HandPoseTypeInfoMSFT
x (Ptr HandPoseTypeInfoMSFT -> IO b
f Ptr HandPoseTypeInfoMSFT
p)
  pokeCStruct :: Ptr HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> IO b -> IO b
pokeCStruct p :: Ptr HandPoseTypeInfoMSFT
p HandPoseTypeInfoMSFT{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_POSE_TYPE_INFO_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr HandPoseTypeMSFT)) (HandPoseTypeMSFT
handPoseType)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr HandPoseTypeInfoMSFT -> IO b -> IO b
pokeZeroCStruct p :: Ptr HandPoseTypeInfoMSFT
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
TYPE_HAND_POSE_TYPE_INFO_MSFT)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr HandPoseTypeMSFT)) (HandPoseTypeMSFT
forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct HandPoseTypeInfoMSFT where
  peekCStruct :: Ptr HandPoseTypeInfoMSFT -> IO HandPoseTypeInfoMSFT
peekCStruct p :: Ptr HandPoseTypeInfoMSFT
p = do
    HandPoseTypeMSFT
handPoseType <- Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT
forall a. Storable a => Ptr a -> IO a
peek @HandPoseTypeMSFT ((Ptr HandPoseTypeInfoMSFT
p Ptr HandPoseTypeInfoMSFT -> Int -> Ptr HandPoseTypeMSFT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr HandPoseTypeMSFT))
    HandPoseTypeInfoMSFT -> IO HandPoseTypeInfoMSFT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HandPoseTypeInfoMSFT -> IO HandPoseTypeInfoMSFT)
-> HandPoseTypeInfoMSFT -> IO HandPoseTypeInfoMSFT
forall a b. (a -> b) -> a -> b
$ HandPoseTypeMSFT -> HandPoseTypeInfoMSFT
HandPoseTypeInfoMSFT
             HandPoseTypeMSFT
handPoseType

instance Storable HandPoseTypeInfoMSFT where
  sizeOf :: HandPoseTypeInfoMSFT -> Int
sizeOf ~HandPoseTypeInfoMSFT
_ = 24
  alignment :: HandPoseTypeInfoMSFT -> Int
alignment ~HandPoseTypeInfoMSFT
_ = 8
  peek :: Ptr HandPoseTypeInfoMSFT -> IO HandPoseTypeInfoMSFT
peek = Ptr HandPoseTypeInfoMSFT -> IO HandPoseTypeInfoMSFT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> IO ()
poke ptr :: Ptr HandPoseTypeInfoMSFT
ptr poked :: HandPoseTypeInfoMSFT
poked = Ptr HandPoseTypeInfoMSFT -> HandPoseTypeInfoMSFT -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr HandPoseTypeInfoMSFT
ptr HandPoseTypeInfoMSFT
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero HandPoseTypeInfoMSFT where
  zero :: HandPoseTypeInfoMSFT
zero = HandPoseTypeMSFT -> HandPoseTypeInfoMSFT
HandPoseTypeInfoMSFT
           HandPoseTypeMSFT
forall a. Zero a => a
zero


-- | XrHandPoseTypeMSFT - Describe type of input hand pose
--
-- == Enumerant Descriptions
--
-- The 'HAND_POSE_TYPE_TRACKED_MSFT' input provides best fidelity to the
-- user’s actual hand motion. When the hand tracking input requires the
-- user to be holding a controller in their hand, the hand tracking input
-- will appear as the user virtually holding the controller. This input can
-- be used to render the hand shape together with the controller in hand.
--
-- The 'HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT' input does not move with
-- the user’s actual hand. Through this reference hand pose, an application
-- /can/ get a stable hand joint and mesh that has the same mesh topology
-- as the tracked hand mesh using the same
-- 'OpenXR.Extensions.Handles.HandTrackerEXT', so that the application can
-- apply the data computed from a reference hand pose to the corresponding
-- tracked hand.
--
-- Although a reference hand pose does not move with user’s hand motion,
-- the bone length and hand thickness /may/ be updated, for example when
-- tracking result refines, or a different user’s hand is detected. The
-- application /should/ update reference hand joints and meshes when the
-- tracked mesh’s @indexBufferKey@ is changed or when the @isActive@ value
-- returned from 'updateHandMeshMSFT' changes from
-- 'OpenXR.Core10.FundamentalTypes.FALSE' to
-- 'OpenXR.Core10.FundamentalTypes.TRUE'. It can use the returned
-- @indexBufferKey@ and @vertexUpdateTime@ from 'updateHandMeshMSFT' to
-- avoid unnecessary CPU or GPU work to process the neutral hand inputs.
--
-- = See Also
--
-- 'HandMeshSpaceCreateInfoMSFT', 'HandMeshUpdateInfoMSFT',
-- 'HandPoseTypeInfoMSFT'
newtype HandPoseTypeMSFT = HandPoseTypeMSFT Int32
  deriving newtype (HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
(HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool)
-> Eq HandPoseTypeMSFT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
$c/= :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
== :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
$c== :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
Eq, Eq HandPoseTypeMSFT
Eq HandPoseTypeMSFT =>
(HandPoseTypeMSFT -> HandPoseTypeMSFT -> Ordering)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT)
-> (HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT)
-> Ord HandPoseTypeMSFT
HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
HandPoseTypeMSFT -> HandPoseTypeMSFT -> Ordering
HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT
$cmin :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT
max :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT
$cmax :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> HandPoseTypeMSFT
>= :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
$c>= :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
> :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
$c> :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
<= :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
$c<= :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
< :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
$c< :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Bool
compare :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Ordering
$ccompare :: HandPoseTypeMSFT -> HandPoseTypeMSFT -> Ordering
$cp1Ord :: Eq HandPoseTypeMSFT
Ord, Ptr b -> Int -> IO HandPoseTypeMSFT
Ptr b -> Int -> HandPoseTypeMSFT -> IO ()
Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT
Ptr HandPoseTypeMSFT -> Int -> IO HandPoseTypeMSFT
Ptr HandPoseTypeMSFT -> Int -> HandPoseTypeMSFT -> IO ()
Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
HandPoseTypeMSFT -> Int
(HandPoseTypeMSFT -> Int)
-> (HandPoseTypeMSFT -> Int)
-> (Ptr HandPoseTypeMSFT -> Int -> IO HandPoseTypeMSFT)
-> (Ptr HandPoseTypeMSFT -> Int -> HandPoseTypeMSFT -> IO ())
-> (forall b. Ptr b -> Int -> IO HandPoseTypeMSFT)
-> (forall b. Ptr b -> Int -> HandPoseTypeMSFT -> IO ())
-> (Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT)
-> (Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ())
-> Storable HandPoseTypeMSFT
forall b. Ptr b -> Int -> IO HandPoseTypeMSFT
forall b. Ptr b -> Int -> HandPoseTypeMSFT -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
$cpoke :: Ptr HandPoseTypeMSFT -> HandPoseTypeMSFT -> IO ()
peek :: Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT
$cpeek :: Ptr HandPoseTypeMSFT -> IO HandPoseTypeMSFT
pokeByteOff :: Ptr b -> Int -> HandPoseTypeMSFT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> HandPoseTypeMSFT -> IO ()
peekByteOff :: Ptr b -> Int -> IO HandPoseTypeMSFT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO HandPoseTypeMSFT
pokeElemOff :: Ptr HandPoseTypeMSFT -> Int -> HandPoseTypeMSFT -> IO ()
$cpokeElemOff :: Ptr HandPoseTypeMSFT -> Int -> HandPoseTypeMSFT -> IO ()
peekElemOff :: Ptr HandPoseTypeMSFT -> Int -> IO HandPoseTypeMSFT
$cpeekElemOff :: Ptr HandPoseTypeMSFT -> Int -> IO HandPoseTypeMSFT
alignment :: HandPoseTypeMSFT -> Int
$calignment :: HandPoseTypeMSFT -> Int
sizeOf :: HandPoseTypeMSFT -> Int
$csizeOf :: HandPoseTypeMSFT -> Int
Storable, HandPoseTypeMSFT
HandPoseTypeMSFT -> Zero HandPoseTypeMSFT
forall a. a -> Zero a
zero :: HandPoseTypeMSFT
$czero :: HandPoseTypeMSFT
Zero)

-- | 'HAND_POSE_TYPE_TRACKED_MSFT' represents a hand pose provided by actual
-- tracking of the user’s hand.
pattern $bHAND_POSE_TYPE_TRACKED_MSFT :: HandPoseTypeMSFT
$mHAND_POSE_TYPE_TRACKED_MSFT :: forall r. HandPoseTypeMSFT -> (Void# -> r) -> (Void# -> r) -> r
HAND_POSE_TYPE_TRACKED_MSFT             = HandPoseTypeMSFT 0
-- | 'HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT' represents a stable reference
-- hand pose in a relaxed open hand shape.
pattern $bHAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT :: HandPoseTypeMSFT
$mHAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT :: forall r. HandPoseTypeMSFT -> (Void# -> r) -> (Void# -> r) -> r
HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT = HandPoseTypeMSFT 1
{-# complete HAND_POSE_TYPE_TRACKED_MSFT,
             HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT :: HandPoseTypeMSFT #-}

conNameHandPoseTypeMSFT :: String
conNameHandPoseTypeMSFT :: String
conNameHandPoseTypeMSFT = "HandPoseTypeMSFT"

enumPrefixHandPoseTypeMSFT :: String
enumPrefixHandPoseTypeMSFT :: String
enumPrefixHandPoseTypeMSFT = "HAND_POSE_TYPE_"

showTableHandPoseTypeMSFT :: [(HandPoseTypeMSFT, String)]
showTableHandPoseTypeMSFT :: [(HandPoseTypeMSFT, String)]
showTableHandPoseTypeMSFT =
  [(HandPoseTypeMSFT
HAND_POSE_TYPE_TRACKED_MSFT, "TRACKED_MSFT"), (HandPoseTypeMSFT
HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT, "REFERENCE_OPEN_PALM_MSFT")]

instance Show HandPoseTypeMSFT where
  showsPrec :: Int -> HandPoseTypeMSFT -> ShowS
showsPrec = String
-> [(HandPoseTypeMSFT, String)]
-> String
-> (HandPoseTypeMSFT -> Int32)
-> (Int32 -> ShowS)
-> Int
-> HandPoseTypeMSFT
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec String
enumPrefixHandPoseTypeMSFT
                            [(HandPoseTypeMSFT, String)]
showTableHandPoseTypeMSFT
                            String
conNameHandPoseTypeMSFT
                            (\(HandPoseTypeMSFT x :: Int32
x) -> Int32
x)
                            (Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11)

instance Read HandPoseTypeMSFT where
  readPrec :: ReadPrec HandPoseTypeMSFT
readPrec = String
-> [(HandPoseTypeMSFT, String)]
-> String
-> (Int32 -> HandPoseTypeMSFT)
-> ReadPrec HandPoseTypeMSFT
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec String
enumPrefixHandPoseTypeMSFT [(HandPoseTypeMSFT, String)]
showTableHandPoseTypeMSFT String
conNameHandPoseTypeMSFT Int32 -> HandPoseTypeMSFT
HandPoseTypeMSFT


type MSFT_hand_tracking_mesh_SPEC_VERSION = 2

-- No documentation found for TopLevel "XR_MSFT_hand_tracking_mesh_SPEC_VERSION"
pattern MSFT_hand_tracking_mesh_SPEC_VERSION :: forall a . Integral a => a
pattern $bMSFT_hand_tracking_mesh_SPEC_VERSION :: a
$mMSFT_hand_tracking_mesh_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
MSFT_hand_tracking_mesh_SPEC_VERSION = 2


type MSFT_HAND_TRACKING_MESH_EXTENSION_NAME = "XR_MSFT_hand_tracking_mesh"

-- No documentation found for TopLevel "XR_MSFT_HAND_TRACKING_MESH_EXTENSION_NAME"
pattern MSFT_HAND_TRACKING_MESH_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bMSFT_HAND_TRACKING_MESH_EXTENSION_NAME :: a
$mMSFT_HAND_TRACKING_MESH_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
MSFT_HAND_TRACKING_MESH_EXTENSION_NAME = "XR_MSFT_hand_tracking_mesh"