{-# OPTIONS -Wall #-}
{-# LANGUAGE DeriveAnyClass #-}

module Raylib.Types where

import Control.Monad (forM_, unless)
import Foreign
  ( FunPtr,
    Ptr,
    Storable (alignment, peek, peekByteOff, poke, pokeByteOff, sizeOf),
    Word16,
    Word8,
    castPtr,
    fromBool,
    malloc,
    callocBytes,
    newArray,
    newForeignPtr,
    nullFunPtr,
    nullPtr,
    peekArray,
    toBool,
    withForeignPtr,
  )
import Foreign.C
  ( CBool,
    CChar,
    CFloat,
    CInt (..),
    CShort,
    CString,
    CUChar,
    CUInt,
    CUShort,
    castCharToCChar,
    newCString,
    peekCString,
  )
import Foreign.C.String (castCCharToChar)
import Raylib.ForeignUtil (Freeable (rlFreeDependents), c'free, freeMaybePtr, newMaybeArray, p'free, peekMaybeArray, peekStaticArray, peekStaticArrayOff, pokeMaybeOff, pokeStaticArray, pokeStaticArrayOff, rightPad, rlFreeArray, rlFreeMaybeArray)
import Raylib.Internal (c'rlGetShaderIdDefault, getPixelDataSize)

------------------------------------------------

-- Raylib enumerations -------------------------

------------------------------------------------


---- raylib.h


data ConfigFlag
  = VsyncHint
  | FullscreenMode
  | WindowResizable
  | WindowUndecorated
  | WindowHidden
  | WindowMinimized
  | WindowMaximized
  | WindowUnfocused
  | WindowTopmost
  | WindowAlwaysRun
  | WindowTransparent
  | WindowHighdpi
  | WindowMousePassthrough
  | BorderlessWindowedMode
  | Msaa4xHint
  | InterlacedHint
  deriving (ConfigFlag -> ConfigFlag -> Bool
(ConfigFlag -> ConfigFlag -> Bool)
-> (ConfigFlag -> ConfigFlag -> Bool) -> Eq ConfigFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConfigFlag -> ConfigFlag -> Bool
== :: ConfigFlag -> ConfigFlag -> Bool
$c/= :: ConfigFlag -> ConfigFlag -> Bool
/= :: ConfigFlag -> ConfigFlag -> Bool
Eq, Int -> ConfigFlag -> ShowS
[ConfigFlag] -> ShowS
ConfigFlag -> String
(Int -> ConfigFlag -> ShowS)
-> (ConfigFlag -> String)
-> ([ConfigFlag] -> ShowS)
-> Show ConfigFlag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConfigFlag -> ShowS
showsPrec :: Int -> ConfigFlag -> ShowS
$cshow :: ConfigFlag -> String
show :: ConfigFlag -> String
$cshowList :: [ConfigFlag] -> ShowS
showList :: [ConfigFlag] -> ShowS
Show, ConfigFlag -> Ptr ConfigFlag -> IO ()
(ConfigFlag -> Ptr ConfigFlag -> IO ())
-> (ConfigFlag -> Ptr ConfigFlag -> IO ()) -> Freeable ConfigFlag
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: ConfigFlag -> Ptr ConfigFlag -> IO ()
rlFreeDependents :: ConfigFlag -> Ptr ConfigFlag -> IO ()
$crlFree :: ConfigFlag -> Ptr ConfigFlag -> IO ()
rlFree :: ConfigFlag -> Ptr ConfigFlag -> IO ()
Freeable)

instance Enum ConfigFlag where
  fromEnum :: ConfigFlag -> Int
fromEnum ConfigFlag
g = case ConfigFlag
g of
    ConfigFlag
VsyncHint -> Int
64
    ConfigFlag
FullscreenMode -> Int
2
    ConfigFlag
WindowResizable -> Int
4
    ConfigFlag
WindowUndecorated -> Int
8
    ConfigFlag
WindowHidden -> Int
128
    ConfigFlag
WindowMinimized -> Int
512
    ConfigFlag
WindowMaximized -> Int
1024
    ConfigFlag
WindowUnfocused -> Int
2048
    ConfigFlag
WindowTopmost -> Int
4096
    ConfigFlag
WindowAlwaysRun -> Int
256
    ConfigFlag
WindowTransparent -> Int
16
    ConfigFlag
WindowHighdpi -> Int
8192
    ConfigFlag
WindowMousePassthrough -> Int
16384
    ConfigFlag
BorderlessWindowedMode -> Int
32768
    ConfigFlag
Msaa4xHint -> Int
32
    ConfigFlag
InterlacedHint -> Int
65536
  toEnum :: Int -> ConfigFlag
toEnum Int
x = case Int
x of
    Int
64 -> ConfigFlag
VsyncHint
    Int
2 -> ConfigFlag
FullscreenMode
    Int
4 -> ConfigFlag
WindowResizable
    Int
8 -> ConfigFlag
WindowUndecorated
    Int
128 -> ConfigFlag
WindowHidden
    Int
512 -> ConfigFlag
WindowMinimized
    Int
1024 -> ConfigFlag
WindowMaximized
    Int
2048 -> ConfigFlag
WindowUnfocused
    Int
4096 -> ConfigFlag
WindowTopmost
    Int
256 -> ConfigFlag
WindowAlwaysRun
    Int
16 -> ConfigFlag
WindowTransparent
    Int
8192 -> ConfigFlag
WindowHighdpi
    Int
16384 -> ConfigFlag
WindowMousePassthrough
    Int
32768 -> ConfigFlag
BorderlessWindowedMode
    Int
32 -> ConfigFlag
Msaa4xHint
    Int
65536 -> ConfigFlag
InterlacedHint
    Int
n -> String -> ConfigFlag
forall a. HasCallStack => String -> a
error (String -> ConfigFlag) -> String -> ConfigFlag
forall a b. (a -> b) -> a -> b
$ String
"(ConfigFlag.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

data TraceLogLevel = LogAll | LogTrace | LogDebug | LogInfo | LogWarning | LogError | LogFatal | LogNone
  deriving (TraceLogLevel -> TraceLogLevel -> Bool
(TraceLogLevel -> TraceLogLevel -> Bool)
-> (TraceLogLevel -> TraceLogLevel -> Bool) -> Eq TraceLogLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TraceLogLevel -> TraceLogLevel -> Bool
== :: TraceLogLevel -> TraceLogLevel -> Bool
$c/= :: TraceLogLevel -> TraceLogLevel -> Bool
/= :: TraceLogLevel -> TraceLogLevel -> Bool
Eq, Int -> TraceLogLevel -> ShowS
[TraceLogLevel] -> ShowS
TraceLogLevel -> String
(Int -> TraceLogLevel -> ShowS)
-> (TraceLogLevel -> String)
-> ([TraceLogLevel] -> ShowS)
-> Show TraceLogLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TraceLogLevel -> ShowS
showsPrec :: Int -> TraceLogLevel -> ShowS
$cshow :: TraceLogLevel -> String
show :: TraceLogLevel -> String
$cshowList :: [TraceLogLevel] -> ShowS
showList :: [TraceLogLevel] -> ShowS
Show, Int -> TraceLogLevel
TraceLogLevel -> Int
TraceLogLevel -> [TraceLogLevel]
TraceLogLevel -> TraceLogLevel
TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
TraceLogLevel -> TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
(TraceLogLevel -> TraceLogLevel)
-> (TraceLogLevel -> TraceLogLevel)
-> (Int -> TraceLogLevel)
-> (TraceLogLevel -> Int)
-> (TraceLogLevel -> [TraceLogLevel])
-> (TraceLogLevel -> TraceLogLevel -> [TraceLogLevel])
-> (TraceLogLevel -> TraceLogLevel -> [TraceLogLevel])
-> (TraceLogLevel
    -> TraceLogLevel -> TraceLogLevel -> [TraceLogLevel])
-> Enum TraceLogLevel
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TraceLogLevel -> TraceLogLevel
succ :: TraceLogLevel -> TraceLogLevel
$cpred :: TraceLogLevel -> TraceLogLevel
pred :: TraceLogLevel -> TraceLogLevel
$ctoEnum :: Int -> TraceLogLevel
toEnum :: Int -> TraceLogLevel
$cfromEnum :: TraceLogLevel -> Int
fromEnum :: TraceLogLevel -> Int
$cenumFrom :: TraceLogLevel -> [TraceLogLevel]
enumFrom :: TraceLogLevel -> [TraceLogLevel]
$cenumFromThen :: TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
enumFromThen :: TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
$cenumFromTo :: TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
enumFromTo :: TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
$cenumFromThenTo :: TraceLogLevel -> TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
enumFromThenTo :: TraceLogLevel -> TraceLogLevel -> TraceLogLevel -> [TraceLogLevel]
Enum)

data KeyboardKey
  = KeyNull
  | KeyApostrophe
  | KeyComma
  | KeyMinus
  | KeyPeriod
  | KeySlash
  | KeyZero
  | KeyOne
  | KeyTwo
  | KeyThree
  | KeyFour
  | KeyFive
  | KeySix
  | KeySeven
  | KeyEight
  | KeyNine
  | KeySemicolon
  | KeyEqual
  | KeyA
  | KeyB
  | KeyC
  | KeyD
  | KeyE
  | KeyF
  | KeyG
  | KeyH
  | KeyI
  | KeyJ
  | KeyK
  | KeyL
  | KeyM
  | KeyN
  | KeyO
  | KeyP
  | KeyQ
  | KeyR
  | KeyS
  | KeyT
  | KeyU
  | KeyV
  | KeyW
  | KeyX
  | KeyY
  | KeyZ
  | KeyLeftBracket
  | KeyBackslash
  | KeyRightBracket
  | KeyGrave
  | KeySpace
  | KeyEscape
  | KeyEnter
  | KeyTab
  | KeyBackspace
  | KeyInsert
  | KeyDelete
  | KeyRight
  | KeyLeft
  | KeyDown
  | KeyUp
  | KeyPageUp
  | KeyPageDown
  | KeyHome
  | KeyEnd
  | KeyCapsLock
  | KeyScrollLock
  | KeyNumLock
  | KeyPrintScreen
  | KeyPause
  | KeyF1
  | KeyF2
  | KeyF3
  | KeyF4
  | KeyF5
  | KeyF6
  | KeyF7
  | KeyF8
  | KeyF9
  | KeyF10
  | KeyF11
  | KeyF12
  | KeyLeftShift
  | KeyLeftControl
  | KeyLeftAlt
  | KeyLeftSuper
  | KeyRightShift
  | KeyRightControl
  | KeyRightAlt
  | KeyRightSuper
  | KeyKbMenu
  | KeyKp0
  | KeyKp1
  | KeyKp2
  | KeyKp3
  | KeyKp4
  | KeyKp5
  | KeyKp6
  | KeyKp7
  | KeyKp8
  | KeyKp9
  | KeyKpDecimal
  | KeyKpDivide
  | KeyKpMultiply
  | KeyKpSubtract
  | KeyKpAdd
  | KeyKpEnter
  | KeyKpEqual
  | KeyBack
  | KeyMenu
  | KeyVolumeUp
  | KeyVolumeDown
  deriving (KeyboardKey -> KeyboardKey -> Bool
(KeyboardKey -> KeyboardKey -> Bool)
-> (KeyboardKey -> KeyboardKey -> Bool) -> Eq KeyboardKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: KeyboardKey -> KeyboardKey -> Bool
== :: KeyboardKey -> KeyboardKey -> Bool
$c/= :: KeyboardKey -> KeyboardKey -> Bool
/= :: KeyboardKey -> KeyboardKey -> Bool
Eq, Int -> KeyboardKey -> ShowS
[KeyboardKey] -> ShowS
KeyboardKey -> String
(Int -> KeyboardKey -> ShowS)
-> (KeyboardKey -> String)
-> ([KeyboardKey] -> ShowS)
-> Show KeyboardKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> KeyboardKey -> ShowS
showsPrec :: Int -> KeyboardKey -> ShowS
$cshow :: KeyboardKey -> String
show :: KeyboardKey -> String
$cshowList :: [KeyboardKey] -> ShowS
showList :: [KeyboardKey] -> ShowS
Show)

instance Enum KeyboardKey where
  fromEnum :: KeyboardKey -> Int
fromEnum KeyboardKey
k = case KeyboardKey
k of
    KeyboardKey
KeyNull -> Int
0
    KeyboardKey
KeyApostrophe -> Int
39
    KeyboardKey
KeyComma -> Int
44
    KeyboardKey
KeyMinus -> Int
45
    KeyboardKey
KeyPeriod -> Int
46
    KeyboardKey
KeySlash -> Int
47
    KeyboardKey
KeyZero -> Int
48
    KeyboardKey
KeyOne -> Int
49
    KeyboardKey
KeyTwo -> Int
50
    KeyboardKey
KeyThree -> Int
51
    KeyboardKey
KeyFour -> Int
52
    KeyboardKey
KeyFive -> Int
53
    KeyboardKey
KeySix -> Int
54
    KeyboardKey
KeySeven -> Int
55
    KeyboardKey
KeyEight -> Int
56
    KeyboardKey
KeyNine -> Int
57
    KeyboardKey
KeySemicolon -> Int
59
    KeyboardKey
KeyEqual -> Int
61
    KeyboardKey
KeyA -> Int
65
    KeyboardKey
KeyB -> Int
66
    KeyboardKey
KeyC -> Int
67
    KeyboardKey
KeyD -> Int
68
    KeyboardKey
KeyE -> Int
69
    KeyboardKey
KeyF -> Int
70
    KeyboardKey
KeyG -> Int
71
    KeyboardKey
KeyH -> Int
72
    KeyboardKey
KeyI -> Int
73
    KeyboardKey
KeyJ -> Int
74
    KeyboardKey
KeyK -> Int
75
    KeyboardKey
KeyL -> Int
76
    KeyboardKey
KeyM -> Int
77
    KeyboardKey
KeyN -> Int
78
    KeyboardKey
KeyO -> Int
79
    KeyboardKey
KeyP -> Int
80
    KeyboardKey
KeyQ -> Int
81
    KeyboardKey
KeyR -> Int
82
    KeyboardKey
KeyS -> Int
83
    KeyboardKey
KeyT -> Int
84
    KeyboardKey
KeyU -> Int
85
    KeyboardKey
KeyV -> Int
86
    KeyboardKey
KeyW -> Int
87
    KeyboardKey
KeyX -> Int
88
    KeyboardKey
KeyY -> Int
89
    KeyboardKey
KeyZ -> Int
90
    KeyboardKey
KeyLeftBracket -> Int
91
    KeyboardKey
KeyBackslash -> Int
92
    KeyboardKey
KeyRightBracket -> Int
93
    KeyboardKey
KeyGrave -> Int
96
    KeyboardKey
KeySpace -> Int
32
    KeyboardKey
KeyEscape -> Int
256
    KeyboardKey
KeyEnter -> Int
257
    KeyboardKey
KeyTab -> Int
258
    KeyboardKey
KeyBackspace -> Int
259
    KeyboardKey
KeyInsert -> Int
260
    KeyboardKey
KeyDelete -> Int
261
    KeyboardKey
KeyRight -> Int
262
    KeyboardKey
KeyLeft -> Int
263
    KeyboardKey
KeyDown -> Int
264
    KeyboardKey
KeyUp -> Int
265
    KeyboardKey
KeyPageUp -> Int
266
    KeyboardKey
KeyPageDown -> Int
267
    KeyboardKey
KeyHome -> Int
268
    KeyboardKey
KeyEnd -> Int
269
    KeyboardKey
KeyCapsLock -> Int
280
    KeyboardKey
KeyScrollLock -> Int
281
    KeyboardKey
KeyNumLock -> Int
282
    KeyboardKey
KeyPrintScreen -> Int
283
    KeyboardKey
KeyPause -> Int
284
    KeyboardKey
KeyF1 -> Int
290
    KeyboardKey
KeyF2 -> Int
291
    KeyboardKey
KeyF3 -> Int
292
    KeyboardKey
KeyF4 -> Int
293
    KeyboardKey
KeyF5 -> Int
294
    KeyboardKey
KeyF6 -> Int
295
    KeyboardKey
KeyF7 -> Int
296
    KeyboardKey
KeyF8 -> Int
297
    KeyboardKey
KeyF9 -> Int
298
    KeyboardKey
KeyF10 -> Int
299
    KeyboardKey
KeyF11 -> Int
300
    KeyboardKey
KeyF12 -> Int
301
    KeyboardKey
KeyLeftShift -> Int
340
    KeyboardKey
KeyLeftControl -> Int
341
    KeyboardKey
KeyLeftAlt -> Int
342
    KeyboardKey
KeyLeftSuper -> Int
343
    KeyboardKey
KeyRightShift -> Int
344
    KeyboardKey
KeyRightControl -> Int
345
    KeyboardKey
KeyRightAlt -> Int
346
    KeyboardKey
KeyRightSuper -> Int
347
    KeyboardKey
KeyKbMenu -> Int
348
    KeyboardKey
KeyKp0 -> Int
320
    KeyboardKey
KeyKp1 -> Int
321
    KeyboardKey
KeyKp2 -> Int
322
    KeyboardKey
KeyKp3 -> Int
323
    KeyboardKey
KeyKp4 -> Int
324
    KeyboardKey
KeyKp5 -> Int
325
    KeyboardKey
KeyKp6 -> Int
326
    KeyboardKey
KeyKp7 -> Int
327
    KeyboardKey
KeyKp8 -> Int
328
    KeyboardKey
KeyKp9 -> Int
329
    KeyboardKey
KeyKpDecimal -> Int
330
    KeyboardKey
KeyKpDivide -> Int
331
    KeyboardKey
KeyKpMultiply -> Int
332
    KeyboardKey
KeyKpSubtract -> Int
333
    KeyboardKey
KeyKpAdd -> Int
334
    KeyboardKey
KeyKpEnter -> Int
335
    KeyboardKey
KeyKpEqual -> Int
336
    -- Android buttons

    KeyboardKey
KeyBack -> Int
4
    KeyboardKey
KeyMenu -> Int
82
    KeyboardKey
KeyVolumeUp -> Int
24
    KeyboardKey
KeyVolumeDown -> Int
25

  toEnum :: Int -> KeyboardKey
toEnum Int
n = case Int
n of
    Int
0 -> KeyboardKey
KeyNull
    Int
39 -> KeyboardKey
KeyApostrophe
    Int
44 -> KeyboardKey
KeyComma
    Int
45 -> KeyboardKey
KeyMinus
    Int
46 -> KeyboardKey
KeyPeriod
    Int
47 -> KeyboardKey
KeySlash
    Int
48 -> KeyboardKey
KeyZero
    Int
49 -> KeyboardKey
KeyOne
    Int
50 -> KeyboardKey
KeyTwo
    Int
51 -> KeyboardKey
KeyThree
    Int
52 -> KeyboardKey
KeyFour
    Int
53 -> KeyboardKey
KeyFive
    Int
54 -> KeyboardKey
KeySix
    Int
55 -> KeyboardKey
KeySeven
    Int
56 -> KeyboardKey
KeyEight
    Int
57 -> KeyboardKey
KeyNine
    Int
59 -> KeyboardKey
KeySemicolon
    Int
61 -> KeyboardKey
KeyEqual
    Int
65 -> KeyboardKey
KeyA
    Int
66 -> KeyboardKey
KeyB
    Int
67 -> KeyboardKey
KeyC
    Int
68 -> KeyboardKey
KeyD
    Int
69 -> KeyboardKey
KeyE
    Int
70 -> KeyboardKey
KeyF
    Int
71 -> KeyboardKey
KeyG
    Int
72 -> KeyboardKey
KeyH
    Int
73 -> KeyboardKey
KeyI
    Int
74 -> KeyboardKey
KeyJ
    Int
75 -> KeyboardKey
KeyK
    Int
76 -> KeyboardKey
KeyL
    Int
77 -> KeyboardKey
KeyM
    Int
78 -> KeyboardKey
KeyN
    Int
79 -> KeyboardKey
KeyO
    Int
80 -> KeyboardKey
KeyP
    Int
81 -> KeyboardKey
KeyQ
    Int
82 -> KeyboardKey
KeyR
    Int
83 -> KeyboardKey
KeyS
    Int
84 -> KeyboardKey
KeyT
    Int
85 -> KeyboardKey
KeyU
    Int
86 -> KeyboardKey
KeyV
    Int
87 -> KeyboardKey
KeyW
    Int
88 -> KeyboardKey
KeyX
    Int
89 -> KeyboardKey
KeyY
    Int
90 -> KeyboardKey
KeyZ
    Int
91 -> KeyboardKey
KeyLeftBracket
    Int
92 -> KeyboardKey
KeyBackslash
    Int
93 -> KeyboardKey
KeyRightBracket
    Int
96 -> KeyboardKey
KeyGrave
    Int
32 -> KeyboardKey
KeySpace
    Int
256 -> KeyboardKey
KeyEscape
    Int
257 -> KeyboardKey
KeyEnter
    Int
258 -> KeyboardKey
KeyTab
    Int
259 -> KeyboardKey
KeyBackspace
    Int
260 -> KeyboardKey
KeyInsert
    Int
261 -> KeyboardKey
KeyDelete
    Int
262 -> KeyboardKey
KeyRight
    Int
263 -> KeyboardKey
KeyLeft
    Int
264 -> KeyboardKey
KeyDown
    Int
265 -> KeyboardKey
KeyUp
    Int
266 -> KeyboardKey
KeyPageUp
    Int
267 -> KeyboardKey
KeyPageDown
    Int
268 -> KeyboardKey
KeyHome
    Int
269 -> KeyboardKey
KeyEnd
    Int
280 -> KeyboardKey
KeyCapsLock
    Int
281 -> KeyboardKey
KeyScrollLock
    Int
282 -> KeyboardKey
KeyNumLock
    Int
283 -> KeyboardKey
KeyPrintScreen
    Int
284 -> KeyboardKey
KeyPause
    Int
290 -> KeyboardKey
KeyF1
    Int
291 -> KeyboardKey
KeyF2
    Int
292 -> KeyboardKey
KeyF3
    Int
293 -> KeyboardKey
KeyF4
    Int
294 -> KeyboardKey
KeyF5
    Int
295 -> KeyboardKey
KeyF6
    Int
296 -> KeyboardKey
KeyF7
    Int
297 -> KeyboardKey
KeyF8
    Int
298 -> KeyboardKey
KeyF9
    Int
299 -> KeyboardKey
KeyF10
    Int
300 -> KeyboardKey
KeyF11
    Int
301 -> KeyboardKey
KeyF12
    Int
340 -> KeyboardKey
KeyLeftShift
    Int
341 -> KeyboardKey
KeyLeftControl
    Int
342 -> KeyboardKey
KeyLeftAlt
    Int
343 -> KeyboardKey
KeyLeftSuper
    Int
344 -> KeyboardKey
KeyRightShift
    Int
345 -> KeyboardKey
KeyRightControl
    Int
346 -> KeyboardKey
KeyRightAlt
    Int
347 -> KeyboardKey
KeyRightSuper
    Int
348 -> KeyboardKey
KeyKbMenu
    Int
320 -> KeyboardKey
KeyKp0
    Int
321 -> KeyboardKey
KeyKp1
    Int
322 -> KeyboardKey
KeyKp2
    Int
323 -> KeyboardKey
KeyKp3
    Int
324 -> KeyboardKey
KeyKp4
    Int
325 -> KeyboardKey
KeyKp5
    Int
326 -> KeyboardKey
KeyKp6
    Int
327 -> KeyboardKey
KeyKp7
    Int
328 -> KeyboardKey
KeyKp8
    Int
329 -> KeyboardKey
KeyKp9
    Int
330 -> KeyboardKey
KeyKpDecimal
    Int
331 -> KeyboardKey
KeyKpDivide
    Int
332 -> KeyboardKey
KeyKpMultiply
    Int
333 -> KeyboardKey
KeyKpSubtract
    Int
334 -> KeyboardKey
KeyKpAdd
    Int
335 -> KeyboardKey
KeyKpEnter
    Int
336 -> KeyboardKey
KeyKpEqual
    -- Android buttons

    Int
4 -> KeyboardKey
KeyBack
    --  82  -> KeyMenu

    Int
24 -> KeyboardKey
KeyVolumeUp
    Int
25 -> KeyboardKey
KeyVolumeDown
    Int
x -> String -> KeyboardKey
forall a. HasCallStack => String -> a
error (String -> KeyboardKey) -> String -> KeyboardKey
forall a b. (a -> b) -> a -> b
$ String
"(KeyboardKey.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
x

data MouseButton
  = MouseButtonLeft
  | MouseButtonRight
  | MouseButtonMiddle
  | MouseButtonSide
  | MouseButtonExtra
  | MouseButtonForward
  | MouseButtonBack
  deriving (MouseButton -> MouseButton -> Bool
(MouseButton -> MouseButton -> Bool)
-> (MouseButton -> MouseButton -> Bool) -> Eq MouseButton
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MouseButton -> MouseButton -> Bool
== :: MouseButton -> MouseButton -> Bool
$c/= :: MouseButton -> MouseButton -> Bool
/= :: MouseButton -> MouseButton -> Bool
Eq, Int -> MouseButton -> ShowS
[MouseButton] -> ShowS
MouseButton -> String
(Int -> MouseButton -> ShowS)
-> (MouseButton -> String)
-> ([MouseButton] -> ShowS)
-> Show MouseButton
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MouseButton -> ShowS
showsPrec :: Int -> MouseButton -> ShowS
$cshow :: MouseButton -> String
show :: MouseButton -> String
$cshowList :: [MouseButton] -> ShowS
showList :: [MouseButton] -> ShowS
Show, Int -> MouseButton
MouseButton -> Int
MouseButton -> [MouseButton]
MouseButton -> MouseButton
MouseButton -> MouseButton -> [MouseButton]
MouseButton -> MouseButton -> MouseButton -> [MouseButton]
(MouseButton -> MouseButton)
-> (MouseButton -> MouseButton)
-> (Int -> MouseButton)
-> (MouseButton -> Int)
-> (MouseButton -> [MouseButton])
-> (MouseButton -> MouseButton -> [MouseButton])
-> (MouseButton -> MouseButton -> [MouseButton])
-> (MouseButton -> MouseButton -> MouseButton -> [MouseButton])
-> Enum MouseButton
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: MouseButton -> MouseButton
succ :: MouseButton -> MouseButton
$cpred :: MouseButton -> MouseButton
pred :: MouseButton -> MouseButton
$ctoEnum :: Int -> MouseButton
toEnum :: Int -> MouseButton
$cfromEnum :: MouseButton -> Int
fromEnum :: MouseButton -> Int
$cenumFrom :: MouseButton -> [MouseButton]
enumFrom :: MouseButton -> [MouseButton]
$cenumFromThen :: MouseButton -> MouseButton -> [MouseButton]
enumFromThen :: MouseButton -> MouseButton -> [MouseButton]
$cenumFromTo :: MouseButton -> MouseButton -> [MouseButton]
enumFromTo :: MouseButton -> MouseButton -> [MouseButton]
$cenumFromThenTo :: MouseButton -> MouseButton -> MouseButton -> [MouseButton]
enumFromThenTo :: MouseButton -> MouseButton -> MouseButton -> [MouseButton]
Enum, MouseButton
MouseButton -> MouseButton -> Bounded MouseButton
forall a. a -> a -> Bounded a
$cminBound :: MouseButton
minBound :: MouseButton
$cmaxBound :: MouseButton
maxBound :: MouseButton
Bounded)

data MouseCursor
  = MouseCursorDefault
  | MouseCursorArrow
  | MouseCursorIbeam
  | MouseCursorCrosshair
  | MouseCursorPointingHand
  | MouseCursorResizeEW
  | MouseCursorResizeNS
  | MouseCursorResizeNWSE
  | MouseCursorResizeNESW
  | MouseCursorResizeAll
  | MouseCursorNotAllowed
  deriving (MouseCursor -> MouseCursor -> Bool
(MouseCursor -> MouseCursor -> Bool)
-> (MouseCursor -> MouseCursor -> Bool) -> Eq MouseCursor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MouseCursor -> MouseCursor -> Bool
== :: MouseCursor -> MouseCursor -> Bool
$c/= :: MouseCursor -> MouseCursor -> Bool
/= :: MouseCursor -> MouseCursor -> Bool
Eq, Int -> MouseCursor -> ShowS
[MouseCursor] -> ShowS
MouseCursor -> String
(Int -> MouseCursor -> ShowS)
-> (MouseCursor -> String)
-> ([MouseCursor] -> ShowS)
-> Show MouseCursor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MouseCursor -> ShowS
showsPrec :: Int -> MouseCursor -> ShowS
$cshow :: MouseCursor -> String
show :: MouseCursor -> String
$cshowList :: [MouseCursor] -> ShowS
showList :: [MouseCursor] -> ShowS
Show, Int -> MouseCursor
MouseCursor -> Int
MouseCursor -> [MouseCursor]
MouseCursor -> MouseCursor
MouseCursor -> MouseCursor -> [MouseCursor]
MouseCursor -> MouseCursor -> MouseCursor -> [MouseCursor]
(MouseCursor -> MouseCursor)
-> (MouseCursor -> MouseCursor)
-> (Int -> MouseCursor)
-> (MouseCursor -> Int)
-> (MouseCursor -> [MouseCursor])
-> (MouseCursor -> MouseCursor -> [MouseCursor])
-> (MouseCursor -> MouseCursor -> [MouseCursor])
-> (MouseCursor -> MouseCursor -> MouseCursor -> [MouseCursor])
-> Enum MouseCursor
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: MouseCursor -> MouseCursor
succ :: MouseCursor -> MouseCursor
$cpred :: MouseCursor -> MouseCursor
pred :: MouseCursor -> MouseCursor
$ctoEnum :: Int -> MouseCursor
toEnum :: Int -> MouseCursor
$cfromEnum :: MouseCursor -> Int
fromEnum :: MouseCursor -> Int
$cenumFrom :: MouseCursor -> [MouseCursor]
enumFrom :: MouseCursor -> [MouseCursor]
$cenumFromThen :: MouseCursor -> MouseCursor -> [MouseCursor]
enumFromThen :: MouseCursor -> MouseCursor -> [MouseCursor]
$cenumFromTo :: MouseCursor -> MouseCursor -> [MouseCursor]
enumFromTo :: MouseCursor -> MouseCursor -> [MouseCursor]
$cenumFromThenTo :: MouseCursor -> MouseCursor -> MouseCursor -> [MouseCursor]
enumFromThenTo :: MouseCursor -> MouseCursor -> MouseCursor -> [MouseCursor]
Enum, MouseCursor
MouseCursor -> MouseCursor -> Bounded MouseCursor
forall a. a -> a -> Bounded a
$cminBound :: MouseCursor
minBound :: MouseCursor
$cmaxBound :: MouseCursor
maxBound :: MouseCursor
Bounded)

data GamepadButton
  = GamepadButtonUnknown
  | GamepadButtonUnknownLeftFaceUp
  | GamepadButtonLeftFaceRight
  | GamepadButtonLeftFaceDown
  | GamepadButtonLeftFaceLeft
  | GamepadButtonRightFaceUp
  | GamepadButtonRightFaceRight
  | GamepadButtonRightFaceDown
  | GamepadButtonRightFaceLeft
  | GamepadButtonLeftTrigger1
  | GamepadButtonLeftTrigger2
  | GamepadButtonRightTrigger1
  | GamepadButtonRightTrigger2
  | GamepadButtonMiddleLeft
  | GamepadButtonMiddle
  | GamepadButtonMiddleRight
  | GamepadButtonLeftThumb
  | GamepadButtonRightThumb
  deriving (GamepadButton -> GamepadButton -> Bool
(GamepadButton -> GamepadButton -> Bool)
-> (GamepadButton -> GamepadButton -> Bool) -> Eq GamepadButton
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GamepadButton -> GamepadButton -> Bool
== :: GamepadButton -> GamepadButton -> Bool
$c/= :: GamepadButton -> GamepadButton -> Bool
/= :: GamepadButton -> GamepadButton -> Bool
Eq, Int -> GamepadButton -> ShowS
[GamepadButton] -> ShowS
GamepadButton -> String
(Int -> GamepadButton -> ShowS)
-> (GamepadButton -> String)
-> ([GamepadButton] -> ShowS)
-> Show GamepadButton
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GamepadButton -> ShowS
showsPrec :: Int -> GamepadButton -> ShowS
$cshow :: GamepadButton -> String
show :: GamepadButton -> String
$cshowList :: [GamepadButton] -> ShowS
showList :: [GamepadButton] -> ShowS
Show, Int -> GamepadButton
GamepadButton -> Int
GamepadButton -> [GamepadButton]
GamepadButton -> GamepadButton
GamepadButton -> GamepadButton -> [GamepadButton]
GamepadButton -> GamepadButton -> GamepadButton -> [GamepadButton]
(GamepadButton -> GamepadButton)
-> (GamepadButton -> GamepadButton)
-> (Int -> GamepadButton)
-> (GamepadButton -> Int)
-> (GamepadButton -> [GamepadButton])
-> (GamepadButton -> GamepadButton -> [GamepadButton])
-> (GamepadButton -> GamepadButton -> [GamepadButton])
-> (GamepadButton
    -> GamepadButton -> GamepadButton -> [GamepadButton])
-> Enum GamepadButton
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: GamepadButton -> GamepadButton
succ :: GamepadButton -> GamepadButton
$cpred :: GamepadButton -> GamepadButton
pred :: GamepadButton -> GamepadButton
$ctoEnum :: Int -> GamepadButton
toEnum :: Int -> GamepadButton
$cfromEnum :: GamepadButton -> Int
fromEnum :: GamepadButton -> Int
$cenumFrom :: GamepadButton -> [GamepadButton]
enumFrom :: GamepadButton -> [GamepadButton]
$cenumFromThen :: GamepadButton -> GamepadButton -> [GamepadButton]
enumFromThen :: GamepadButton -> GamepadButton -> [GamepadButton]
$cenumFromTo :: GamepadButton -> GamepadButton -> [GamepadButton]
enumFromTo :: GamepadButton -> GamepadButton -> [GamepadButton]
$cenumFromThenTo :: GamepadButton -> GamepadButton -> GamepadButton -> [GamepadButton]
enumFromThenTo :: GamepadButton -> GamepadButton -> GamepadButton -> [GamepadButton]
Enum, GamepadButton
GamepadButton -> GamepadButton -> Bounded GamepadButton
forall a. a -> a -> Bounded a
$cminBound :: GamepadButton
minBound :: GamepadButton
$cmaxBound :: GamepadButton
maxBound :: GamepadButton
Bounded)

data GamepadAxis
  = GamepadAxisLeftX
  | GamepadAxisLeftY
  | GamepadAxisRightX
  | GamepadAxisRightY
  | GamepadAxisLeftTrigger
  | GamepadAxisRightTrigger
  deriving (GamepadAxis -> GamepadAxis -> Bool
(GamepadAxis -> GamepadAxis -> Bool)
-> (GamepadAxis -> GamepadAxis -> Bool) -> Eq GamepadAxis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GamepadAxis -> GamepadAxis -> Bool
== :: GamepadAxis -> GamepadAxis -> Bool
$c/= :: GamepadAxis -> GamepadAxis -> Bool
/= :: GamepadAxis -> GamepadAxis -> Bool
Eq, Int -> GamepadAxis -> ShowS
[GamepadAxis] -> ShowS
GamepadAxis -> String
(Int -> GamepadAxis -> ShowS)
-> (GamepadAxis -> String)
-> ([GamepadAxis] -> ShowS)
-> Show GamepadAxis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GamepadAxis -> ShowS
showsPrec :: Int -> GamepadAxis -> ShowS
$cshow :: GamepadAxis -> String
show :: GamepadAxis -> String
$cshowList :: [GamepadAxis] -> ShowS
showList :: [GamepadAxis] -> ShowS
Show, Int -> GamepadAxis
GamepadAxis -> Int
GamepadAxis -> [GamepadAxis]
GamepadAxis -> GamepadAxis
GamepadAxis -> GamepadAxis -> [GamepadAxis]
GamepadAxis -> GamepadAxis -> GamepadAxis -> [GamepadAxis]
(GamepadAxis -> GamepadAxis)
-> (GamepadAxis -> GamepadAxis)
-> (Int -> GamepadAxis)
-> (GamepadAxis -> Int)
-> (GamepadAxis -> [GamepadAxis])
-> (GamepadAxis -> GamepadAxis -> [GamepadAxis])
-> (GamepadAxis -> GamepadAxis -> [GamepadAxis])
-> (GamepadAxis -> GamepadAxis -> GamepadAxis -> [GamepadAxis])
-> Enum GamepadAxis
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: GamepadAxis -> GamepadAxis
succ :: GamepadAxis -> GamepadAxis
$cpred :: GamepadAxis -> GamepadAxis
pred :: GamepadAxis -> GamepadAxis
$ctoEnum :: Int -> GamepadAxis
toEnum :: Int -> GamepadAxis
$cfromEnum :: GamepadAxis -> Int
fromEnum :: GamepadAxis -> Int
$cenumFrom :: GamepadAxis -> [GamepadAxis]
enumFrom :: GamepadAxis -> [GamepadAxis]
$cenumFromThen :: GamepadAxis -> GamepadAxis -> [GamepadAxis]
enumFromThen :: GamepadAxis -> GamepadAxis -> [GamepadAxis]
$cenumFromTo :: GamepadAxis -> GamepadAxis -> [GamepadAxis]
enumFromTo :: GamepadAxis -> GamepadAxis -> [GamepadAxis]
$cenumFromThenTo :: GamepadAxis -> GamepadAxis -> GamepadAxis -> [GamepadAxis]
enumFromThenTo :: GamepadAxis -> GamepadAxis -> GamepadAxis -> [GamepadAxis]
Enum, GamepadAxis
GamepadAxis -> GamepadAxis -> Bounded GamepadAxis
forall a. a -> a -> Bounded a
$cminBound :: GamepadAxis
minBound :: GamepadAxis
$cmaxBound :: GamepadAxis
maxBound :: GamepadAxis
Bounded)

data MaterialMapIndex
  = MaterialMapAlbedo
  | MaterialMapMetalness
  | MaterialMapNormal
  | MaterialMapRoughness
  | MaterialMapOcclusion
  | MaterialMapEmission
  | MaterialMapHeight
  | MaterialMapCubemap
  | MaterialMapIrradiance
  | MaterialMapPrefilter
  | MaterialMapBrdf
  deriving (MaterialMapIndex -> MaterialMapIndex -> Bool
(MaterialMapIndex -> MaterialMapIndex -> Bool)
-> (MaterialMapIndex -> MaterialMapIndex -> Bool)
-> Eq MaterialMapIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MaterialMapIndex -> MaterialMapIndex -> Bool
== :: MaterialMapIndex -> MaterialMapIndex -> Bool
$c/= :: MaterialMapIndex -> MaterialMapIndex -> Bool
/= :: MaterialMapIndex -> MaterialMapIndex -> Bool
Eq, Int -> MaterialMapIndex -> ShowS
[MaterialMapIndex] -> ShowS
MaterialMapIndex -> String
(Int -> MaterialMapIndex -> ShowS)
-> (MaterialMapIndex -> String)
-> ([MaterialMapIndex] -> ShowS)
-> Show MaterialMapIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MaterialMapIndex -> ShowS
showsPrec :: Int -> MaterialMapIndex -> ShowS
$cshow :: MaterialMapIndex -> String
show :: MaterialMapIndex -> String
$cshowList :: [MaterialMapIndex] -> ShowS
showList :: [MaterialMapIndex] -> ShowS
Show, Int -> MaterialMapIndex
MaterialMapIndex -> Int
MaterialMapIndex -> [MaterialMapIndex]
MaterialMapIndex -> MaterialMapIndex
MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
MaterialMapIndex
-> MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
(MaterialMapIndex -> MaterialMapIndex)
-> (MaterialMapIndex -> MaterialMapIndex)
-> (Int -> MaterialMapIndex)
-> (MaterialMapIndex -> Int)
-> (MaterialMapIndex -> [MaterialMapIndex])
-> (MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex])
-> (MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex])
-> (MaterialMapIndex
    -> MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex])
-> Enum MaterialMapIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: MaterialMapIndex -> MaterialMapIndex
succ :: MaterialMapIndex -> MaterialMapIndex
$cpred :: MaterialMapIndex -> MaterialMapIndex
pred :: MaterialMapIndex -> MaterialMapIndex
$ctoEnum :: Int -> MaterialMapIndex
toEnum :: Int -> MaterialMapIndex
$cfromEnum :: MaterialMapIndex -> Int
fromEnum :: MaterialMapIndex -> Int
$cenumFrom :: MaterialMapIndex -> [MaterialMapIndex]
enumFrom :: MaterialMapIndex -> [MaterialMapIndex]
$cenumFromThen :: MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
enumFromThen :: MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
$cenumFromTo :: MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
enumFromTo :: MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
$cenumFromThenTo :: MaterialMapIndex
-> MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
enumFromThenTo :: MaterialMapIndex
-> MaterialMapIndex -> MaterialMapIndex -> [MaterialMapIndex]
Enum)

data ShaderLocationIndex
  = ShaderLocVertexPosition
  | ShaderLocVertexTexcoord01
  | ShaderLocVertexTexcoord02
  | ShaderLocVertexNormal
  | ShaderLocVertexTangent
  | ShaderLocVertexColor
  | ShaderLocMatrixMvp
  | ShaderLocMatrixView
  | ShaderLocMatrixProjection
  | ShaderLocMatrixModel
  | ShaderLocMatrixNormal
  | ShaderLocVectorView
  | ShaderLocColorDiffuse
  | ShaderLocColorSpecular
  | ShaderLocColorAmbient
  | ShaderLocMapAlbedo
  | ShaderLocMapMetalness
  | ShaderLocMapNormal
  | ShaderLocMapRoughness
  | ShaderLocMapOcclusion
  | ShaderLocMapEmission
  | ShaderLocMapHeight
  | ShaderLocMapCubemap
  | ShaderLocMapIrradiance
  | ShaderLocMapPrefilter
  | ShaderLocMapBrdf
  deriving (ShaderLocationIndex -> ShaderLocationIndex -> Bool
(ShaderLocationIndex -> ShaderLocationIndex -> Bool)
-> (ShaderLocationIndex -> ShaderLocationIndex -> Bool)
-> Eq ShaderLocationIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShaderLocationIndex -> ShaderLocationIndex -> Bool
== :: ShaderLocationIndex -> ShaderLocationIndex -> Bool
$c/= :: ShaderLocationIndex -> ShaderLocationIndex -> Bool
/= :: ShaderLocationIndex -> ShaderLocationIndex -> Bool
Eq, Int -> ShaderLocationIndex -> ShowS
[ShaderLocationIndex] -> ShowS
ShaderLocationIndex -> String
(Int -> ShaderLocationIndex -> ShowS)
-> (ShaderLocationIndex -> String)
-> ([ShaderLocationIndex] -> ShowS)
-> Show ShaderLocationIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShaderLocationIndex -> ShowS
showsPrec :: Int -> ShaderLocationIndex -> ShowS
$cshow :: ShaderLocationIndex -> String
show :: ShaderLocationIndex -> String
$cshowList :: [ShaderLocationIndex] -> ShowS
showList :: [ShaderLocationIndex] -> ShowS
Show, Int -> ShaderLocationIndex
ShaderLocationIndex -> Int
ShaderLocationIndex -> [ShaderLocationIndex]
ShaderLocationIndex -> ShaderLocationIndex
ShaderLocationIndex -> ShaderLocationIndex -> [ShaderLocationIndex]
ShaderLocationIndex
-> ShaderLocationIndex
-> ShaderLocationIndex
-> [ShaderLocationIndex]
(ShaderLocationIndex -> ShaderLocationIndex)
-> (ShaderLocationIndex -> ShaderLocationIndex)
-> (Int -> ShaderLocationIndex)
-> (ShaderLocationIndex -> Int)
-> (ShaderLocationIndex -> [ShaderLocationIndex])
-> (ShaderLocationIndex
    -> ShaderLocationIndex -> [ShaderLocationIndex])
-> (ShaderLocationIndex
    -> ShaderLocationIndex -> [ShaderLocationIndex])
-> (ShaderLocationIndex
    -> ShaderLocationIndex
    -> ShaderLocationIndex
    -> [ShaderLocationIndex])
-> Enum ShaderLocationIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ShaderLocationIndex -> ShaderLocationIndex
succ :: ShaderLocationIndex -> ShaderLocationIndex
$cpred :: ShaderLocationIndex -> ShaderLocationIndex
pred :: ShaderLocationIndex -> ShaderLocationIndex
$ctoEnum :: Int -> ShaderLocationIndex
toEnum :: Int -> ShaderLocationIndex
$cfromEnum :: ShaderLocationIndex -> Int
fromEnum :: ShaderLocationIndex -> Int
$cenumFrom :: ShaderLocationIndex -> [ShaderLocationIndex]
enumFrom :: ShaderLocationIndex -> [ShaderLocationIndex]
$cenumFromThen :: ShaderLocationIndex -> ShaderLocationIndex -> [ShaderLocationIndex]
enumFromThen :: ShaderLocationIndex -> ShaderLocationIndex -> [ShaderLocationIndex]
$cenumFromTo :: ShaderLocationIndex -> ShaderLocationIndex -> [ShaderLocationIndex]
enumFromTo :: ShaderLocationIndex -> ShaderLocationIndex -> [ShaderLocationIndex]
$cenumFromThenTo :: ShaderLocationIndex
-> ShaderLocationIndex
-> ShaderLocationIndex
-> [ShaderLocationIndex]
enumFromThenTo :: ShaderLocationIndex
-> ShaderLocationIndex
-> ShaderLocationIndex
-> [ShaderLocationIndex]
Enum)

data ShaderUniformDataType
  = ShaderUniformFloatType
  | ShaderUniformVec2Type
  | ShaderUniformVec3Type
  | ShaderUniformVec4Type
  | ShaderUniformIntType
  | ShaderUniformIVec2Type
  | ShaderUniformIVec3Type
  | ShaderUniformIVec4Type
  | ShaderUniformSampler2DType
  deriving (ShaderUniformDataType -> ShaderUniformDataType -> Bool
(ShaderUniformDataType -> ShaderUniformDataType -> Bool)
-> (ShaderUniformDataType -> ShaderUniformDataType -> Bool)
-> Eq ShaderUniformDataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShaderUniformDataType -> ShaderUniformDataType -> Bool
== :: ShaderUniformDataType -> ShaderUniformDataType -> Bool
$c/= :: ShaderUniformDataType -> ShaderUniformDataType -> Bool
/= :: ShaderUniformDataType -> ShaderUniformDataType -> Bool
Eq, Int -> ShaderUniformDataType -> ShowS
[ShaderUniformDataType] -> ShowS
ShaderUniformDataType -> String
(Int -> ShaderUniformDataType -> ShowS)
-> (ShaderUniformDataType -> String)
-> ([ShaderUniformDataType] -> ShowS)
-> Show ShaderUniformDataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShaderUniformDataType -> ShowS
showsPrec :: Int -> ShaderUniformDataType -> ShowS
$cshow :: ShaderUniformDataType -> String
show :: ShaderUniformDataType -> String
$cshowList :: [ShaderUniformDataType] -> ShowS
showList :: [ShaderUniformDataType] -> ShowS
Show, Int -> ShaderUniformDataType
ShaderUniformDataType -> Int
ShaderUniformDataType -> [ShaderUniformDataType]
ShaderUniformDataType -> ShaderUniformDataType
ShaderUniformDataType
-> ShaderUniformDataType -> [ShaderUniformDataType]
ShaderUniformDataType
-> ShaderUniformDataType
-> ShaderUniformDataType
-> [ShaderUniformDataType]
(ShaderUniformDataType -> ShaderUniformDataType)
-> (ShaderUniformDataType -> ShaderUniformDataType)
-> (Int -> ShaderUniformDataType)
-> (ShaderUniformDataType -> Int)
-> (ShaderUniformDataType -> [ShaderUniformDataType])
-> (ShaderUniformDataType
    -> ShaderUniformDataType -> [ShaderUniformDataType])
-> (ShaderUniformDataType
    -> ShaderUniformDataType -> [ShaderUniformDataType])
-> (ShaderUniformDataType
    -> ShaderUniformDataType
    -> ShaderUniformDataType
    -> [ShaderUniformDataType])
-> Enum ShaderUniformDataType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ShaderUniformDataType -> ShaderUniformDataType
succ :: ShaderUniformDataType -> ShaderUniformDataType
$cpred :: ShaderUniformDataType -> ShaderUniformDataType
pred :: ShaderUniformDataType -> ShaderUniformDataType
$ctoEnum :: Int -> ShaderUniformDataType
toEnum :: Int -> ShaderUniformDataType
$cfromEnum :: ShaderUniformDataType -> Int
fromEnum :: ShaderUniformDataType -> Int
$cenumFrom :: ShaderUniformDataType -> [ShaderUniformDataType]
enumFrom :: ShaderUniformDataType -> [ShaderUniformDataType]
$cenumFromThen :: ShaderUniformDataType
-> ShaderUniformDataType -> [ShaderUniformDataType]
enumFromThen :: ShaderUniformDataType
-> ShaderUniformDataType -> [ShaderUniformDataType]
$cenumFromTo :: ShaderUniformDataType
-> ShaderUniformDataType -> [ShaderUniformDataType]
enumFromTo :: ShaderUniformDataType
-> ShaderUniformDataType -> [ShaderUniformDataType]
$cenumFromThenTo :: ShaderUniformDataType
-> ShaderUniformDataType
-> ShaderUniformDataType
-> [ShaderUniformDataType]
enumFromThenTo :: ShaderUniformDataType
-> ShaderUniformDataType
-> ShaderUniformDataType
-> [ShaderUniformDataType]
Enum)

data ShaderUniformData
  = ShaderUniformFloat Float
  | ShaderUniformVec2 Vector2
  | ShaderUniformVec3 Vector3
  | ShaderUniformVec4 Vector4
  | ShaderUniformInt Int
  | ShaderUniformIVec2 (Int, Int)
  | ShaderUniformIVec3 (Int, Int, Int)
  | ShaderUniformIVec4 (Int, Int, Int, Int)
  | ShaderUniformSampler2D Texture
  deriving (ShaderUniformData -> ShaderUniformData -> Bool
(ShaderUniformData -> ShaderUniformData -> Bool)
-> (ShaderUniformData -> ShaderUniformData -> Bool)
-> Eq ShaderUniformData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShaderUniformData -> ShaderUniformData -> Bool
== :: ShaderUniformData -> ShaderUniformData -> Bool
$c/= :: ShaderUniformData -> ShaderUniformData -> Bool
/= :: ShaderUniformData -> ShaderUniformData -> Bool
Eq, Int -> ShaderUniformData -> ShowS
[ShaderUniformData] -> ShowS
ShaderUniformData -> String
(Int -> ShaderUniformData -> ShowS)
-> (ShaderUniformData -> String)
-> ([ShaderUniformData] -> ShowS)
-> Show ShaderUniformData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShaderUniformData -> ShowS
showsPrec :: Int -> ShaderUniformData -> ShowS
$cshow :: ShaderUniformData -> String
show :: ShaderUniformData -> String
$cshowList :: [ShaderUniformData] -> ShowS
showList :: [ShaderUniformData] -> ShowS
Show)

data ShaderUniformDataV
  = ShaderUniformFloatV [Float]
  | ShaderUniformVec2V [Vector2]
  | ShaderUniformVec3V [Vector3]
  | ShaderUniformVec4V [Vector4]
  | ShaderUniformIntV [Int]
  | ShaderUniformIVec2V [(Int, Int)]
  | ShaderUniformIVec3V [(Int, Int, Int)]
  | ShaderUniformIVec4V [(Int, Int, Int, Int)]
  | ShaderUniformSampler2DV [Texture]
  deriving (ShaderUniformDataV -> ShaderUniformDataV -> Bool
(ShaderUniformDataV -> ShaderUniformDataV -> Bool)
-> (ShaderUniformDataV -> ShaderUniformDataV -> Bool)
-> Eq ShaderUniformDataV
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShaderUniformDataV -> ShaderUniformDataV -> Bool
== :: ShaderUniformDataV -> ShaderUniformDataV -> Bool
$c/= :: ShaderUniformDataV -> ShaderUniformDataV -> Bool
/= :: ShaderUniformDataV -> ShaderUniformDataV -> Bool
Eq, Int -> ShaderUniformDataV -> ShowS
[ShaderUniformDataV] -> ShowS
ShaderUniformDataV -> String
(Int -> ShaderUniformDataV -> ShowS)
-> (ShaderUniformDataV -> String)
-> ([ShaderUniformDataV] -> ShowS)
-> Show ShaderUniformDataV
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShaderUniformDataV -> ShowS
showsPrec :: Int -> ShaderUniformDataV -> ShowS
$cshow :: ShaderUniformDataV -> String
show :: ShaderUniformDataV -> String
$cshowList :: [ShaderUniformDataV] -> ShowS
showList :: [ShaderUniformDataV] -> ShowS
Show)

-- I don't know if there's a cleaner way to do this

unpackShaderUniformData :: ShaderUniformData -> IO (ShaderUniformDataType, Ptr ())
unpackShaderUniformData :: ShaderUniformData -> IO (ShaderUniformDataType, Ptr ())
unpackShaderUniformData ShaderUniformData
u = do
  case ShaderUniformData
u of
    (ShaderUniformFloat Float
f) ->
      do
        Ptr CFloat
ptr <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
malloc
        Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CFloat
ptr (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
f :: CFloat)
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformFloatType, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr)
    (ShaderUniformVec2 (Vector2 Float
x Float
y)) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float
x, Float
y] :: [CFloat])
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformVec2Type, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr)
    (ShaderUniformVec3 (Vector3 Float
x Float
y Float
z)) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float
x, Float
y, Float
z] :: [CFloat])
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformVec3Type, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr)
    (ShaderUniformVec4 (Vector4 Float
x Float
y Float
z Float
w)) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float
x, Float
y, Float
z, Float
w] :: [CFloat])
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformVec4Type, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr)
    (ShaderUniformInt Int
i) ->
      do
        Ptr CInt
ptr <- IO (Ptr CInt)
forall a. Storable a => IO (Ptr a)
malloc
        Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CInt
ptr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i :: CInt)
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIntType, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr)
    (ShaderUniformIVec2 (Int
i1, Int
i2)) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int
i1, Int
i2] :: [CInt])
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIVec2Type, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr)
    (ShaderUniformIVec3 (Int
i1, Int
i2, Int
i3)) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int
i1, Int
i2, Int
i3] :: [CInt])
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIVec3Type, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr)
    (ShaderUniformIVec4 (Int
i1, Int
i2, Int
i3, Int
i4)) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int
i1, Int
i2, Int
i3, Int
i4] :: [CInt])
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIVec4Type, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr)
    (ShaderUniformSampler2D Texture
texture) ->
      do
        Ptr CInt
ptr <- IO (Ptr CInt)
forall a. Storable a => IO (Ptr a)
malloc
        Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CInt
ptr (Integer -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> CInt) -> Integer -> CInt
forall a b. (a -> b) -> a -> b
$ Texture -> Integer
texture'id Texture
texture :: CInt)
        (ShaderUniformDataType, Ptr ())
-> IO (ShaderUniformDataType, Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformSampler2DType, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr)

unpackShaderUniformDataV :: ShaderUniformDataV -> IO (ShaderUniformDataType, Ptr (), Int)
unpackShaderUniformDataV :: ShaderUniformDataV -> IO (ShaderUniformDataType, Ptr (), Int)
unpackShaderUniformDataV ShaderUniformDataV
xs = do
  case ShaderUniformDataV
xs of
    (ShaderUniformFloatV [Float]
fs) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
fs :: [CFloat])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformFloatType, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr, [Float] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Float]
fs)
    (ShaderUniformVec2V [Vector2]
vs) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([Float] -> [CFloat]) -> [Float] -> [CFloat]
forall a b. (a -> b) -> a -> b
$ (Vector2 -> [Float]) -> [Vector2] -> [Float]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Vector2 Float
x Float
y) -> [Float
x, Float
y]) [Vector2]
vs :: [CFloat])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformVec2Type, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr, [Vector2] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Vector2]
vs)
    (ShaderUniformVec3V [Vector3]
vs) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([Float] -> [CFloat]) -> [Float] -> [CFloat]
forall a b. (a -> b) -> a -> b
$ (Vector3 -> [Float]) -> [Vector3] -> [Float]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Vector3 Float
x Float
y Float
z) -> [Float
x, Float
y, Float
z]) [Vector3]
vs :: [CFloat])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformVec3Type, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr, [Vector3] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Vector3]
vs)
    (ShaderUniformVec4V [Vector4]
vs) ->
      do
        Ptr CFloat
ptr <- [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([Float] -> [CFloat]) -> [Float] -> [CFloat]
forall a b. (a -> b) -> a -> b
$ (Vector4 -> [Float]) -> [Vector4] -> [Float]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Vector4 Float
x Float
y Float
z Float
w) -> [Float
x, Float
y, Float
z, Float
w]) [Vector4]
vs :: [CFloat])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformVec4Type, Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
ptr, [Vector4] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Vector4]
vs)
    (ShaderUniformIntV [Int]
is) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
is :: [CInt])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIntType, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr, [Int] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Int]
is)
    (ShaderUniformIVec2V [(Int, Int)]
is) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Int] -> [CInt]) -> [Int] -> [CInt]
forall a b. (a -> b) -> a -> b
$ ((Int, Int) -> [Int]) -> [(Int, Int)] -> [Int]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Int
x, Int
y) -> [Int
x, Int
y]) [(Int, Int)]
is :: [CInt])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIVec2Type, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr, [(Int, Int)] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(Int, Int)]
is)
    (ShaderUniformIVec3V [(Int, Int, Int)]
is) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Int] -> [CInt]) -> [Int] -> [CInt]
forall a b. (a -> b) -> a -> b
$ ((Int, Int, Int) -> [Int]) -> [(Int, Int, Int)] -> [Int]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Int
x, Int
y, Int
z) -> [Int
x, Int
y, Int
z]) [(Int, Int, Int)]
is :: [CInt])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIVec3Type, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr, [(Int, Int, Int)] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(Int, Int, Int)]
is)
    (ShaderUniformIVec4V [(Int, Int, Int, Int)]
is) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Int] -> [CInt]) -> [Int] -> [CInt]
forall a b. (a -> b) -> a -> b
$ ((Int, Int, Int, Int) -> [Int]) -> [(Int, Int, Int, Int)] -> [Int]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Int
x, Int
y, Int
z, Int
w) -> [Int
x, Int
y, Int
z, Int
w]) [(Int, Int, Int, Int)]
is :: [CInt])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformIVec4Type, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr, [(Int, Int, Int, Int)] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(Int, Int, Int, Int)]
is)
    (ShaderUniformSampler2DV [Texture]
textures) ->
      do
        Ptr CInt
ptr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Texture -> CInt) -> [Texture] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map (Integer -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> CInt) -> (Texture -> Integer) -> Texture -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Texture -> Integer
texture'id) [Texture]
textures :: [CInt])
        (ShaderUniformDataType, Ptr (), Int)
-> IO (ShaderUniformDataType, Ptr (), Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ShaderUniformDataType
ShaderUniformSampler2DType, Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
ptr, [Texture] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Texture]
textures)

-- I genuinely have no idea where this is used.

data ShaderAttributeDataType
  = ShaderAttribFloat
  | ShaderAttribVec2
  | ShaderAttribVec3
  | ShaderAttribVec4
  deriving (ShaderAttributeDataType -> ShaderAttributeDataType -> Bool
(ShaderAttributeDataType -> ShaderAttributeDataType -> Bool)
-> (ShaderAttributeDataType -> ShaderAttributeDataType -> Bool)
-> Eq ShaderAttributeDataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShaderAttributeDataType -> ShaderAttributeDataType -> Bool
== :: ShaderAttributeDataType -> ShaderAttributeDataType -> Bool
$c/= :: ShaderAttributeDataType -> ShaderAttributeDataType -> Bool
/= :: ShaderAttributeDataType -> ShaderAttributeDataType -> Bool
Eq, Int -> ShaderAttributeDataType -> ShowS
[ShaderAttributeDataType] -> ShowS
ShaderAttributeDataType -> String
(Int -> ShaderAttributeDataType -> ShowS)
-> (ShaderAttributeDataType -> String)
-> ([ShaderAttributeDataType] -> ShowS)
-> Show ShaderAttributeDataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShaderAttributeDataType -> ShowS
showsPrec :: Int -> ShaderAttributeDataType -> ShowS
$cshow :: ShaderAttributeDataType -> String
show :: ShaderAttributeDataType -> String
$cshowList :: [ShaderAttributeDataType] -> ShowS
showList :: [ShaderAttributeDataType] -> ShowS
Show, Int -> ShaderAttributeDataType
ShaderAttributeDataType -> Int
ShaderAttributeDataType -> [ShaderAttributeDataType]
ShaderAttributeDataType -> ShaderAttributeDataType
ShaderAttributeDataType
-> ShaderAttributeDataType -> [ShaderAttributeDataType]
ShaderAttributeDataType
-> ShaderAttributeDataType
-> ShaderAttributeDataType
-> [ShaderAttributeDataType]
(ShaderAttributeDataType -> ShaderAttributeDataType)
-> (ShaderAttributeDataType -> ShaderAttributeDataType)
-> (Int -> ShaderAttributeDataType)
-> (ShaderAttributeDataType -> Int)
-> (ShaderAttributeDataType -> [ShaderAttributeDataType])
-> (ShaderAttributeDataType
    -> ShaderAttributeDataType -> [ShaderAttributeDataType])
-> (ShaderAttributeDataType
    -> ShaderAttributeDataType -> [ShaderAttributeDataType])
-> (ShaderAttributeDataType
    -> ShaderAttributeDataType
    -> ShaderAttributeDataType
    -> [ShaderAttributeDataType])
-> Enum ShaderAttributeDataType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ShaderAttributeDataType -> ShaderAttributeDataType
succ :: ShaderAttributeDataType -> ShaderAttributeDataType
$cpred :: ShaderAttributeDataType -> ShaderAttributeDataType
pred :: ShaderAttributeDataType -> ShaderAttributeDataType
$ctoEnum :: Int -> ShaderAttributeDataType
toEnum :: Int -> ShaderAttributeDataType
$cfromEnum :: ShaderAttributeDataType -> Int
fromEnum :: ShaderAttributeDataType -> Int
$cenumFrom :: ShaderAttributeDataType -> [ShaderAttributeDataType]
enumFrom :: ShaderAttributeDataType -> [ShaderAttributeDataType]
$cenumFromThen :: ShaderAttributeDataType
-> ShaderAttributeDataType -> [ShaderAttributeDataType]
enumFromThen :: ShaderAttributeDataType
-> ShaderAttributeDataType -> [ShaderAttributeDataType]
$cenumFromTo :: ShaderAttributeDataType
-> ShaderAttributeDataType -> [ShaderAttributeDataType]
enumFromTo :: ShaderAttributeDataType
-> ShaderAttributeDataType -> [ShaderAttributeDataType]
$cenumFromThenTo :: ShaderAttributeDataType
-> ShaderAttributeDataType
-> ShaderAttributeDataType
-> [ShaderAttributeDataType]
enumFromThenTo :: ShaderAttributeDataType
-> ShaderAttributeDataType
-> ShaderAttributeDataType
-> [ShaderAttributeDataType]
Enum)

data PixelFormat
  = PixelFormatUnset
  | PixelFormatUncompressedGrayscale
  | PixelFormatUncompressedGrayAlpha
  | PixelFormatUncompressedR5G6B5
  | PixelFormatUncompressedR8G8B8
  | PixelFormatUncompressedR5G5B5A1
  | PixelFormatUncompressedR4G4B4A4
  | PixelFormatUncompressedR8G8B8A8
  | PixelFormatUncompressedR32
  | PixelFormatUncompressedR32G32B32
  | PixelFormatUncompressedR32G32B32A32
  | PixelFormatUncompressedR16
  | PixelFormatUncompressedR16G16B16
  | PixelFormatUncompressedR16G16B16A16
  | PixelFormatCompressedDxt1Rgb
  | PixelFormatCompressedDxt1Rgba
  | PixelFormatCompressedDxt3Rgba
  | PixelFormatCompressedDxt5Rgba
  | PixelFormatCompressedEtc1Rgb
  | PixelFormatCompressedEtc2Rgb
  | PixelFormatCompressedEtc2EacRgba
  | PixelFormatCompressedPvrtRgb
  | PixelFormatCompressedPvrtRgba
  | PixelFormatCompressedAstc4x4Rgba
  | PixelFormatCompressedAstc8x8Rgba
  deriving (PixelFormat -> PixelFormat -> Bool
(PixelFormat -> PixelFormat -> Bool)
-> (PixelFormat -> PixelFormat -> Bool) -> Eq PixelFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PixelFormat -> PixelFormat -> Bool
== :: PixelFormat -> PixelFormat -> Bool
$c/= :: PixelFormat -> PixelFormat -> Bool
/= :: PixelFormat -> PixelFormat -> Bool
Eq, Int -> PixelFormat -> ShowS
[PixelFormat] -> ShowS
PixelFormat -> String
(Int -> PixelFormat -> ShowS)
-> (PixelFormat -> String)
-> ([PixelFormat] -> ShowS)
-> Show PixelFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PixelFormat -> ShowS
showsPrec :: Int -> PixelFormat -> ShowS
$cshow :: PixelFormat -> String
show :: PixelFormat -> String
$cshowList :: [PixelFormat] -> ShowS
showList :: [PixelFormat] -> ShowS
Show)

instance Storable PixelFormat where
  sizeOf :: PixelFormat -> Int
sizeOf PixelFormat
_ = Int
4
  alignment :: PixelFormat -> Int
alignment PixelFormat
_ = Int
4
  peek :: Ptr PixelFormat -> IO PixelFormat
peek Ptr PixelFormat
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr PixelFormat -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr PixelFormat
ptr :: Ptr CInt)
    PixelFormat -> IO PixelFormat
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> PixelFormat
forall a. Enum a => Int -> a
toEnum (Int -> PixelFormat) -> Int -> PixelFormat
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
val)
  poke :: Ptr PixelFormat -> PixelFormat -> IO ()
poke Ptr PixelFormat
ptr PixelFormat
v = do
    Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr PixelFormat -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr PixelFormat
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (PixelFormat -> Int
forall a. Enum a => a -> Int
fromEnum PixelFormat
v) :: CInt)

instance Enum PixelFormat where
  fromEnum :: PixelFormat -> Int
fromEnum PixelFormat
n = case PixelFormat
n of
    PixelFormat
PixelFormatUnset -> Int
0
    PixelFormat
PixelFormatUncompressedGrayscale -> Int
1
    PixelFormat
PixelFormatUncompressedGrayAlpha -> Int
2
    PixelFormat
PixelFormatUncompressedR5G6B5 -> Int
3
    PixelFormat
PixelFormatUncompressedR8G8B8 -> Int
4
    PixelFormat
PixelFormatUncompressedR5G5B5A1 -> Int
5
    PixelFormat
PixelFormatUncompressedR4G4B4A4 -> Int
6
    PixelFormat
PixelFormatUncompressedR8G8B8A8 -> Int
7
    PixelFormat
PixelFormatUncompressedR32 -> Int
8
    PixelFormat
PixelFormatUncompressedR32G32B32 -> Int
9
    PixelFormat
PixelFormatUncompressedR32G32B32A32 -> Int
10
    PixelFormat
PixelFormatUncompressedR16  -> Int
11
    PixelFormat
PixelFormatUncompressedR16G16B16 -> Int
12
    PixelFormat
PixelFormatUncompressedR16G16B16A16 -> Int
13
    PixelFormat
PixelFormatCompressedDxt1Rgb -> Int
14
    PixelFormat
PixelFormatCompressedDxt1Rgba -> Int
15
    PixelFormat
PixelFormatCompressedDxt3Rgba -> Int
16
    PixelFormat
PixelFormatCompressedDxt5Rgba -> Int
17
    PixelFormat
PixelFormatCompressedEtc1Rgb -> Int
18
    PixelFormat
PixelFormatCompressedEtc2Rgb -> Int
19
    PixelFormat
PixelFormatCompressedEtc2EacRgba -> Int
20
    PixelFormat
PixelFormatCompressedPvrtRgb -> Int
21
    PixelFormat
PixelFormatCompressedPvrtRgba -> Int
22
    PixelFormat
PixelFormatCompressedAstc4x4Rgba -> Int
23
    PixelFormat
PixelFormatCompressedAstc8x8Rgba -> Int
24

  toEnum :: Int -> PixelFormat
toEnum Int
n = case Int
n of
    Int
0 -> PixelFormat
PixelFormatUnset
    Int
1 -> PixelFormat
PixelFormatUncompressedGrayscale
    Int
2 -> PixelFormat
PixelFormatUncompressedGrayAlpha
    Int
3 -> PixelFormat
PixelFormatUncompressedR5G6B5
    Int
4 -> PixelFormat
PixelFormatUncompressedR8G8B8
    Int
5 -> PixelFormat
PixelFormatUncompressedR5G5B5A1
    Int
6 -> PixelFormat
PixelFormatUncompressedR4G4B4A4
    Int
7 -> PixelFormat
PixelFormatUncompressedR8G8B8A8
    Int
8 -> PixelFormat
PixelFormatUncompressedR32
    Int
9 -> PixelFormat
PixelFormatUncompressedR32G32B32
    Int
10 -> PixelFormat
PixelFormatUncompressedR32G32B32A32
    Int
11 -> PixelFormat
PixelFormatUncompressedR16 
    Int
12 -> PixelFormat
PixelFormatUncompressedR16G16B16
    Int
13 -> PixelFormat
PixelFormatUncompressedR16G16B16A16
    Int
14 -> PixelFormat
PixelFormatCompressedDxt1Rgb
    Int
15 -> PixelFormat
PixelFormatCompressedDxt1Rgba
    Int
16 -> PixelFormat
PixelFormatCompressedDxt3Rgba
    Int
17 -> PixelFormat
PixelFormatCompressedDxt5Rgba
    Int
18 -> PixelFormat
PixelFormatCompressedEtc1Rgb
    Int
19 -> PixelFormat
PixelFormatCompressedEtc2Rgb
    Int
20 -> PixelFormat
PixelFormatCompressedEtc2EacRgba
    Int
21 -> PixelFormat
PixelFormatCompressedPvrtRgb
    Int
22 -> PixelFormat
PixelFormatCompressedPvrtRgba
    Int
23 -> PixelFormat
PixelFormatCompressedAstc4x4Rgba
    Int
24 -> PixelFormat
PixelFormatCompressedAstc8x8Rgba
    Int
_ -> String -> PixelFormat
forall a. HasCallStack => String -> a
error (String -> PixelFormat) -> String -> PixelFormat
forall a b. (a -> b) -> a -> b
$ String
"(PixelFormat.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

data TextureFilter
  = TextureFilterPoint
  | TextureFilterBilinear
  | TextureFilterTrilinear
  | TextureFilterAnisotropic4x
  | TextureFilterAnisotropic8x
  | TextureFilterAnisotropic16x
  deriving (Int -> TextureFilter
TextureFilter -> Int
TextureFilter -> [TextureFilter]
TextureFilter -> TextureFilter
TextureFilter -> TextureFilter -> [TextureFilter]
TextureFilter -> TextureFilter -> TextureFilter -> [TextureFilter]
(TextureFilter -> TextureFilter)
-> (TextureFilter -> TextureFilter)
-> (Int -> TextureFilter)
-> (TextureFilter -> Int)
-> (TextureFilter -> [TextureFilter])
-> (TextureFilter -> TextureFilter -> [TextureFilter])
-> (TextureFilter -> TextureFilter -> [TextureFilter])
-> (TextureFilter
    -> TextureFilter -> TextureFilter -> [TextureFilter])
-> Enum TextureFilter
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TextureFilter -> TextureFilter
succ :: TextureFilter -> TextureFilter
$cpred :: TextureFilter -> TextureFilter
pred :: TextureFilter -> TextureFilter
$ctoEnum :: Int -> TextureFilter
toEnum :: Int -> TextureFilter
$cfromEnum :: TextureFilter -> Int
fromEnum :: TextureFilter -> Int
$cenumFrom :: TextureFilter -> [TextureFilter]
enumFrom :: TextureFilter -> [TextureFilter]
$cenumFromThen :: TextureFilter -> TextureFilter -> [TextureFilter]
enumFromThen :: TextureFilter -> TextureFilter -> [TextureFilter]
$cenumFromTo :: TextureFilter -> TextureFilter -> [TextureFilter]
enumFromTo :: TextureFilter -> TextureFilter -> [TextureFilter]
$cenumFromThenTo :: TextureFilter -> TextureFilter -> TextureFilter -> [TextureFilter]
enumFromThenTo :: TextureFilter -> TextureFilter -> TextureFilter -> [TextureFilter]
Enum)

data TextureWrap
  = TextureWrapRepeat
  | TextureWrapClamp
  | TextureWrapMirrorRepeat
  | TextureWrapMirrorClamp
  deriving (Int -> TextureWrap
TextureWrap -> Int
TextureWrap -> [TextureWrap]
TextureWrap -> TextureWrap
TextureWrap -> TextureWrap -> [TextureWrap]
TextureWrap -> TextureWrap -> TextureWrap -> [TextureWrap]
(TextureWrap -> TextureWrap)
-> (TextureWrap -> TextureWrap)
-> (Int -> TextureWrap)
-> (TextureWrap -> Int)
-> (TextureWrap -> [TextureWrap])
-> (TextureWrap -> TextureWrap -> [TextureWrap])
-> (TextureWrap -> TextureWrap -> [TextureWrap])
-> (TextureWrap -> TextureWrap -> TextureWrap -> [TextureWrap])
-> Enum TextureWrap
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TextureWrap -> TextureWrap
succ :: TextureWrap -> TextureWrap
$cpred :: TextureWrap -> TextureWrap
pred :: TextureWrap -> TextureWrap
$ctoEnum :: Int -> TextureWrap
toEnum :: Int -> TextureWrap
$cfromEnum :: TextureWrap -> Int
fromEnum :: TextureWrap -> Int
$cenumFrom :: TextureWrap -> [TextureWrap]
enumFrom :: TextureWrap -> [TextureWrap]
$cenumFromThen :: TextureWrap -> TextureWrap -> [TextureWrap]
enumFromThen :: TextureWrap -> TextureWrap -> [TextureWrap]
$cenumFromTo :: TextureWrap -> TextureWrap -> [TextureWrap]
enumFromTo :: TextureWrap -> TextureWrap -> [TextureWrap]
$cenumFromThenTo :: TextureWrap -> TextureWrap -> TextureWrap -> [TextureWrap]
enumFromThenTo :: TextureWrap -> TextureWrap -> TextureWrap -> [TextureWrap]
Enum)

data CubemapLayout
  = CubemapLayoutAutoDetect
  | CubemapLayoutLineVertical
  | CubemapLayoutLineHorizontal
  | CubemapLayoutCrossThreeByFour
  | CubemapLayoutCrossThreeByThree
  | CubemapLayoutPanorama
  deriving (Int -> CubemapLayout
CubemapLayout -> Int
CubemapLayout -> [CubemapLayout]
CubemapLayout -> CubemapLayout
CubemapLayout -> CubemapLayout -> [CubemapLayout]
CubemapLayout -> CubemapLayout -> CubemapLayout -> [CubemapLayout]
(CubemapLayout -> CubemapLayout)
-> (CubemapLayout -> CubemapLayout)
-> (Int -> CubemapLayout)
-> (CubemapLayout -> Int)
-> (CubemapLayout -> [CubemapLayout])
-> (CubemapLayout -> CubemapLayout -> [CubemapLayout])
-> (CubemapLayout -> CubemapLayout -> [CubemapLayout])
-> (CubemapLayout
    -> CubemapLayout -> CubemapLayout -> [CubemapLayout])
-> Enum CubemapLayout
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: CubemapLayout -> CubemapLayout
succ :: CubemapLayout -> CubemapLayout
$cpred :: CubemapLayout -> CubemapLayout
pred :: CubemapLayout -> CubemapLayout
$ctoEnum :: Int -> CubemapLayout
toEnum :: Int -> CubemapLayout
$cfromEnum :: CubemapLayout -> Int
fromEnum :: CubemapLayout -> Int
$cenumFrom :: CubemapLayout -> [CubemapLayout]
enumFrom :: CubemapLayout -> [CubemapLayout]
$cenumFromThen :: CubemapLayout -> CubemapLayout -> [CubemapLayout]
enumFromThen :: CubemapLayout -> CubemapLayout -> [CubemapLayout]
$cenumFromTo :: CubemapLayout -> CubemapLayout -> [CubemapLayout]
enumFromTo :: CubemapLayout -> CubemapLayout -> [CubemapLayout]
$cenumFromThenTo :: CubemapLayout -> CubemapLayout -> CubemapLayout -> [CubemapLayout]
enumFromThenTo :: CubemapLayout -> CubemapLayout -> CubemapLayout -> [CubemapLayout]
Enum)

data FontType = FontDefault | FontBitmap | FontSDF deriving (Int -> FontType
FontType -> Int
FontType -> [FontType]
FontType -> FontType
FontType -> FontType -> [FontType]
FontType -> FontType -> FontType -> [FontType]
(FontType -> FontType)
-> (FontType -> FontType)
-> (Int -> FontType)
-> (FontType -> Int)
-> (FontType -> [FontType])
-> (FontType -> FontType -> [FontType])
-> (FontType -> FontType -> [FontType])
-> (FontType -> FontType -> FontType -> [FontType])
-> Enum FontType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: FontType -> FontType
succ :: FontType -> FontType
$cpred :: FontType -> FontType
pred :: FontType -> FontType
$ctoEnum :: Int -> FontType
toEnum :: Int -> FontType
$cfromEnum :: FontType -> Int
fromEnum :: FontType -> Int
$cenumFrom :: FontType -> [FontType]
enumFrom :: FontType -> [FontType]
$cenumFromThen :: FontType -> FontType -> [FontType]
enumFromThen :: FontType -> FontType -> [FontType]
$cenumFromTo :: FontType -> FontType -> [FontType]
enumFromTo :: FontType -> FontType -> [FontType]
$cenumFromThenTo :: FontType -> FontType -> FontType -> [FontType]
enumFromThenTo :: FontType -> FontType -> FontType -> [FontType]
Enum)

data BlendMode
  = BlendAlpha
  | BlendAdditive
  | BlendMultiplied
  | BlendAddColors
  | BlendSubtractColors
  | BlendAlphaPremultiply
  | BlendCustom
  | BlendCustomSeparate
  deriving (Int -> BlendMode
BlendMode -> Int
BlendMode -> [BlendMode]
BlendMode -> BlendMode
BlendMode -> BlendMode -> [BlendMode]
BlendMode -> BlendMode -> BlendMode -> [BlendMode]
(BlendMode -> BlendMode)
-> (BlendMode -> BlendMode)
-> (Int -> BlendMode)
-> (BlendMode -> Int)
-> (BlendMode -> [BlendMode])
-> (BlendMode -> BlendMode -> [BlendMode])
-> (BlendMode -> BlendMode -> [BlendMode])
-> (BlendMode -> BlendMode -> BlendMode -> [BlendMode])
-> Enum BlendMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: BlendMode -> BlendMode
succ :: BlendMode -> BlendMode
$cpred :: BlendMode -> BlendMode
pred :: BlendMode -> BlendMode
$ctoEnum :: Int -> BlendMode
toEnum :: Int -> BlendMode
$cfromEnum :: BlendMode -> Int
fromEnum :: BlendMode -> Int
$cenumFrom :: BlendMode -> [BlendMode]
enumFrom :: BlendMode -> [BlendMode]
$cenumFromThen :: BlendMode -> BlendMode -> [BlendMode]
enumFromThen :: BlendMode -> BlendMode -> [BlendMode]
$cenumFromTo :: BlendMode -> BlendMode -> [BlendMode]
enumFromTo :: BlendMode -> BlendMode -> [BlendMode]
$cenumFromThenTo :: BlendMode -> BlendMode -> BlendMode -> [BlendMode]
enumFromThenTo :: BlendMode -> BlendMode -> BlendMode -> [BlendMode]
Enum)

data Gesture
  = GestureNone
  | GestureTap
  | GestureDoubleTap
  | GestureHold
  | GestureDrag
  | GestureSwipeRight
  | GestureSwipeLeft
  | GestureSwipeUp
  | GestureSwipeDown
  | GesturePinchIn
  | GesturePinchOut
  deriving (Int -> Gesture -> ShowS
[Gesture] -> ShowS
Gesture -> String
(Int -> Gesture -> ShowS)
-> (Gesture -> String) -> ([Gesture] -> ShowS) -> Show Gesture
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Gesture -> ShowS
showsPrec :: Int -> Gesture -> ShowS
$cshow :: Gesture -> String
show :: Gesture -> String
$cshowList :: [Gesture] -> ShowS
showList :: [Gesture] -> ShowS
Show, Gesture -> Gesture -> Bool
(Gesture -> Gesture -> Bool)
-> (Gesture -> Gesture -> Bool) -> Eq Gesture
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Gesture -> Gesture -> Bool
== :: Gesture -> Gesture -> Bool
$c/= :: Gesture -> Gesture -> Bool
/= :: Gesture -> Gesture -> Bool
Eq)

-- NOTE: This is not the ideal solution, I need to make this unjanky

instance Enum Gesture where
  fromEnum :: Gesture -> Int
fromEnum Gesture
n = case Gesture
n of
    Gesture
GestureNone -> Int
0
    Gesture
GestureTap -> Int
1
    Gesture
GestureDoubleTap -> Int
2
    Gesture
GestureHold -> Int
4
    Gesture
GestureDrag -> Int
8
    Gesture
GestureSwipeRight -> Int
16
    Gesture
GestureSwipeLeft -> Int
32
    Gesture
GestureSwipeUp -> Int
64
    Gesture
GestureSwipeDown -> Int
128
    Gesture
GesturePinchIn -> Int
256
    Gesture
GesturePinchOut -> Int
512
  toEnum :: Int -> Gesture
toEnum Int
n = case Int
n of
    Int
0 -> Gesture
GestureNone
    Int
1 -> Gesture
GestureTap
    Int
2 -> Gesture
GestureDoubleTap
    Int
4 -> Gesture
GestureHold
    Int
8 -> Gesture
GestureDrag
    Int
16 -> Gesture
GestureSwipeRight
    Int
32 -> Gesture
GestureSwipeLeft
    Int
64 -> Gesture
GestureSwipeUp
    Int
128 -> Gesture
GestureSwipeDown
    Int
256 -> Gesture
GesturePinchIn
    Int
512 -> Gesture
GesturePinchOut
    Int
_ -> String -> Gesture
forall a. HasCallStack => String -> a
error (String -> Gesture) -> String -> Gesture
forall a b. (a -> b) -> a -> b
$ String
"(Gesture.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

data CameraMode
  = CameraModeCustom
  | CameraModeFree
  | CameraModeOrbital
  | CameraModeFirstPerson
  | CameraModeThirdPerson
  deriving (Int -> CameraMode
CameraMode -> Int
CameraMode -> [CameraMode]
CameraMode -> CameraMode
CameraMode -> CameraMode -> [CameraMode]
CameraMode -> CameraMode -> CameraMode -> [CameraMode]
(CameraMode -> CameraMode)
-> (CameraMode -> CameraMode)
-> (Int -> CameraMode)
-> (CameraMode -> Int)
-> (CameraMode -> [CameraMode])
-> (CameraMode -> CameraMode -> [CameraMode])
-> (CameraMode -> CameraMode -> [CameraMode])
-> (CameraMode -> CameraMode -> CameraMode -> [CameraMode])
-> Enum CameraMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: CameraMode -> CameraMode
succ :: CameraMode -> CameraMode
$cpred :: CameraMode -> CameraMode
pred :: CameraMode -> CameraMode
$ctoEnum :: Int -> CameraMode
toEnum :: Int -> CameraMode
$cfromEnum :: CameraMode -> Int
fromEnum :: CameraMode -> Int
$cenumFrom :: CameraMode -> [CameraMode]
enumFrom :: CameraMode -> [CameraMode]
$cenumFromThen :: CameraMode -> CameraMode -> [CameraMode]
enumFromThen :: CameraMode -> CameraMode -> [CameraMode]
$cenumFromTo :: CameraMode -> CameraMode -> [CameraMode]
enumFromTo :: CameraMode -> CameraMode -> [CameraMode]
$cenumFromThenTo :: CameraMode -> CameraMode -> CameraMode -> [CameraMode]
enumFromThenTo :: CameraMode -> CameraMode -> CameraMode -> [CameraMode]
Enum)

data CameraProjection = CameraPerspective | CameraOrthographic deriving (CameraProjection -> CameraProjection -> Bool
(CameraProjection -> CameraProjection -> Bool)
-> (CameraProjection -> CameraProjection -> Bool)
-> Eq CameraProjection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CameraProjection -> CameraProjection -> Bool
== :: CameraProjection -> CameraProjection -> Bool
$c/= :: CameraProjection -> CameraProjection -> Bool
/= :: CameraProjection -> CameraProjection -> Bool
Eq, Int -> CameraProjection -> ShowS
[CameraProjection] -> ShowS
CameraProjection -> String
(Int -> CameraProjection -> ShowS)
-> (CameraProjection -> String)
-> ([CameraProjection] -> ShowS)
-> Show CameraProjection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CameraProjection -> ShowS
showsPrec :: Int -> CameraProjection -> ShowS
$cshow :: CameraProjection -> String
show :: CameraProjection -> String
$cshowList :: [CameraProjection] -> ShowS
showList :: [CameraProjection] -> ShowS
Show, Int -> CameraProjection
CameraProjection -> Int
CameraProjection -> [CameraProjection]
CameraProjection -> CameraProjection
CameraProjection -> CameraProjection -> [CameraProjection]
CameraProjection
-> CameraProjection -> CameraProjection -> [CameraProjection]
(CameraProjection -> CameraProjection)
-> (CameraProjection -> CameraProjection)
-> (Int -> CameraProjection)
-> (CameraProjection -> Int)
-> (CameraProjection -> [CameraProjection])
-> (CameraProjection -> CameraProjection -> [CameraProjection])
-> (CameraProjection -> CameraProjection -> [CameraProjection])
-> (CameraProjection
    -> CameraProjection -> CameraProjection -> [CameraProjection])
-> Enum CameraProjection
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: CameraProjection -> CameraProjection
succ :: CameraProjection -> CameraProjection
$cpred :: CameraProjection -> CameraProjection
pred :: CameraProjection -> CameraProjection
$ctoEnum :: Int -> CameraProjection
toEnum :: Int -> CameraProjection
$cfromEnum :: CameraProjection -> Int
fromEnum :: CameraProjection -> Int
$cenumFrom :: CameraProjection -> [CameraProjection]
enumFrom :: CameraProjection -> [CameraProjection]
$cenumFromThen :: CameraProjection -> CameraProjection -> [CameraProjection]
enumFromThen :: CameraProjection -> CameraProjection -> [CameraProjection]
$cenumFromTo :: CameraProjection -> CameraProjection -> [CameraProjection]
enumFromTo :: CameraProjection -> CameraProjection -> [CameraProjection]
$cenumFromThenTo :: CameraProjection
-> CameraProjection -> CameraProjection -> [CameraProjection]
enumFromThenTo :: CameraProjection
-> CameraProjection -> CameraProjection -> [CameraProjection]
Enum)

instance Storable CameraProjection where
  sizeOf :: CameraProjection -> Int
sizeOf CameraProjection
_ = Int
4
  alignment :: CameraProjection -> Int
alignment CameraProjection
_ = Int
4
  peek :: Ptr CameraProjection -> IO CameraProjection
peek Ptr CameraProjection
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr CameraProjection -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr CameraProjection
ptr)
    CameraProjection -> IO CameraProjection
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> CameraProjection
forall a. Enum a => Int -> a
toEnum (Int -> CameraProjection) -> Int -> CameraProjection
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt))
  poke :: Ptr CameraProjection -> CameraProjection -> IO ()
poke Ptr CameraProjection
ptr CameraProjection
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CameraProjection -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr CameraProjection
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CameraProjection -> Int
forall a. Enum a => a -> Int
fromEnum CameraProjection
v) :: CInt)

data NPatchLayout = NPatchNinePatch | NPatchThreePatchVertical | NPatchThreePatchHorizontal deriving (NPatchLayout -> NPatchLayout -> Bool
(NPatchLayout -> NPatchLayout -> Bool)
-> (NPatchLayout -> NPatchLayout -> Bool) -> Eq NPatchLayout
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NPatchLayout -> NPatchLayout -> Bool
== :: NPatchLayout -> NPatchLayout -> Bool
$c/= :: NPatchLayout -> NPatchLayout -> Bool
/= :: NPatchLayout -> NPatchLayout -> Bool
Eq, Int -> NPatchLayout -> ShowS
[NPatchLayout] -> ShowS
NPatchLayout -> String
(Int -> NPatchLayout -> ShowS)
-> (NPatchLayout -> String)
-> ([NPatchLayout] -> ShowS)
-> Show NPatchLayout
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NPatchLayout -> ShowS
showsPrec :: Int -> NPatchLayout -> ShowS
$cshow :: NPatchLayout -> String
show :: NPatchLayout -> String
$cshowList :: [NPatchLayout] -> ShowS
showList :: [NPatchLayout] -> ShowS
Show, Int -> NPatchLayout
NPatchLayout -> Int
NPatchLayout -> [NPatchLayout]
NPatchLayout -> NPatchLayout
NPatchLayout -> NPatchLayout -> [NPatchLayout]
NPatchLayout -> NPatchLayout -> NPatchLayout -> [NPatchLayout]
(NPatchLayout -> NPatchLayout)
-> (NPatchLayout -> NPatchLayout)
-> (Int -> NPatchLayout)
-> (NPatchLayout -> Int)
-> (NPatchLayout -> [NPatchLayout])
-> (NPatchLayout -> NPatchLayout -> [NPatchLayout])
-> (NPatchLayout -> NPatchLayout -> [NPatchLayout])
-> (NPatchLayout -> NPatchLayout -> NPatchLayout -> [NPatchLayout])
-> Enum NPatchLayout
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: NPatchLayout -> NPatchLayout
succ :: NPatchLayout -> NPatchLayout
$cpred :: NPatchLayout -> NPatchLayout
pred :: NPatchLayout -> NPatchLayout
$ctoEnum :: Int -> NPatchLayout
toEnum :: Int -> NPatchLayout
$cfromEnum :: NPatchLayout -> Int
fromEnum :: NPatchLayout -> Int
$cenumFrom :: NPatchLayout -> [NPatchLayout]
enumFrom :: NPatchLayout -> [NPatchLayout]
$cenumFromThen :: NPatchLayout -> NPatchLayout -> [NPatchLayout]
enumFromThen :: NPatchLayout -> NPatchLayout -> [NPatchLayout]
$cenumFromTo :: NPatchLayout -> NPatchLayout -> [NPatchLayout]
enumFromTo :: NPatchLayout -> NPatchLayout -> [NPatchLayout]
$cenumFromThenTo :: NPatchLayout -> NPatchLayout -> NPatchLayout -> [NPatchLayout]
enumFromThenTo :: NPatchLayout -> NPatchLayout -> NPatchLayout -> [NPatchLayout]
Enum)

instance Storable NPatchLayout where
  sizeOf :: NPatchLayout -> Int
sizeOf NPatchLayout
_ = Int
4
  alignment :: NPatchLayout -> Int
alignment NPatchLayout
_ = Int
4
  peek :: Ptr NPatchLayout -> IO NPatchLayout
peek Ptr NPatchLayout
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr NPatchLayout -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr NPatchLayout
ptr)
    NPatchLayout -> IO NPatchLayout
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (NPatchLayout -> IO NPatchLayout)
-> NPatchLayout -> IO NPatchLayout
forall a b. (a -> b) -> a -> b
$ Int -> NPatchLayout
forall a. Enum a => Int -> a
toEnum (Int -> NPatchLayout) -> Int -> NPatchLayout
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr NPatchLayout -> NPatchLayout -> IO ()
poke Ptr NPatchLayout
ptr NPatchLayout
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr NPatchLayout -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr NPatchLayout
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (NPatchLayout -> Int
forall a. Enum a => a -> Int
fromEnum NPatchLayout
v) :: CInt)

data MusicContextType
  = MusicAudioNone
  | MusicAudioWAV
  | MusicAudioOGG
  | MusicAudioFLAC
  | MusicAudioMP3
  | MusicAudioQOA
  | MusicModuleXM
  | MusicModuleMOD
  deriving (MusicContextType -> MusicContextType -> Bool
(MusicContextType -> MusicContextType -> Bool)
-> (MusicContextType -> MusicContextType -> Bool)
-> Eq MusicContextType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MusicContextType -> MusicContextType -> Bool
== :: MusicContextType -> MusicContextType -> Bool
$c/= :: MusicContextType -> MusicContextType -> Bool
/= :: MusicContextType -> MusicContextType -> Bool
Eq, Int -> MusicContextType -> ShowS
[MusicContextType] -> ShowS
MusicContextType -> String
(Int -> MusicContextType -> ShowS)
-> (MusicContextType -> String)
-> ([MusicContextType] -> ShowS)
-> Show MusicContextType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MusicContextType -> ShowS
showsPrec :: Int -> MusicContextType -> ShowS
$cshow :: MusicContextType -> String
show :: MusicContextType -> String
$cshowList :: [MusicContextType] -> ShowS
showList :: [MusicContextType] -> ShowS
Show, Int -> MusicContextType
MusicContextType -> Int
MusicContextType -> [MusicContextType]
MusicContextType -> MusicContextType
MusicContextType -> MusicContextType -> [MusicContextType]
MusicContextType
-> MusicContextType -> MusicContextType -> [MusicContextType]
(MusicContextType -> MusicContextType)
-> (MusicContextType -> MusicContextType)
-> (Int -> MusicContextType)
-> (MusicContextType -> Int)
-> (MusicContextType -> [MusicContextType])
-> (MusicContextType -> MusicContextType -> [MusicContextType])
-> (MusicContextType -> MusicContextType -> [MusicContextType])
-> (MusicContextType
    -> MusicContextType -> MusicContextType -> [MusicContextType])
-> Enum MusicContextType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: MusicContextType -> MusicContextType
succ :: MusicContextType -> MusicContextType
$cpred :: MusicContextType -> MusicContextType
pred :: MusicContextType -> MusicContextType
$ctoEnum :: Int -> MusicContextType
toEnum :: Int -> MusicContextType
$cfromEnum :: MusicContextType -> Int
fromEnum :: MusicContextType -> Int
$cenumFrom :: MusicContextType -> [MusicContextType]
enumFrom :: MusicContextType -> [MusicContextType]
$cenumFromThen :: MusicContextType -> MusicContextType -> [MusicContextType]
enumFromThen :: MusicContextType -> MusicContextType -> [MusicContextType]
$cenumFromTo :: MusicContextType -> MusicContextType -> [MusicContextType]
enumFromTo :: MusicContextType -> MusicContextType -> [MusicContextType]
$cenumFromThenTo :: MusicContextType
-> MusicContextType -> MusicContextType -> [MusicContextType]
enumFromThenTo :: MusicContextType
-> MusicContextType -> MusicContextType -> [MusicContextType]
Enum)

instance Storable MusicContextType where
  sizeOf :: MusicContextType -> Int
sizeOf MusicContextType
_ = Int
4
  alignment :: MusicContextType -> Int
alignment MusicContextType
_ = Int
4
  peek :: Ptr MusicContextType -> IO MusicContextType
peek Ptr MusicContextType
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr MusicContextType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr MusicContextType
ptr)
    MusicContextType -> IO MusicContextType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (MusicContextType -> IO MusicContextType)
-> MusicContextType -> IO MusicContextType
forall a b. (a -> b) -> a -> b
$ Int -> MusicContextType
forall a. Enum a => Int -> a
toEnum (Int -> MusicContextType) -> Int -> MusicContextType
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr MusicContextType -> MusicContextType -> IO ()
poke Ptr MusicContextType
ptr MusicContextType
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr MusicContextType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr MusicContextType
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (MusicContextType -> Int
forall a. Enum a => a -> Int
fromEnum MusicContextType
v) :: CInt)

---- rlgl.h


-- | OpenGL version

data RLGLVersion
  = -- | OpenGL 1.1

    RLOpenGL11
  | -- | OpenGL 2.1 (GLSL 120)

    RLOpenGL21
  | -- | OpenGL 3.3 (GLSL 330)

    RLOpenGL33
  | -- | OpenGL 4.3 (using GLSL 330)

    RLOpenGL43
  | -- | OpenGL ES 2.0 (GLSL 100)

    RLOpenGLES20
  deriving (RLGLVersion -> RLGLVersion -> Bool
(RLGLVersion -> RLGLVersion -> Bool)
-> (RLGLVersion -> RLGLVersion -> Bool) -> Eq RLGLVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLGLVersion -> RLGLVersion -> Bool
== :: RLGLVersion -> RLGLVersion -> Bool
$c/= :: RLGLVersion -> RLGLVersion -> Bool
/= :: RLGLVersion -> RLGLVersion -> Bool
Eq, Int -> RLGLVersion -> ShowS
[RLGLVersion] -> ShowS
RLGLVersion -> String
(Int -> RLGLVersion -> ShowS)
-> (RLGLVersion -> String)
-> ([RLGLVersion] -> ShowS)
-> Show RLGLVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLGLVersion -> ShowS
showsPrec :: Int -> RLGLVersion -> ShowS
$cshow :: RLGLVersion -> String
show :: RLGLVersion -> String
$cshowList :: [RLGLVersion] -> ShowS
showList :: [RLGLVersion] -> ShowS
Show)

instance Enum RLGLVersion where
  fromEnum :: RLGLVersion -> Int
fromEnum RLGLVersion
n = case RLGLVersion
n of
    RLGLVersion
RLOpenGL11 -> Int
0
    RLGLVersion
RLOpenGL21 -> Int
1
    RLGLVersion
RLOpenGL33 -> Int
2
    RLGLVersion
RLOpenGL43 -> Int
3
    RLGLVersion
RLOpenGLES20 -> Int
4
  toEnum :: Int -> RLGLVersion
toEnum Int
n = case Int
n of
    Int
0 -> RLGLVersion
RLOpenGL11
    Int
1 -> RLGLVersion
RLOpenGL21
    Int
2 -> RLGLVersion
RLOpenGL33
    Int
3 -> RLGLVersion
RLOpenGL43
    Int
4 -> RLGLVersion
RLOpenGLES20
    Int
_ -> String -> RLGLVersion
forall a. HasCallStack => String -> a
error (String -> RLGLVersion) -> String -> RLGLVersion
forall a b. (a -> b) -> a -> b
$ String
"(RLGLVersion.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLGLVersion where
  sizeOf :: RLGLVersion -> Int
sizeOf RLGLVersion
_ = Int
4
  alignment :: RLGLVersion -> Int
alignment RLGLVersion
_ = Int
4
  peek :: Ptr RLGLVersion -> IO RLGLVersion
peek Ptr RLGLVersion
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLGLVersion -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLGLVersion
ptr)
    RLGLVersion -> IO RLGLVersion
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLGLVersion -> IO RLGLVersion) -> RLGLVersion -> IO RLGLVersion
forall a b. (a -> b) -> a -> b
$ Int -> RLGLVersion
forall a. Enum a => Int -> a
toEnum (Int -> RLGLVersion) -> Int -> RLGLVersion
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLGLVersion -> RLGLVersion -> IO ()
poke Ptr RLGLVersion
ptr RLGLVersion
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLGLVersion -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLGLVersion
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLGLVersion -> Int
forall a. Enum a => a -> Int
fromEnum RLGLVersion
v) :: CInt)

-- | Trace log level.

-- NOTE: Organized by priority level

data RLTraceLogLevel
  = -- | Display all logs

    RLLogAll
  | -- | Trace logging, intended for internal use only

    RLLogTrace
  | -- | Debug logging, used for internal debugging, it should be disabled on release builds

    RLLogDebug
  | -- | Info logging, used for program execution info

    RLLogInfo
  | -- | Warning logging, used on recoverable failures

    RLLogWarning
  | -- | Error logging, used on unrecoverable failures

    RLLogError
  | -- | Fatal logging, used to abort program: exit(EXIT_FAILURE)

    RLLogFatal
  | -- | Disable logging

    RLLogNone
  deriving (RLTraceLogLevel -> RLTraceLogLevel -> Bool
(RLTraceLogLevel -> RLTraceLogLevel -> Bool)
-> (RLTraceLogLevel -> RLTraceLogLevel -> Bool)
-> Eq RLTraceLogLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLTraceLogLevel -> RLTraceLogLevel -> Bool
== :: RLTraceLogLevel -> RLTraceLogLevel -> Bool
$c/= :: RLTraceLogLevel -> RLTraceLogLevel -> Bool
/= :: RLTraceLogLevel -> RLTraceLogLevel -> Bool
Eq, Int -> RLTraceLogLevel -> ShowS
[RLTraceLogLevel] -> ShowS
RLTraceLogLevel -> String
(Int -> RLTraceLogLevel -> ShowS)
-> (RLTraceLogLevel -> String)
-> ([RLTraceLogLevel] -> ShowS)
-> Show RLTraceLogLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLTraceLogLevel -> ShowS
showsPrec :: Int -> RLTraceLogLevel -> ShowS
$cshow :: RLTraceLogLevel -> String
show :: RLTraceLogLevel -> String
$cshowList :: [RLTraceLogLevel] -> ShowS
showList :: [RLTraceLogLevel] -> ShowS
Show, Int -> RLTraceLogLevel
RLTraceLogLevel -> Int
RLTraceLogLevel -> [RLTraceLogLevel]
RLTraceLogLevel -> RLTraceLogLevel
RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
RLTraceLogLevel
-> RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
(RLTraceLogLevel -> RLTraceLogLevel)
-> (RLTraceLogLevel -> RLTraceLogLevel)
-> (Int -> RLTraceLogLevel)
-> (RLTraceLogLevel -> Int)
-> (RLTraceLogLevel -> [RLTraceLogLevel])
-> (RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel])
-> (RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel])
-> (RLTraceLogLevel
    -> RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel])
-> Enum RLTraceLogLevel
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLTraceLogLevel -> RLTraceLogLevel
succ :: RLTraceLogLevel -> RLTraceLogLevel
$cpred :: RLTraceLogLevel -> RLTraceLogLevel
pred :: RLTraceLogLevel -> RLTraceLogLevel
$ctoEnum :: Int -> RLTraceLogLevel
toEnum :: Int -> RLTraceLogLevel
$cfromEnum :: RLTraceLogLevel -> Int
fromEnum :: RLTraceLogLevel -> Int
$cenumFrom :: RLTraceLogLevel -> [RLTraceLogLevel]
enumFrom :: RLTraceLogLevel -> [RLTraceLogLevel]
$cenumFromThen :: RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
enumFromThen :: RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
$cenumFromTo :: RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
enumFromTo :: RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
$cenumFromThenTo :: RLTraceLogLevel
-> RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
enumFromThenTo :: RLTraceLogLevel
-> RLTraceLogLevel -> RLTraceLogLevel -> [RLTraceLogLevel]
Enum)

instance Storable RLTraceLogLevel where
  sizeOf :: RLTraceLogLevel -> Int
sizeOf RLTraceLogLevel
_ = Int
4
  alignment :: RLTraceLogLevel -> Int
alignment RLTraceLogLevel
_ = Int
4
  peek :: Ptr RLTraceLogLevel -> IO RLTraceLogLevel
peek Ptr RLTraceLogLevel
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLTraceLogLevel -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLTraceLogLevel
ptr)
    RLTraceLogLevel -> IO RLTraceLogLevel
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLTraceLogLevel -> IO RLTraceLogLevel)
-> RLTraceLogLevel -> IO RLTraceLogLevel
forall a b. (a -> b) -> a -> b
$ Int -> RLTraceLogLevel
forall a. Enum a => Int -> a
toEnum (Int -> RLTraceLogLevel) -> Int -> RLTraceLogLevel
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLTraceLogLevel -> RLTraceLogLevel -> IO ()
poke Ptr RLTraceLogLevel
ptr RLTraceLogLevel
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLTraceLogLevel -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLTraceLogLevel
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLTraceLogLevel -> Int
forall a. Enum a => a -> Int
fromEnum RLTraceLogLevel
v) :: CInt)

-- | Texture pixel formats.

-- NOTE: Support depends on OpenGL version

data RLPixelFormat
  = -- | 8 bit per pixel (no alpha)

    RLPixelFormatUncompressedGrayscale
  | -- | 8*2 bpp (2 channels)

    RLPixelFormatUncompressedGrayAlpha
  | -- | 16 bpp

    RLPixelFormatUncompressedR5G6B5
  | -- | 24 bpp

    RLPixelFormatUncompressedR8G8B8
  | -- | 16 bpp (1 bit alpha)

    RLPixelFormatUncompressedR5G5B5A1
  | -- | 16 bpp (4 bit alpha)

    RLPixelFormatUncompressedR4G4B4A4
  | -- | 32 bpp

    RLPixelFormatUncompressedR8G8B8A8
  | -- | 32 bpp (1 channel - float)

    RLPixelFormatUncompressedR32
  | -- | 32*3 bpp (3 channels - float)

    RLPixelFormatUncompressedR32G32B32
  | -- | 32*4 bpp (4 channels - float)

    RLPixelFormatUncompressedR32G32B32A32
  | -- | 16 bpp (1 channel - half float)

    RLPixelFormatUncompressedR16
  | -- | 16*3 bpp (3 channels - half float)

    RLPixelFormatUncompressedR16G16B16
  | -- | 16*4 bpp (4 channels - half float)

    RLPixelFormatUncompressedR16G16B16A16
  | -- | 4 bpp (no alpha)

    RLPixelFormatCompressedDxt1Rgb
  | -- | 4 bpp (1 bit alpha)

    RLPixelFormatCompressedDxt1Rgba
  | -- | 8 bpp

    RLPixelFormatCompressedDxt3Rgba
  | -- | 8 bpp

    RLPixelFormatCompressedDxt5Rgba
  | -- | 4 bpp

    RLPixelFormatCompressedEtc1Rgb
  | -- | 4 bpp

    RLPixelFormatCompressedEtc2Rgb
  | -- | 8 bpp

    RLPixelFormatCompressedEtc2EacRgba
  | -- | 4 bpp

    RLPixelFormatCompressedPvrtRgb
  | -- | 4 bpp

    RLPixelFormatCompressedPvrtRgba
  | -- | 8 bpp

    RLPixelFormatCompressedAstc4x4Rgba
  | -- | 2 bpp

    RLPixelFormatCompressedAstc8x8Rgba
  deriving (RLPixelFormat -> RLPixelFormat -> Bool
(RLPixelFormat -> RLPixelFormat -> Bool)
-> (RLPixelFormat -> RLPixelFormat -> Bool) -> Eq RLPixelFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLPixelFormat -> RLPixelFormat -> Bool
== :: RLPixelFormat -> RLPixelFormat -> Bool
$c/= :: RLPixelFormat -> RLPixelFormat -> Bool
/= :: RLPixelFormat -> RLPixelFormat -> Bool
Eq, Int -> RLPixelFormat -> ShowS
[RLPixelFormat] -> ShowS
RLPixelFormat -> String
(Int -> RLPixelFormat -> ShowS)
-> (RLPixelFormat -> String)
-> ([RLPixelFormat] -> ShowS)
-> Show RLPixelFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLPixelFormat -> ShowS
showsPrec :: Int -> RLPixelFormat -> ShowS
$cshow :: RLPixelFormat -> String
show :: RLPixelFormat -> String
$cshowList :: [RLPixelFormat] -> ShowS
showList :: [RLPixelFormat] -> ShowS
Show)

instance Enum RLPixelFormat where
  fromEnum :: RLPixelFormat -> Int
fromEnum RLPixelFormat
n = case RLPixelFormat
n of
    RLPixelFormat
RLPixelFormatUncompressedGrayscale -> Int
1
    RLPixelFormat
RLPixelFormatUncompressedGrayAlpha -> Int
2
    RLPixelFormat
RLPixelFormatUncompressedR5G6B5 -> Int
3
    RLPixelFormat
RLPixelFormatUncompressedR8G8B8 -> Int
4
    RLPixelFormat
RLPixelFormatUncompressedR5G5B5A1 -> Int
5
    RLPixelFormat
RLPixelFormatUncompressedR4G4B4A4 -> Int
6
    RLPixelFormat
RLPixelFormatUncompressedR8G8B8A8 -> Int
7
    RLPixelFormat
RLPixelFormatUncompressedR32 -> Int
8
    RLPixelFormat
RLPixelFormatUncompressedR32G32B32 -> Int
9
    RLPixelFormat
RLPixelFormatUncompressedR32G32B32A32 -> Int
10
    RLPixelFormat
RLPixelFormatUncompressedR16 -> Int
11
    RLPixelFormat
RLPixelFormatUncompressedR16G16B16 -> Int
12
    RLPixelFormat
RLPixelFormatUncompressedR16G16B16A16 -> Int
13
    RLPixelFormat
RLPixelFormatCompressedDxt1Rgb -> Int
14
    RLPixelFormat
RLPixelFormatCompressedDxt1Rgba -> Int
15
    RLPixelFormat
RLPixelFormatCompressedDxt3Rgba -> Int
16
    RLPixelFormat
RLPixelFormatCompressedDxt5Rgba -> Int
17
    RLPixelFormat
RLPixelFormatCompressedEtc1Rgb -> Int
18
    RLPixelFormat
RLPixelFormatCompressedEtc2Rgb -> Int
19
    RLPixelFormat
RLPixelFormatCompressedEtc2EacRgba -> Int
20
    RLPixelFormat
RLPixelFormatCompressedPvrtRgb -> Int
21
    RLPixelFormat
RLPixelFormatCompressedPvrtRgba -> Int
22
    RLPixelFormat
RLPixelFormatCompressedAstc4x4Rgba -> Int
23
    RLPixelFormat
RLPixelFormatCompressedAstc8x8Rgba -> Int
24

  toEnum :: Int -> RLPixelFormat
toEnum Int
n = case Int
n of
    Int
1 -> RLPixelFormat
RLPixelFormatUncompressedGrayscale
    Int
2 -> RLPixelFormat
RLPixelFormatUncompressedGrayAlpha
    Int
3 -> RLPixelFormat
RLPixelFormatUncompressedR5G6B5
    Int
4 -> RLPixelFormat
RLPixelFormatUncompressedR8G8B8
    Int
5 -> RLPixelFormat
RLPixelFormatUncompressedR5G5B5A1
    Int
6 -> RLPixelFormat
RLPixelFormatUncompressedR4G4B4A4
    Int
7 -> RLPixelFormat
RLPixelFormatUncompressedR8G8B8A8
    Int
8 -> RLPixelFormat
RLPixelFormatUncompressedR32
    Int
9 -> RLPixelFormat
RLPixelFormatUncompressedR32G32B32
    Int
10 -> RLPixelFormat
RLPixelFormatUncompressedR32G32B32A32
    Int
11 -> RLPixelFormat
RLPixelFormatUncompressedR16
    Int
12 -> RLPixelFormat
RLPixelFormatUncompressedR16G16B16
    Int
13 -> RLPixelFormat
RLPixelFormatUncompressedR16G16B16A16
    Int
14 -> RLPixelFormat
RLPixelFormatCompressedDxt1Rgb
    Int
15 -> RLPixelFormat
RLPixelFormatCompressedDxt1Rgba
    Int
16 -> RLPixelFormat
RLPixelFormatCompressedDxt3Rgba
    Int
17 -> RLPixelFormat
RLPixelFormatCompressedDxt5Rgba
    Int
18 -> RLPixelFormat
RLPixelFormatCompressedEtc1Rgb
    Int
19 -> RLPixelFormat
RLPixelFormatCompressedEtc2Rgb
    Int
20 -> RLPixelFormat
RLPixelFormatCompressedEtc2EacRgba
    Int
21 -> RLPixelFormat
RLPixelFormatCompressedPvrtRgb
    Int
22 -> RLPixelFormat
RLPixelFormatCompressedPvrtRgba
    Int
23 -> RLPixelFormat
RLPixelFormatCompressedAstc4x4Rgba
    Int
24 -> RLPixelFormat
RLPixelFormatCompressedAstc8x8Rgba
    Int
_ -> String -> RLPixelFormat
forall a. HasCallStack => String -> a
error (String -> RLPixelFormat) -> String -> RLPixelFormat
forall a b. (a -> b) -> a -> b
$ String
"(RLPixelFormat.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLPixelFormat where
  sizeOf :: RLPixelFormat -> Int
sizeOf RLPixelFormat
_ = Int
4
  alignment :: RLPixelFormat -> Int
alignment RLPixelFormat
_ = Int
4
  peek :: Ptr RLPixelFormat -> IO RLPixelFormat
peek Ptr RLPixelFormat
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLPixelFormat -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLPixelFormat
ptr)
    RLPixelFormat -> IO RLPixelFormat
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLPixelFormat -> IO RLPixelFormat)
-> RLPixelFormat -> IO RLPixelFormat
forall a b. (a -> b) -> a -> b
$ Int -> RLPixelFormat
forall a. Enum a => Int -> a
toEnum (Int -> RLPixelFormat) -> Int -> RLPixelFormat
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLPixelFormat -> RLPixelFormat -> IO ()
poke Ptr RLPixelFormat
ptr RLPixelFormat
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLPixelFormat -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLPixelFormat
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLPixelFormat -> Int
forall a. Enum a => a -> Int
fromEnum RLPixelFormat
v) :: CInt)

-- | Texture parameters: filter mode.

-- NOTE 1: Filtering considers mipmaps if available in the texture.

-- NOTE 2: Filter is accordingly set for minification and magnification.

data RLTextureFilter
  = -- | No filter, just pixel approximation

    RLTextureFilterPoint
  | -- | Linear filtering

    RLTextureFilterBilinear
  | -- | Trilinear filtering (linear with mipmaps)

    RLTextureFilterTrilinear
  | -- | Anisotropic filtering 4x

    RLTextureFilterAnisotropic4x
  | -- | Anisotropic filtering 8x

    RLTextureFilterAnisotropic8x
  | -- | Anisotropic filtering 16x

    RLTextureFilterAnisotropic16x
  deriving (RLTextureFilter -> RLTextureFilter -> Bool
(RLTextureFilter -> RLTextureFilter -> Bool)
-> (RLTextureFilter -> RLTextureFilter -> Bool)
-> Eq RLTextureFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLTextureFilter -> RLTextureFilter -> Bool
== :: RLTextureFilter -> RLTextureFilter -> Bool
$c/= :: RLTextureFilter -> RLTextureFilter -> Bool
/= :: RLTextureFilter -> RLTextureFilter -> Bool
Eq, Int -> RLTextureFilter -> ShowS
[RLTextureFilter] -> ShowS
RLTextureFilter -> String
(Int -> RLTextureFilter -> ShowS)
-> (RLTextureFilter -> String)
-> ([RLTextureFilter] -> ShowS)
-> Show RLTextureFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLTextureFilter -> ShowS
showsPrec :: Int -> RLTextureFilter -> ShowS
$cshow :: RLTextureFilter -> String
show :: RLTextureFilter -> String
$cshowList :: [RLTextureFilter] -> ShowS
showList :: [RLTextureFilter] -> ShowS
Show, Int -> RLTextureFilter
RLTextureFilter -> Int
RLTextureFilter -> [RLTextureFilter]
RLTextureFilter -> RLTextureFilter
RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
RLTextureFilter
-> RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
(RLTextureFilter -> RLTextureFilter)
-> (RLTextureFilter -> RLTextureFilter)
-> (Int -> RLTextureFilter)
-> (RLTextureFilter -> Int)
-> (RLTextureFilter -> [RLTextureFilter])
-> (RLTextureFilter -> RLTextureFilter -> [RLTextureFilter])
-> (RLTextureFilter -> RLTextureFilter -> [RLTextureFilter])
-> (RLTextureFilter
    -> RLTextureFilter -> RLTextureFilter -> [RLTextureFilter])
-> Enum RLTextureFilter
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLTextureFilter -> RLTextureFilter
succ :: RLTextureFilter -> RLTextureFilter
$cpred :: RLTextureFilter -> RLTextureFilter
pred :: RLTextureFilter -> RLTextureFilter
$ctoEnum :: Int -> RLTextureFilter
toEnum :: Int -> RLTextureFilter
$cfromEnum :: RLTextureFilter -> Int
fromEnum :: RLTextureFilter -> Int
$cenumFrom :: RLTextureFilter -> [RLTextureFilter]
enumFrom :: RLTextureFilter -> [RLTextureFilter]
$cenumFromThen :: RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
enumFromThen :: RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
$cenumFromTo :: RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
enumFromTo :: RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
$cenumFromThenTo :: RLTextureFilter
-> RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
enumFromThenTo :: RLTextureFilter
-> RLTextureFilter -> RLTextureFilter -> [RLTextureFilter]
Enum)

instance Storable RLTextureFilter where
  sizeOf :: RLTextureFilter -> Int
sizeOf RLTextureFilter
_ = Int
4
  alignment :: RLTextureFilter -> Int
alignment RLTextureFilter
_ = Int
4
  peek :: Ptr RLTextureFilter -> IO RLTextureFilter
peek Ptr RLTextureFilter
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLTextureFilter -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLTextureFilter
ptr)
    RLTextureFilter -> IO RLTextureFilter
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLTextureFilter -> IO RLTextureFilter)
-> RLTextureFilter -> IO RLTextureFilter
forall a b. (a -> b) -> a -> b
$ Int -> RLTextureFilter
forall a. Enum a => Int -> a
toEnum (Int -> RLTextureFilter) -> Int -> RLTextureFilter
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLTextureFilter -> RLTextureFilter -> IO ()
poke Ptr RLTextureFilter
ptr RLTextureFilter
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLTextureFilter -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLTextureFilter
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLTextureFilter -> Int
forall a. Enum a => a -> Int
fromEnum RLTextureFilter
v) :: CInt)

-- | Color blending modes (pre-defined)

data RLBlendMode
  = -- | Blend textures considering alpha (default)

    RlBlendAlpha
  | -- | Blend textures adding colors

    RlBlendAdditive
  | -- | Blend textures multiplying colors

    RlBlendMultiplied
  | -- | Blend textures adding colors (alternative)

    RlBlendAddColors
  | -- | Blend textures subtracting colors (alternative)

    RlBlendSubtractColors
  | -- | Blend premultiplied textures considering alpha

    RlBlendAlphaPremultiply
  | -- | Blend textures using custom src/dst factors (use rlSetBlendFactors())

    RlBlendCustom
  | -- | Blend textures using custom src/dst factors (use rlSetBlendFactorsSeparate())

    RlBlendCustomSeparate
  deriving (RLBlendMode -> RLBlendMode -> Bool
(RLBlendMode -> RLBlendMode -> Bool)
-> (RLBlendMode -> RLBlendMode -> Bool) -> Eq RLBlendMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLBlendMode -> RLBlendMode -> Bool
== :: RLBlendMode -> RLBlendMode -> Bool
$c/= :: RLBlendMode -> RLBlendMode -> Bool
/= :: RLBlendMode -> RLBlendMode -> Bool
Eq, Int -> RLBlendMode -> ShowS
[RLBlendMode] -> ShowS
RLBlendMode -> String
(Int -> RLBlendMode -> ShowS)
-> (RLBlendMode -> String)
-> ([RLBlendMode] -> ShowS)
-> Show RLBlendMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLBlendMode -> ShowS
showsPrec :: Int -> RLBlendMode -> ShowS
$cshow :: RLBlendMode -> String
show :: RLBlendMode -> String
$cshowList :: [RLBlendMode] -> ShowS
showList :: [RLBlendMode] -> ShowS
Show, Int -> RLBlendMode
RLBlendMode -> Int
RLBlendMode -> [RLBlendMode]
RLBlendMode -> RLBlendMode
RLBlendMode -> RLBlendMode -> [RLBlendMode]
RLBlendMode -> RLBlendMode -> RLBlendMode -> [RLBlendMode]
(RLBlendMode -> RLBlendMode)
-> (RLBlendMode -> RLBlendMode)
-> (Int -> RLBlendMode)
-> (RLBlendMode -> Int)
-> (RLBlendMode -> [RLBlendMode])
-> (RLBlendMode -> RLBlendMode -> [RLBlendMode])
-> (RLBlendMode -> RLBlendMode -> [RLBlendMode])
-> (RLBlendMode -> RLBlendMode -> RLBlendMode -> [RLBlendMode])
-> Enum RLBlendMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLBlendMode -> RLBlendMode
succ :: RLBlendMode -> RLBlendMode
$cpred :: RLBlendMode -> RLBlendMode
pred :: RLBlendMode -> RLBlendMode
$ctoEnum :: Int -> RLBlendMode
toEnum :: Int -> RLBlendMode
$cfromEnum :: RLBlendMode -> Int
fromEnum :: RLBlendMode -> Int
$cenumFrom :: RLBlendMode -> [RLBlendMode]
enumFrom :: RLBlendMode -> [RLBlendMode]
$cenumFromThen :: RLBlendMode -> RLBlendMode -> [RLBlendMode]
enumFromThen :: RLBlendMode -> RLBlendMode -> [RLBlendMode]
$cenumFromTo :: RLBlendMode -> RLBlendMode -> [RLBlendMode]
enumFromTo :: RLBlendMode -> RLBlendMode -> [RLBlendMode]
$cenumFromThenTo :: RLBlendMode -> RLBlendMode -> RLBlendMode -> [RLBlendMode]
enumFromThenTo :: RLBlendMode -> RLBlendMode -> RLBlendMode -> [RLBlendMode]
Enum)

instance Storable RLBlendMode where
  sizeOf :: RLBlendMode -> Int
sizeOf RLBlendMode
_ = Int
4
  alignment :: RLBlendMode -> Int
alignment RLBlendMode
_ = Int
4
  peek :: Ptr RLBlendMode -> IO RLBlendMode
peek Ptr RLBlendMode
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLBlendMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLBlendMode
ptr)
    RLBlendMode -> IO RLBlendMode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLBlendMode -> IO RLBlendMode) -> RLBlendMode -> IO RLBlendMode
forall a b. (a -> b) -> a -> b
$ Int -> RLBlendMode
forall a. Enum a => Int -> a
toEnum (Int -> RLBlendMode) -> Int -> RLBlendMode
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLBlendMode -> RLBlendMode -> IO ()
poke Ptr RLBlendMode
ptr RLBlendMode
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLBlendMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLBlendMode
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLBlendMode -> Int
forall a. Enum a => a -> Int
fromEnum RLBlendMode
v) :: CInt)

-- | Shader location point type

data RLShaderLocationIndex
  = -- | Shader location: vertex attribute: position

    RLShaderLocVertexPosition
  | -- | Shader location: vertex attribute: texcoord01

    RLShaderLocVertexTexcoord01
  | -- | Shader location: vertex attribute: texcoord02

    RLShaderLocVertexTexcoord02
  | -- | Shader location: vertex attribute: normal

    RLShaderLocVertexNormal
  | -- | Shader location: vertex attribute: tangent

    RLShaderLocVertexTangent
  | -- | Shader location: vertex attribute: color

    RLShaderLocVertexColor
  | -- | Shader location: matrix uniform: model-view-projection

    RLShaderLocMatrixMVP
  | -- | Shader location: matrix uniform: view (camera transform)

    RLShaderLocMatrixView
  | -- | Shader location: matrix uniform: projection

    RLShaderLocMatrixProjection
  | -- | Shader location: matrix uniform: model (transform)

    RLShaderLocMatrixModel
  | -- | Shader location: matrix uniform: normal

    RLShaderLocMatrixNormal
  | -- | Shader location: vector uniform: view

    RLShaderLocVectorView
  | -- | Shader location: vector uniform: diffuse color

    RLShaderLocColorDiffuse
  | -- | Shader location: vector uniform: specular color

    RLShaderLocColorSpecular
  | -- | Shader location: vector uniform: ambient color

    RLShaderLocColorAmbient
  | -- | Shader location: sampler2d texture: albedo (same as: RL_SHADER_LOC_MAP_DIFFUSE)

    RLShaderLocMapAlbedo
  | -- | Shader location: sampler2d texture: metalness (same as: RL_SHADER_LOC_MAP_SPECULAR)

    RLShaderLocMapMetalness
  | -- | Shader location: sampler2d texture: normal

    RLShaderLocMapNormal
  | -- | Shader location: sampler2d texture: roughness

    RLShaderLocMapRoughness
  | -- | Shader location: sampler2d texture: occlusion

    RLShaderLocMapOcclusion
  | -- | Shader location: sampler2d texture: emission

    RLShaderLocMapEmission
  | -- | Shader location: sampler2d texture: height

    RLShaderLocMapHeight
  | -- | Shader location: samplerCube texture: cubemap

    RLShaderLocMapCubemap
  | -- | Shader location: samplerCube texture: irradiance

    RLShaderLocMapIrradiance
  | -- | Shader location: samplerCube texture: prefilter

    RLShaderLocMapPrefilter
  | -- | Shader location: sampler2d texture: brdf

    RLShaderLocMapBRDF
  deriving (RLShaderLocationIndex -> RLShaderLocationIndex -> Bool
(RLShaderLocationIndex -> RLShaderLocationIndex -> Bool)
-> (RLShaderLocationIndex -> RLShaderLocationIndex -> Bool)
-> Eq RLShaderLocationIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLShaderLocationIndex -> RLShaderLocationIndex -> Bool
== :: RLShaderLocationIndex -> RLShaderLocationIndex -> Bool
$c/= :: RLShaderLocationIndex -> RLShaderLocationIndex -> Bool
/= :: RLShaderLocationIndex -> RLShaderLocationIndex -> Bool
Eq, Int -> RLShaderLocationIndex -> ShowS
[RLShaderLocationIndex] -> ShowS
RLShaderLocationIndex -> String
(Int -> RLShaderLocationIndex -> ShowS)
-> (RLShaderLocationIndex -> String)
-> ([RLShaderLocationIndex] -> ShowS)
-> Show RLShaderLocationIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLShaderLocationIndex -> ShowS
showsPrec :: Int -> RLShaderLocationIndex -> ShowS
$cshow :: RLShaderLocationIndex -> String
show :: RLShaderLocationIndex -> String
$cshowList :: [RLShaderLocationIndex] -> ShowS
showList :: [RLShaderLocationIndex] -> ShowS
Show, Int -> RLShaderLocationIndex
RLShaderLocationIndex -> Int
RLShaderLocationIndex -> [RLShaderLocationIndex]
RLShaderLocationIndex -> RLShaderLocationIndex
RLShaderLocationIndex
-> RLShaderLocationIndex -> [RLShaderLocationIndex]
RLShaderLocationIndex
-> RLShaderLocationIndex
-> RLShaderLocationIndex
-> [RLShaderLocationIndex]
(RLShaderLocationIndex -> RLShaderLocationIndex)
-> (RLShaderLocationIndex -> RLShaderLocationIndex)
-> (Int -> RLShaderLocationIndex)
-> (RLShaderLocationIndex -> Int)
-> (RLShaderLocationIndex -> [RLShaderLocationIndex])
-> (RLShaderLocationIndex
    -> RLShaderLocationIndex -> [RLShaderLocationIndex])
-> (RLShaderLocationIndex
    -> RLShaderLocationIndex -> [RLShaderLocationIndex])
-> (RLShaderLocationIndex
    -> RLShaderLocationIndex
    -> RLShaderLocationIndex
    -> [RLShaderLocationIndex])
-> Enum RLShaderLocationIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLShaderLocationIndex -> RLShaderLocationIndex
succ :: RLShaderLocationIndex -> RLShaderLocationIndex
$cpred :: RLShaderLocationIndex -> RLShaderLocationIndex
pred :: RLShaderLocationIndex -> RLShaderLocationIndex
$ctoEnum :: Int -> RLShaderLocationIndex
toEnum :: Int -> RLShaderLocationIndex
$cfromEnum :: RLShaderLocationIndex -> Int
fromEnum :: RLShaderLocationIndex -> Int
$cenumFrom :: RLShaderLocationIndex -> [RLShaderLocationIndex]
enumFrom :: RLShaderLocationIndex -> [RLShaderLocationIndex]
$cenumFromThen :: RLShaderLocationIndex
-> RLShaderLocationIndex -> [RLShaderLocationIndex]
enumFromThen :: RLShaderLocationIndex
-> RLShaderLocationIndex -> [RLShaderLocationIndex]
$cenumFromTo :: RLShaderLocationIndex
-> RLShaderLocationIndex -> [RLShaderLocationIndex]
enumFromTo :: RLShaderLocationIndex
-> RLShaderLocationIndex -> [RLShaderLocationIndex]
$cenumFromThenTo :: RLShaderLocationIndex
-> RLShaderLocationIndex
-> RLShaderLocationIndex
-> [RLShaderLocationIndex]
enumFromThenTo :: RLShaderLocationIndex
-> RLShaderLocationIndex
-> RLShaderLocationIndex
-> [RLShaderLocationIndex]
Enum)

instance Storable RLShaderLocationIndex where
  sizeOf :: RLShaderLocationIndex -> Int
sizeOf RLShaderLocationIndex
_ = Int
4
  alignment :: RLShaderLocationIndex -> Int
alignment RLShaderLocationIndex
_ = Int
4
  peek :: Ptr RLShaderLocationIndex -> IO RLShaderLocationIndex
peek Ptr RLShaderLocationIndex
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLShaderLocationIndex -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderLocationIndex
ptr)
    RLShaderLocationIndex -> IO RLShaderLocationIndex
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLShaderLocationIndex -> IO RLShaderLocationIndex)
-> RLShaderLocationIndex -> IO RLShaderLocationIndex
forall a b. (a -> b) -> a -> b
$ Int -> RLShaderLocationIndex
forall a. Enum a => Int -> a
toEnum (Int -> RLShaderLocationIndex) -> Int -> RLShaderLocationIndex
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLShaderLocationIndex -> RLShaderLocationIndex -> IO ()
poke Ptr RLShaderLocationIndex
ptr RLShaderLocationIndex
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLShaderLocationIndex -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderLocationIndex
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLShaderLocationIndex -> Int
forall a. Enum a => a -> Int
fromEnum RLShaderLocationIndex
v) :: CInt)

-- | Shader uniform data type

data RLShaderUniformDataType
  = -- | Shader uniform type: float

    RLShaderUniformFloat
  | -- | Shader uniform type: vec2 (2 float)

    RLShaderUniformVec2
  | -- | Shader uniform type: vec3 (3 float)

    RLShaderUniformVec3
  | -- | Shader uniform type: vec4 (4 float)

    RLShaderUniformVec4
  | -- | Shader uniform type: int

    RLShaderUniformInt
  | -- | Shader uniform type: ivec2 (2 int)

    RLShaderUniformIVec2
  | -- | Shader uniform type: ivec3 (3 int)

    RLShaderUniformIVec3
  | -- | Shader uniform type: ivec4 (4 int)

    RLShaderUniformIVec4
  | -- | Shader uniform type: sampler2d

    RLShaderUniformSampler2D
  deriving (RLShaderUniformDataType -> RLShaderUniformDataType -> Bool
(RLShaderUniformDataType -> RLShaderUniformDataType -> Bool)
-> (RLShaderUniformDataType -> RLShaderUniformDataType -> Bool)
-> Eq RLShaderUniformDataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLShaderUniformDataType -> RLShaderUniformDataType -> Bool
== :: RLShaderUniformDataType -> RLShaderUniformDataType -> Bool
$c/= :: RLShaderUniformDataType -> RLShaderUniformDataType -> Bool
/= :: RLShaderUniformDataType -> RLShaderUniformDataType -> Bool
Eq, Int -> RLShaderUniformDataType -> ShowS
[RLShaderUniformDataType] -> ShowS
RLShaderUniformDataType -> String
(Int -> RLShaderUniformDataType -> ShowS)
-> (RLShaderUniformDataType -> String)
-> ([RLShaderUniformDataType] -> ShowS)
-> Show RLShaderUniformDataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLShaderUniformDataType -> ShowS
showsPrec :: Int -> RLShaderUniformDataType -> ShowS
$cshow :: RLShaderUniformDataType -> String
show :: RLShaderUniformDataType -> String
$cshowList :: [RLShaderUniformDataType] -> ShowS
showList :: [RLShaderUniformDataType] -> ShowS
Show, Int -> RLShaderUniformDataType
RLShaderUniformDataType -> Int
RLShaderUniformDataType -> [RLShaderUniformDataType]
RLShaderUniformDataType -> RLShaderUniformDataType
RLShaderUniformDataType
-> RLShaderUniformDataType -> [RLShaderUniformDataType]
RLShaderUniformDataType
-> RLShaderUniformDataType
-> RLShaderUniformDataType
-> [RLShaderUniformDataType]
(RLShaderUniformDataType -> RLShaderUniformDataType)
-> (RLShaderUniformDataType -> RLShaderUniformDataType)
-> (Int -> RLShaderUniformDataType)
-> (RLShaderUniformDataType -> Int)
-> (RLShaderUniformDataType -> [RLShaderUniformDataType])
-> (RLShaderUniformDataType
    -> RLShaderUniformDataType -> [RLShaderUniformDataType])
-> (RLShaderUniformDataType
    -> RLShaderUniformDataType -> [RLShaderUniformDataType])
-> (RLShaderUniformDataType
    -> RLShaderUniformDataType
    -> RLShaderUniformDataType
    -> [RLShaderUniformDataType])
-> Enum RLShaderUniformDataType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLShaderUniformDataType -> RLShaderUniformDataType
succ :: RLShaderUniformDataType -> RLShaderUniformDataType
$cpred :: RLShaderUniformDataType -> RLShaderUniformDataType
pred :: RLShaderUniformDataType -> RLShaderUniformDataType
$ctoEnum :: Int -> RLShaderUniformDataType
toEnum :: Int -> RLShaderUniformDataType
$cfromEnum :: RLShaderUniformDataType -> Int
fromEnum :: RLShaderUniformDataType -> Int
$cenumFrom :: RLShaderUniformDataType -> [RLShaderUniformDataType]
enumFrom :: RLShaderUniformDataType -> [RLShaderUniformDataType]
$cenumFromThen :: RLShaderUniformDataType
-> RLShaderUniformDataType -> [RLShaderUniformDataType]
enumFromThen :: RLShaderUniformDataType
-> RLShaderUniformDataType -> [RLShaderUniformDataType]
$cenumFromTo :: RLShaderUniformDataType
-> RLShaderUniformDataType -> [RLShaderUniformDataType]
enumFromTo :: RLShaderUniformDataType
-> RLShaderUniformDataType -> [RLShaderUniformDataType]
$cenumFromThenTo :: RLShaderUniformDataType
-> RLShaderUniformDataType
-> RLShaderUniformDataType
-> [RLShaderUniformDataType]
enumFromThenTo :: RLShaderUniformDataType
-> RLShaderUniformDataType
-> RLShaderUniformDataType
-> [RLShaderUniformDataType]
Enum)

instance Storable RLShaderUniformDataType where
  sizeOf :: RLShaderUniformDataType -> Int
sizeOf RLShaderUniformDataType
_ = Int
4
  alignment :: RLShaderUniformDataType -> Int
alignment RLShaderUniformDataType
_ = Int
4
  peek :: Ptr RLShaderUniformDataType -> IO RLShaderUniformDataType
peek Ptr RLShaderUniformDataType
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLShaderUniformDataType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderUniformDataType
ptr)
    RLShaderUniformDataType -> IO RLShaderUniformDataType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLShaderUniformDataType -> IO RLShaderUniformDataType)
-> RLShaderUniformDataType -> IO RLShaderUniformDataType
forall a b. (a -> b) -> a -> b
$ Int -> RLShaderUniformDataType
forall a. Enum a => Int -> a
toEnum (Int -> RLShaderUniformDataType) -> Int -> RLShaderUniformDataType
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLShaderUniformDataType -> RLShaderUniformDataType -> IO ()
poke Ptr RLShaderUniformDataType
ptr RLShaderUniformDataType
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLShaderUniformDataType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderUniformDataType
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLShaderUniformDataType -> Int
forall a. Enum a => a -> Int
fromEnum RLShaderUniformDataType
v) :: CInt)

-- | Shader attribute data types

data RLShaderAttributeDataType
  = -- | Shader attribute type: float

    RLShaderAttribFloat
  | -- | Shader attribute type: vec2 (2 float)

    RLShaderAttribVec2
  | -- | Shader attribute type: vec3 (3 float)

    RLShaderAttribVec3
  | -- | Shader attribute type: vec4 (4 float)

    RLShaderAttribVec4
  deriving (RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool
(RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool)
-> (RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool)
-> Eq RLShaderAttributeDataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool
== :: RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool
$c/= :: RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool
/= :: RLShaderAttributeDataType -> RLShaderAttributeDataType -> Bool
Eq, Int -> RLShaderAttributeDataType -> ShowS
[RLShaderAttributeDataType] -> ShowS
RLShaderAttributeDataType -> String
(Int -> RLShaderAttributeDataType -> ShowS)
-> (RLShaderAttributeDataType -> String)
-> ([RLShaderAttributeDataType] -> ShowS)
-> Show RLShaderAttributeDataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLShaderAttributeDataType -> ShowS
showsPrec :: Int -> RLShaderAttributeDataType -> ShowS
$cshow :: RLShaderAttributeDataType -> String
show :: RLShaderAttributeDataType -> String
$cshowList :: [RLShaderAttributeDataType] -> ShowS
showList :: [RLShaderAttributeDataType] -> ShowS
Show, Int -> RLShaderAttributeDataType
RLShaderAttributeDataType -> Int
RLShaderAttributeDataType -> [RLShaderAttributeDataType]
RLShaderAttributeDataType -> RLShaderAttributeDataType
RLShaderAttributeDataType
-> RLShaderAttributeDataType -> [RLShaderAttributeDataType]
RLShaderAttributeDataType
-> RLShaderAttributeDataType
-> RLShaderAttributeDataType
-> [RLShaderAttributeDataType]
(RLShaderAttributeDataType -> RLShaderAttributeDataType)
-> (RLShaderAttributeDataType -> RLShaderAttributeDataType)
-> (Int -> RLShaderAttributeDataType)
-> (RLShaderAttributeDataType -> Int)
-> (RLShaderAttributeDataType -> [RLShaderAttributeDataType])
-> (RLShaderAttributeDataType
    -> RLShaderAttributeDataType -> [RLShaderAttributeDataType])
-> (RLShaderAttributeDataType
    -> RLShaderAttributeDataType -> [RLShaderAttributeDataType])
-> (RLShaderAttributeDataType
    -> RLShaderAttributeDataType
    -> RLShaderAttributeDataType
    -> [RLShaderAttributeDataType])
-> Enum RLShaderAttributeDataType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLShaderAttributeDataType -> RLShaderAttributeDataType
succ :: RLShaderAttributeDataType -> RLShaderAttributeDataType
$cpred :: RLShaderAttributeDataType -> RLShaderAttributeDataType
pred :: RLShaderAttributeDataType -> RLShaderAttributeDataType
$ctoEnum :: Int -> RLShaderAttributeDataType
toEnum :: Int -> RLShaderAttributeDataType
$cfromEnum :: RLShaderAttributeDataType -> Int
fromEnum :: RLShaderAttributeDataType -> Int
$cenumFrom :: RLShaderAttributeDataType -> [RLShaderAttributeDataType]
enumFrom :: RLShaderAttributeDataType -> [RLShaderAttributeDataType]
$cenumFromThen :: RLShaderAttributeDataType
-> RLShaderAttributeDataType -> [RLShaderAttributeDataType]
enumFromThen :: RLShaderAttributeDataType
-> RLShaderAttributeDataType -> [RLShaderAttributeDataType]
$cenumFromTo :: RLShaderAttributeDataType
-> RLShaderAttributeDataType -> [RLShaderAttributeDataType]
enumFromTo :: RLShaderAttributeDataType
-> RLShaderAttributeDataType -> [RLShaderAttributeDataType]
$cenumFromThenTo :: RLShaderAttributeDataType
-> RLShaderAttributeDataType
-> RLShaderAttributeDataType
-> [RLShaderAttributeDataType]
enumFromThenTo :: RLShaderAttributeDataType
-> RLShaderAttributeDataType
-> RLShaderAttributeDataType
-> [RLShaderAttributeDataType]
Enum)

instance Storable RLShaderAttributeDataType where
  sizeOf :: RLShaderAttributeDataType -> Int
sizeOf RLShaderAttributeDataType
_ = Int
4
  alignment :: RLShaderAttributeDataType -> Int
alignment RLShaderAttributeDataType
_ = Int
4
  peek :: Ptr RLShaderAttributeDataType -> IO RLShaderAttributeDataType
peek Ptr RLShaderAttributeDataType
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLShaderAttributeDataType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderAttributeDataType
ptr)
    RLShaderAttributeDataType -> IO RLShaderAttributeDataType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLShaderAttributeDataType -> IO RLShaderAttributeDataType)
-> RLShaderAttributeDataType -> IO RLShaderAttributeDataType
forall a b. (a -> b) -> a -> b
$ Int -> RLShaderAttributeDataType
forall a. Enum a => Int -> a
toEnum (Int -> RLShaderAttributeDataType)
-> Int -> RLShaderAttributeDataType
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLShaderAttributeDataType -> RLShaderAttributeDataType -> IO ()
poke Ptr RLShaderAttributeDataType
ptr RLShaderAttributeDataType
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLShaderAttributeDataType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderAttributeDataType
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLShaderAttributeDataType -> Int
forall a. Enum a => a -> Int
fromEnum RLShaderAttributeDataType
v) :: CInt)

-- | Framebuffer attachment type.

-- NOTE: By default up to 8 color channels are defined, but it can be more

data RLFramebufferAttachType
  = -- | Framebuffer attachment type: color 0

    RLAttachmentColorChannel0
  | -- | Framebuffer attachment type: color 1

    RLAttachmentColorChannel1
  | -- | Framebuffer attachment type: color 2

    RLAttachmentColorChannel2
  | -- | Framebuffer attachment type: color 3

    RLAttachmentColorChannel3
  | -- | Framebuffer attachment type: color 4

    RLAttachmentColorChannel4
  | -- | Framebuffer attachment type: color 5

    RLAttachmentColorChannel5
  | -- | Framebuffer attachment type: color 6

    RLAttachmentColorChannel6
  | -- | Framebuffer attachment type: color 7

    RLAttachmentColorChannel7
  | -- | Framebuffer attachment type: depth

    RLAttachmentDepth
  | -- | Framebuffer attachment type: stencil

    RLAttachmentStencil
  deriving (RLFramebufferAttachType -> RLFramebufferAttachType -> Bool
(RLFramebufferAttachType -> RLFramebufferAttachType -> Bool)
-> (RLFramebufferAttachType -> RLFramebufferAttachType -> Bool)
-> Eq RLFramebufferAttachType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLFramebufferAttachType -> RLFramebufferAttachType -> Bool
== :: RLFramebufferAttachType -> RLFramebufferAttachType -> Bool
$c/= :: RLFramebufferAttachType -> RLFramebufferAttachType -> Bool
/= :: RLFramebufferAttachType -> RLFramebufferAttachType -> Bool
Eq, Int -> RLFramebufferAttachType -> ShowS
[RLFramebufferAttachType] -> ShowS
RLFramebufferAttachType -> String
(Int -> RLFramebufferAttachType -> ShowS)
-> (RLFramebufferAttachType -> String)
-> ([RLFramebufferAttachType] -> ShowS)
-> Show RLFramebufferAttachType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLFramebufferAttachType -> ShowS
showsPrec :: Int -> RLFramebufferAttachType -> ShowS
$cshow :: RLFramebufferAttachType -> String
show :: RLFramebufferAttachType -> String
$cshowList :: [RLFramebufferAttachType] -> ShowS
showList :: [RLFramebufferAttachType] -> ShowS
Show)

instance Enum RLFramebufferAttachType where
  fromEnum :: RLFramebufferAttachType -> Int
fromEnum RLFramebufferAttachType
n = case RLFramebufferAttachType
n of
    RLFramebufferAttachType
RLAttachmentColorChannel0 -> Int
0
    RLFramebufferAttachType
RLAttachmentColorChannel1 -> Int
1
    RLFramebufferAttachType
RLAttachmentColorChannel2 -> Int
2
    RLFramebufferAttachType
RLAttachmentColorChannel3 -> Int
3
    RLFramebufferAttachType
RLAttachmentColorChannel4 -> Int
4
    RLFramebufferAttachType
RLAttachmentColorChannel5 -> Int
5
    RLFramebufferAttachType
RLAttachmentColorChannel6 -> Int
6
    RLFramebufferAttachType
RLAttachmentColorChannel7 -> Int
7
    RLFramebufferAttachType
RLAttachmentDepth -> Int
100
    RLFramebufferAttachType
RLAttachmentStencil -> Int
200

  toEnum :: Int -> RLFramebufferAttachType
toEnum Int
n = case Int
n of
    Int
0 -> RLFramebufferAttachType
RLAttachmentColorChannel0
    Int
1 -> RLFramebufferAttachType
RLAttachmentColorChannel1
    Int
2 -> RLFramebufferAttachType
RLAttachmentColorChannel2
    Int
3 -> RLFramebufferAttachType
RLAttachmentColorChannel3
    Int
4 -> RLFramebufferAttachType
RLAttachmentColorChannel4
    Int
5 -> RLFramebufferAttachType
RLAttachmentColorChannel5
    Int
6 -> RLFramebufferAttachType
RLAttachmentColorChannel6
    Int
7 -> RLFramebufferAttachType
RLAttachmentColorChannel7
    Int
100 -> RLFramebufferAttachType
RLAttachmentDepth
    Int
200 -> RLFramebufferAttachType
RLAttachmentStencil
    Int
_ -> String -> RLFramebufferAttachType
forall a. HasCallStack => String -> a
error (String -> RLFramebufferAttachType)
-> String -> RLFramebufferAttachType
forall a b. (a -> b) -> a -> b
$ String
"(RLFramebufferAttachType.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLFramebufferAttachType where
  sizeOf :: RLFramebufferAttachType -> Int
sizeOf RLFramebufferAttachType
_ = Int
4
  alignment :: RLFramebufferAttachType -> Int
alignment RLFramebufferAttachType
_ = Int
4
  peek :: Ptr RLFramebufferAttachType -> IO RLFramebufferAttachType
peek Ptr RLFramebufferAttachType
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLFramebufferAttachType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLFramebufferAttachType
ptr)
    RLFramebufferAttachType -> IO RLFramebufferAttachType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLFramebufferAttachType -> IO RLFramebufferAttachType)
-> RLFramebufferAttachType -> IO RLFramebufferAttachType
forall a b. (a -> b) -> a -> b
$ Int -> RLFramebufferAttachType
forall a. Enum a => Int -> a
toEnum (Int -> RLFramebufferAttachType) -> Int -> RLFramebufferAttachType
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLFramebufferAttachType -> RLFramebufferAttachType -> IO ()
poke Ptr RLFramebufferAttachType
ptr RLFramebufferAttachType
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLFramebufferAttachType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLFramebufferAttachType
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLFramebufferAttachType -> Int
forall a. Enum a => a -> Int
fromEnum RLFramebufferAttachType
v) :: CInt)

-- | Framebuffer texture attachment type

data RLFramebufferAttachTextureType
  = -- | Framebuffer texture attachment type: cubemap, +X side

    RLAttachmentCubemapPositiveX
  | -- | Framebuffer texture attachment type: cubemap, -X side

    RLAttachmentCubemapNegativeX
  | -- | Framebuffer texture attachment type: cubemap, +Y side

    RLAttachmentCubemapPositiveY
  | -- | Framebuffer texture attachment type: cubemap, -Y side

    RLAttachmentCubemapNegativeY
  | -- | Framebuffer texture attachment type: cubemap, +Z side

    RLAttachmentCubemapPositiveZ
  | -- | Framebuffer texture attachment type: cubemap, -Z side

    RLAttachmentCubemapNegativeZ
  | -- | Framebuffer texture attachment type: texture2d

    RLAttachmentTexture2D
  | -- | Framebuffer texture attachment type: renderbuffer

    RLAttachmentRenderBuffer
  deriving (RLFramebufferAttachTextureType
-> RLFramebufferAttachTextureType -> Bool
(RLFramebufferAttachTextureType
 -> RLFramebufferAttachTextureType -> Bool)
-> (RLFramebufferAttachTextureType
    -> RLFramebufferAttachTextureType -> Bool)
-> Eq RLFramebufferAttachTextureType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLFramebufferAttachTextureType
-> RLFramebufferAttachTextureType -> Bool
== :: RLFramebufferAttachTextureType
-> RLFramebufferAttachTextureType -> Bool
$c/= :: RLFramebufferAttachTextureType
-> RLFramebufferAttachTextureType -> Bool
/= :: RLFramebufferAttachTextureType
-> RLFramebufferAttachTextureType -> Bool
Eq, Int -> RLFramebufferAttachTextureType -> ShowS
[RLFramebufferAttachTextureType] -> ShowS
RLFramebufferAttachTextureType -> String
(Int -> RLFramebufferAttachTextureType -> ShowS)
-> (RLFramebufferAttachTextureType -> String)
-> ([RLFramebufferAttachTextureType] -> ShowS)
-> Show RLFramebufferAttachTextureType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLFramebufferAttachTextureType -> ShowS
showsPrec :: Int -> RLFramebufferAttachTextureType -> ShowS
$cshow :: RLFramebufferAttachTextureType -> String
show :: RLFramebufferAttachTextureType -> String
$cshowList :: [RLFramebufferAttachTextureType] -> ShowS
showList :: [RLFramebufferAttachTextureType] -> ShowS
Show)

instance Enum RLFramebufferAttachTextureType where
  fromEnum :: RLFramebufferAttachTextureType -> Int
fromEnum RLFramebufferAttachTextureType
n = case RLFramebufferAttachTextureType
n of
    RLFramebufferAttachTextureType
RLAttachmentCubemapPositiveX -> Int
0
    RLFramebufferAttachTextureType
RLAttachmentCubemapNegativeX -> Int
1
    RLFramebufferAttachTextureType
RLAttachmentCubemapPositiveY -> Int
2
    RLFramebufferAttachTextureType
RLAttachmentCubemapNegativeY -> Int
3
    RLFramebufferAttachTextureType
RLAttachmentCubemapPositiveZ -> Int
4
    RLFramebufferAttachTextureType
RLAttachmentCubemapNegativeZ -> Int
5
    RLFramebufferAttachTextureType
RLAttachmentTexture2D -> Int
100
    RLFramebufferAttachTextureType
RLAttachmentRenderBuffer -> Int
200

  toEnum :: Int -> RLFramebufferAttachTextureType
toEnum Int
n = case Int
n of
    Int
0 -> RLFramebufferAttachTextureType
RLAttachmentCubemapPositiveX
    Int
1 -> RLFramebufferAttachTextureType
RLAttachmentCubemapNegativeX
    Int
2 -> RLFramebufferAttachTextureType
RLAttachmentCubemapPositiveY
    Int
3 -> RLFramebufferAttachTextureType
RLAttachmentCubemapNegativeY
    Int
4 -> RLFramebufferAttachTextureType
RLAttachmentCubemapPositiveZ
    Int
5 -> RLFramebufferAttachTextureType
RLAttachmentCubemapNegativeZ
    Int
100 -> RLFramebufferAttachTextureType
RLAttachmentTexture2D
    Int
200 -> RLFramebufferAttachTextureType
RLAttachmentRenderBuffer
    Int
_ -> String -> RLFramebufferAttachTextureType
forall a. HasCallStack => String -> a
error (String -> RLFramebufferAttachTextureType)
-> String -> RLFramebufferAttachTextureType
forall a b. (a -> b) -> a -> b
$ String
"(RLFramebufferAttachTextureType.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLFramebufferAttachTextureType where
  sizeOf :: RLFramebufferAttachTextureType -> Int
sizeOf RLFramebufferAttachTextureType
_ = Int
4
  alignment :: RLFramebufferAttachTextureType -> Int
alignment RLFramebufferAttachTextureType
_ = Int
4
  peek :: Ptr RLFramebufferAttachTextureType
-> IO RLFramebufferAttachTextureType
peek Ptr RLFramebufferAttachTextureType
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLFramebufferAttachTextureType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLFramebufferAttachTextureType
ptr)
    RLFramebufferAttachTextureType -> IO RLFramebufferAttachTextureType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLFramebufferAttachTextureType
 -> IO RLFramebufferAttachTextureType)
-> RLFramebufferAttachTextureType
-> IO RLFramebufferAttachTextureType
forall a b. (a -> b) -> a -> b
$ Int -> RLFramebufferAttachTextureType
forall a. Enum a => Int -> a
toEnum (Int -> RLFramebufferAttachTextureType)
-> Int -> RLFramebufferAttachTextureType
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLFramebufferAttachTextureType
-> RLFramebufferAttachTextureType -> IO ()
poke Ptr RLFramebufferAttachTextureType
ptr RLFramebufferAttachTextureType
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLFramebufferAttachTextureType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLFramebufferAttachTextureType
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLFramebufferAttachTextureType -> Int
forall a. Enum a => a -> Int
fromEnum RLFramebufferAttachTextureType
v) :: CInt)

-- | Face culling mode

data RLCullMode
  = RLCullFaceFront
  | RLCullFaceBack
  deriving (RLCullMode -> RLCullMode -> Bool
(RLCullMode -> RLCullMode -> Bool)
-> (RLCullMode -> RLCullMode -> Bool) -> Eq RLCullMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLCullMode -> RLCullMode -> Bool
== :: RLCullMode -> RLCullMode -> Bool
$c/= :: RLCullMode -> RLCullMode -> Bool
/= :: RLCullMode -> RLCullMode -> Bool
Eq, Int -> RLCullMode -> ShowS
[RLCullMode] -> ShowS
RLCullMode -> String
(Int -> RLCullMode -> ShowS)
-> (RLCullMode -> String)
-> ([RLCullMode] -> ShowS)
-> Show RLCullMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLCullMode -> ShowS
showsPrec :: Int -> RLCullMode -> ShowS
$cshow :: RLCullMode -> String
show :: RLCullMode -> String
$cshowList :: [RLCullMode] -> ShowS
showList :: [RLCullMode] -> ShowS
Show, Int -> RLCullMode
RLCullMode -> Int
RLCullMode -> [RLCullMode]
RLCullMode -> RLCullMode
RLCullMode -> RLCullMode -> [RLCullMode]
RLCullMode -> RLCullMode -> RLCullMode -> [RLCullMode]
(RLCullMode -> RLCullMode)
-> (RLCullMode -> RLCullMode)
-> (Int -> RLCullMode)
-> (RLCullMode -> Int)
-> (RLCullMode -> [RLCullMode])
-> (RLCullMode -> RLCullMode -> [RLCullMode])
-> (RLCullMode -> RLCullMode -> [RLCullMode])
-> (RLCullMode -> RLCullMode -> RLCullMode -> [RLCullMode])
-> Enum RLCullMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: RLCullMode -> RLCullMode
succ :: RLCullMode -> RLCullMode
$cpred :: RLCullMode -> RLCullMode
pred :: RLCullMode -> RLCullMode
$ctoEnum :: Int -> RLCullMode
toEnum :: Int -> RLCullMode
$cfromEnum :: RLCullMode -> Int
fromEnum :: RLCullMode -> Int
$cenumFrom :: RLCullMode -> [RLCullMode]
enumFrom :: RLCullMode -> [RLCullMode]
$cenumFromThen :: RLCullMode -> RLCullMode -> [RLCullMode]
enumFromThen :: RLCullMode -> RLCullMode -> [RLCullMode]
$cenumFromTo :: RLCullMode -> RLCullMode -> [RLCullMode]
enumFromTo :: RLCullMode -> RLCullMode -> [RLCullMode]
$cenumFromThenTo :: RLCullMode -> RLCullMode -> RLCullMode -> [RLCullMode]
enumFromThenTo :: RLCullMode -> RLCullMode -> RLCullMode -> [RLCullMode]
Enum)

instance Storable RLCullMode where
  sizeOf :: RLCullMode -> Int
sizeOf RLCullMode
_ = Int
4
  alignment :: RLCullMode -> Int
alignment RLCullMode
_ = Int
4
  peek :: Ptr RLCullMode -> IO RLCullMode
peek Ptr RLCullMode
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLCullMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLCullMode
ptr)
    RLCullMode -> IO RLCullMode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLCullMode -> IO RLCullMode) -> RLCullMode -> IO RLCullMode
forall a b. (a -> b) -> a -> b
$ Int -> RLCullMode
forall a. Enum a => Int -> a
toEnum (Int -> RLCullMode) -> Int -> RLCullMode
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLCullMode -> RLCullMode -> IO ()
poke Ptr RLCullMode
ptr RLCullMode
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLCullMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLCullMode
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLCullMode -> Int
forall a. Enum a => a -> Int
fromEnum RLCullMode
v) :: CInt)

-- | Matrix modes (equivalent to OpenGL)

data RLMatrixMode
  -- | GL_MODELVIEW

  = RLModelView
  -- | GL_PROJECTION

  | RLProjection
  -- | GL_TEXTURE

  | RLTexture
  deriving (RLMatrixMode -> RLMatrixMode -> Bool
(RLMatrixMode -> RLMatrixMode -> Bool)
-> (RLMatrixMode -> RLMatrixMode -> Bool) -> Eq RLMatrixMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLMatrixMode -> RLMatrixMode -> Bool
== :: RLMatrixMode -> RLMatrixMode -> Bool
$c/= :: RLMatrixMode -> RLMatrixMode -> Bool
/= :: RLMatrixMode -> RLMatrixMode -> Bool
Eq, Int -> RLMatrixMode -> ShowS
[RLMatrixMode] -> ShowS
RLMatrixMode -> String
(Int -> RLMatrixMode -> ShowS)
-> (RLMatrixMode -> String)
-> ([RLMatrixMode] -> ShowS)
-> Show RLMatrixMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLMatrixMode -> ShowS
showsPrec :: Int -> RLMatrixMode -> ShowS
$cshow :: RLMatrixMode -> String
show :: RLMatrixMode -> String
$cshowList :: [RLMatrixMode] -> ShowS
showList :: [RLMatrixMode] -> ShowS
Show)

instance Enum RLMatrixMode where
  fromEnum :: RLMatrixMode -> Int
fromEnum RLMatrixMode
n = case RLMatrixMode
n of
    RLMatrixMode
RLModelView -> Int
0x1700
    RLMatrixMode
RLProjection -> Int
0x1701
    RLMatrixMode
RLTexture -> Int
0x1702

  toEnum :: Int -> RLMatrixMode
toEnum Int
n = case Int
n of
    Int
0x1700 -> RLMatrixMode
RLModelView
    Int
0x1701 -> RLMatrixMode
RLProjection
    Int
0x1702 -> RLMatrixMode
RLTexture
    Int
_ -> String -> RLMatrixMode
forall a. HasCallStack => String -> a
error (String -> RLMatrixMode) -> String -> RLMatrixMode
forall a b. (a -> b) -> a -> b
$ String
"(RLMatrixMode.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLMatrixMode where
  sizeOf :: RLMatrixMode -> Int
sizeOf RLMatrixMode
_ = Int
4
  alignment :: RLMatrixMode -> Int
alignment RLMatrixMode
_ = Int
4
  peek :: Ptr RLMatrixMode -> IO RLMatrixMode
peek Ptr RLMatrixMode
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLMatrixMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLMatrixMode
ptr)
    RLMatrixMode -> IO RLMatrixMode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLMatrixMode -> IO RLMatrixMode)
-> RLMatrixMode -> IO RLMatrixMode
forall a b. (a -> b) -> a -> b
$ Int -> RLMatrixMode
forall a. Enum a => Int -> a
toEnum (Int -> RLMatrixMode) -> Int -> RLMatrixMode
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLMatrixMode -> RLMatrixMode -> IO ()
poke Ptr RLMatrixMode
ptr RLMatrixMode
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLMatrixMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLMatrixMode
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLMatrixMode -> Int
forall a. Enum a => a -> Int
fromEnum RLMatrixMode
v) :: CInt)

-- | Primitive assembly draw modes

data RLDrawMode
  -- | GL_LINES

  = RLLines
  -- | GL_TRIANGLES

  | RLTriangles
  -- | GL_QUADS

  | RLQuads
  deriving (RLDrawMode -> RLDrawMode -> Bool
(RLDrawMode -> RLDrawMode -> Bool)
-> (RLDrawMode -> RLDrawMode -> Bool) -> Eq RLDrawMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLDrawMode -> RLDrawMode -> Bool
== :: RLDrawMode -> RLDrawMode -> Bool
$c/= :: RLDrawMode -> RLDrawMode -> Bool
/= :: RLDrawMode -> RLDrawMode -> Bool
Eq, Int -> RLDrawMode -> ShowS
[RLDrawMode] -> ShowS
RLDrawMode -> String
(Int -> RLDrawMode -> ShowS)
-> (RLDrawMode -> String)
-> ([RLDrawMode] -> ShowS)
-> Show RLDrawMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLDrawMode -> ShowS
showsPrec :: Int -> RLDrawMode -> ShowS
$cshow :: RLDrawMode -> String
show :: RLDrawMode -> String
$cshowList :: [RLDrawMode] -> ShowS
showList :: [RLDrawMode] -> ShowS
Show)

instance Enum RLDrawMode where
  fromEnum :: RLDrawMode -> Int
fromEnum RLDrawMode
n = case RLDrawMode
n of
    RLDrawMode
RLLines -> Int
0x0001
    RLDrawMode
RLTriangles -> Int
0x0004
    RLDrawMode
RLQuads -> Int
0x0007

  toEnum :: Int -> RLDrawMode
toEnum Int
n = case Int
n of
    Int
0x0001 -> RLDrawMode
RLLines
    Int
0x0004 -> RLDrawMode
RLTriangles
    Int
0x0007 -> RLDrawMode
RLQuads
    Int
_ -> String -> RLDrawMode
forall a. HasCallStack => String -> a
error (String -> RLDrawMode) -> String -> RLDrawMode
forall a b. (a -> b) -> a -> b
$ String
"(RLDrawMode.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLDrawMode where
  sizeOf :: RLDrawMode -> Int
sizeOf RLDrawMode
_ = Int
4
  alignment :: RLDrawMode -> Int
alignment RLDrawMode
_ = Int
4
  peek :: Ptr RLDrawMode -> IO RLDrawMode
peek Ptr RLDrawMode
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLDrawMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLDrawMode
ptr)
    RLDrawMode -> IO RLDrawMode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLDrawMode -> IO RLDrawMode) -> RLDrawMode -> IO RLDrawMode
forall a b. (a -> b) -> a -> b
$ Int -> RLDrawMode
forall a. Enum a => Int -> a
toEnum (Int -> RLDrawMode) -> Int -> RLDrawMode
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLDrawMode -> RLDrawMode -> IO ()
poke Ptr RLDrawMode
ptr RLDrawMode
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLDrawMode -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLDrawMode
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLDrawMode -> Int
forall a. Enum a => a -> Int
fromEnum RLDrawMode
v) :: CInt)

-- | Texture parameters (equivalent to OpenGL defines)

data RLTextureParam
  -- | GL_TEXTURE_WRAP_S

  = RLTextureParamWrapS
  -- | GL_TEXTURE_WRAP_T

  | RLTextureParamWrapT
  -- | GL_TEXTURE_MAG_FILTER

  | RLTextureParamMagFilter
  -- | GL_TEXTURE_MIN_FILTER

  | RLTextureParamMinFilter
  -- | GL_NEAREST

  | RLTextureParamFilterNearest
  -- | GL_LINEAR

  | RLTextureParamFilterLinear
  -- | GL_NEAREST_MIPMAP_NEAREST

  | RLTextureParamFilterMipNearest
  -- | GL_NEAREST_MIPMAP_LINEAR

  | RLTextureParamFilterNearestMipLinear
  -- | GL_LINEAR_MIPMAP_NEAREST

  | RLTextureParamFilterLinearMipNearest
  -- | GL_LINEAR_MIPMAP_LINEAR

  | RLTextureParamFilterMipLinear
  -- | Anisotropic filter (custom identifier)

  | RLTextureParamFilterAnisotropic
  -- | Texture mipmap bias, percentage ratio (custom identifier)

  | RLTextureParamMipmapBiasRatio
  deriving (RLTextureParam -> RLTextureParam -> Bool
(RLTextureParam -> RLTextureParam -> Bool)
-> (RLTextureParam -> RLTextureParam -> Bool) -> Eq RLTextureParam
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLTextureParam -> RLTextureParam -> Bool
== :: RLTextureParam -> RLTextureParam -> Bool
$c/= :: RLTextureParam -> RLTextureParam -> Bool
/= :: RLTextureParam -> RLTextureParam -> Bool
Eq, Int -> RLTextureParam -> ShowS
[RLTextureParam] -> ShowS
RLTextureParam -> String
(Int -> RLTextureParam -> ShowS)
-> (RLTextureParam -> String)
-> ([RLTextureParam] -> ShowS)
-> Show RLTextureParam
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLTextureParam -> ShowS
showsPrec :: Int -> RLTextureParam -> ShowS
$cshow :: RLTextureParam -> String
show :: RLTextureParam -> String
$cshowList :: [RLTextureParam] -> ShowS
showList :: [RLTextureParam] -> ShowS
Show)

instance Enum RLTextureParam where
  fromEnum :: RLTextureParam -> Int
fromEnum RLTextureParam
n = case RLTextureParam
n of
    RLTextureParam
RLTextureParamWrapS -> Int
0x2802
    RLTextureParam
RLTextureParamWrapT -> Int
0x2803
    RLTextureParam
RLTextureParamMagFilter -> Int
0x2800
    RLTextureParam
RLTextureParamMinFilter -> Int
0x2801
    RLTextureParam
RLTextureParamFilterNearest -> Int
0x2600
    RLTextureParam
RLTextureParamFilterLinear -> Int
0x2601
    RLTextureParam
RLTextureParamFilterMipNearest -> Int
0x2700
    RLTextureParam
RLTextureParamFilterNearestMipLinear -> Int
0x2702
    RLTextureParam
RLTextureParamFilterLinearMipNearest -> Int
0x2701
    RLTextureParam
RLTextureParamFilterMipLinear -> Int
0x2703
    RLTextureParam
RLTextureParamFilterAnisotropic -> Int
0x3000
    RLTextureParam
RLTextureParamMipmapBiasRatio -> Int
0x4000

  toEnum :: Int -> RLTextureParam
toEnum Int
n = case Int
n of
    Int
0x2802 -> RLTextureParam
RLTextureParamWrapS
    Int
0x2803 -> RLTextureParam
RLTextureParamWrapT
    Int
0x2800 -> RLTextureParam
RLTextureParamMagFilter
    Int
0x2801 -> RLTextureParam
RLTextureParamMinFilter
    Int
0x2600 -> RLTextureParam
RLTextureParamFilterNearest
    Int
0x2601 -> RLTextureParam
RLTextureParamFilterLinear
    Int
0x2700 -> RLTextureParam
RLTextureParamFilterMipNearest
    Int
0x2702 -> RLTextureParam
RLTextureParamFilterNearestMipLinear
    Int
0x2701 -> RLTextureParam
RLTextureParamFilterLinearMipNearest
    Int
0x2703 -> RLTextureParam
RLTextureParamFilterMipLinear
    Int
0x3000 -> RLTextureParam
RLTextureParamFilterAnisotropic
    Int
0x4000 -> RLTextureParam
RLTextureParamMipmapBiasRatio
    Int
_ -> String -> RLTextureParam
forall a. HasCallStack => String -> a
error (String -> RLTextureParam) -> String -> RLTextureParam
forall a b. (a -> b) -> a -> b
$ String
"(RLTextureParam.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLTextureParam where
  sizeOf :: RLTextureParam -> Int
sizeOf RLTextureParam
_ = Int
4
  alignment :: RLTextureParam -> Int
alignment RLTextureParam
_ = Int
4
  peek :: Ptr RLTextureParam -> IO RLTextureParam
peek Ptr RLTextureParam
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLTextureParam -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLTextureParam
ptr)
    RLTextureParam -> IO RLTextureParam
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLTextureParam -> IO RLTextureParam)
-> RLTextureParam -> IO RLTextureParam
forall a b. (a -> b) -> a -> b
$ Int -> RLTextureParam
forall a. Enum a => Int -> a
toEnum (Int -> RLTextureParam) -> Int -> RLTextureParam
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLTextureParam -> RLTextureParam -> IO ()
poke Ptr RLTextureParam
ptr RLTextureParam
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLTextureParam -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLTextureParam
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLTextureParam -> Int
forall a. Enum a => a -> Int
fromEnum RLTextureParam
v) :: CInt)

-- | OpenGL shader type

data RLShaderType
  -- | GL_FRAGMENT_SHADER

  = RLFragmentShader
  -- | GL_VERTEX_SHADER

  | RLVertexShader
  -- | GL_COMPUTE_SHADER

  | RLComputeShader
  deriving (RLShaderType -> RLShaderType -> Bool
(RLShaderType -> RLShaderType -> Bool)
-> (RLShaderType -> RLShaderType -> Bool) -> Eq RLShaderType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLShaderType -> RLShaderType -> Bool
== :: RLShaderType -> RLShaderType -> Bool
$c/= :: RLShaderType -> RLShaderType -> Bool
/= :: RLShaderType -> RLShaderType -> Bool
Eq, Int -> RLShaderType -> ShowS
[RLShaderType] -> ShowS
RLShaderType -> String
(Int -> RLShaderType -> ShowS)
-> (RLShaderType -> String)
-> ([RLShaderType] -> ShowS)
-> Show RLShaderType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLShaderType -> ShowS
showsPrec :: Int -> RLShaderType -> ShowS
$cshow :: RLShaderType -> String
show :: RLShaderType -> String
$cshowList :: [RLShaderType] -> ShowS
showList :: [RLShaderType] -> ShowS
Show)

instance Enum RLShaderType where
  fromEnum :: RLShaderType -> Int
fromEnum RLShaderType
n = case RLShaderType
n of
    RLShaderType
RLFragmentShader -> Int
0x8B30
    RLShaderType
RLVertexShader -> Int
0x8B31
    RLShaderType
RLComputeShader -> Int
0x91B9

  toEnum :: Int -> RLShaderType
toEnum Int
n = case Int
n of
    Int
0x8B30 -> RLShaderType
RLFragmentShader
    Int
0x8B31 -> RLShaderType
RLVertexShader
    Int
0x91B9 -> RLShaderType
RLComputeShader
    Int
_ -> String -> RLShaderType
forall a. HasCallStack => String -> a
error (String -> RLShaderType) -> String -> RLShaderType
forall a b. (a -> b) -> a -> b
$ String
"(RLShaderType.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLShaderType where
  sizeOf :: RLShaderType -> Int
sizeOf RLShaderType
_ = Int
4
  alignment :: RLShaderType -> Int
alignment RLShaderType
_ = Int
4
  peek :: Ptr RLShaderType -> IO RLShaderType
peek Ptr RLShaderType
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLShaderType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderType
ptr)
    RLShaderType -> IO RLShaderType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLShaderType -> IO RLShaderType)
-> RLShaderType -> IO RLShaderType
forall a b. (a -> b) -> a -> b
$ Int -> RLShaderType
forall a. Enum a => Int -> a
toEnum (Int -> RLShaderType) -> Int -> RLShaderType
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLShaderType -> RLShaderType -> IO ()
poke Ptr RLShaderType
ptr RLShaderType
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLShaderType -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLShaderType
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLShaderType -> Int
forall a. Enum a => a -> Int
fromEnum RLShaderType
v) :: CInt)

-- | GL buffer usage hint

data RLBufferHint
  -- | GL_STREAM_DRAW

  = RLBufferHintStreamDraw
  -- | GL_STREAM_READ

  | RLBufferHintStreamRead
  -- | GL_STREAM_COPY

  | RLBufferHintStreamCopy
  -- | GL_STATIC_DRAW

  | RLBufferHintStaticDraw
  -- | GL_STATIC_READ

  | RLBufferHintStaticRead
  -- | GL_STATIC_COPY

  | RLBufferHintStaticCopy
  -- | GL_DYNAMIC_DRAW

  | RLBufferHintDynamicDraw
  -- | GL_DYNAMIC_READ

  | RLBufferHintDynamicRead
  -- | GL_DYNAMIC_COPY

  | RLBufferHintDynamicCopy
  deriving (RLBufferHint -> RLBufferHint -> Bool
(RLBufferHint -> RLBufferHint -> Bool)
-> (RLBufferHint -> RLBufferHint -> Bool) -> Eq RLBufferHint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLBufferHint -> RLBufferHint -> Bool
== :: RLBufferHint -> RLBufferHint -> Bool
$c/= :: RLBufferHint -> RLBufferHint -> Bool
/= :: RLBufferHint -> RLBufferHint -> Bool
Eq, Int -> RLBufferHint -> ShowS
[RLBufferHint] -> ShowS
RLBufferHint -> String
(Int -> RLBufferHint -> ShowS)
-> (RLBufferHint -> String)
-> ([RLBufferHint] -> ShowS)
-> Show RLBufferHint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLBufferHint -> ShowS
showsPrec :: Int -> RLBufferHint -> ShowS
$cshow :: RLBufferHint -> String
show :: RLBufferHint -> String
$cshowList :: [RLBufferHint] -> ShowS
showList :: [RLBufferHint] -> ShowS
Show)

instance Enum RLBufferHint where
  fromEnum :: RLBufferHint -> Int
fromEnum RLBufferHint
n = case RLBufferHint
n of
    RLBufferHint
RLBufferHintStreamDraw -> Int
0x88E0
    RLBufferHint
RLBufferHintStreamRead -> Int
0x88E1
    RLBufferHint
RLBufferHintStreamCopy -> Int
0x88E2
    RLBufferHint
RLBufferHintStaticDraw -> Int
0x88E4
    RLBufferHint
RLBufferHintStaticRead -> Int
0x88E5
    RLBufferHint
RLBufferHintStaticCopy -> Int
0x88E6
    RLBufferHint
RLBufferHintDynamicDraw -> Int
0x88E8
    RLBufferHint
RLBufferHintDynamicRead -> Int
0x88E9
    RLBufferHint
RLBufferHintDynamicCopy -> Int
0x88EA

  toEnum :: Int -> RLBufferHint
toEnum Int
n = case Int
n of
    Int
0x88E0 -> RLBufferHint
RLBufferHintStreamDraw
    Int
0x88E1 -> RLBufferHint
RLBufferHintStreamRead
    Int
0x88E2 -> RLBufferHint
RLBufferHintStreamCopy
    Int
0x88E4 -> RLBufferHint
RLBufferHintStaticDraw
    Int
0x88E5 -> RLBufferHint
RLBufferHintStaticRead
    Int
0x88E6 -> RLBufferHint
RLBufferHintStaticCopy
    Int
0x88E8 -> RLBufferHint
RLBufferHintDynamicDraw
    Int
0x88E9 -> RLBufferHint
RLBufferHintDynamicRead
    Int
0x88EA -> RLBufferHint
RLBufferHintDynamicCopy
    Int
_ -> String -> RLBufferHint
forall a. HasCallStack => String -> a
error (String -> RLBufferHint) -> String -> RLBufferHint
forall a b. (a -> b) -> a -> b
$ String
"(RLBufferHint.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLBufferHint where
  sizeOf :: RLBufferHint -> Int
sizeOf RLBufferHint
_ = Int
4
  alignment :: RLBufferHint -> Int
alignment RLBufferHint
_ = Int
4
  peek :: Ptr RLBufferHint -> IO RLBufferHint
peek Ptr RLBufferHint
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLBufferHint -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLBufferHint
ptr)
    RLBufferHint -> IO RLBufferHint
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLBufferHint -> IO RLBufferHint)
-> RLBufferHint -> IO RLBufferHint
forall a b. (a -> b) -> a -> b
$ Int -> RLBufferHint
forall a. Enum a => Int -> a
toEnum (Int -> RLBufferHint) -> Int -> RLBufferHint
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLBufferHint -> RLBufferHint -> IO ()
poke Ptr RLBufferHint
ptr RLBufferHint
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLBufferHint -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLBufferHint
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLBufferHint -> Int
forall a. Enum a => a -> Int
fromEnum RLBufferHint
v) :: CInt)

-- | GL buffer mask

data RLBitField
  -- | GL_COLOR_BUFFER_BIT

  = RLGLColorBuffer
  -- | GL_DEPTH_BUFFER_BIT

  | RLGLDepthBuffer
  -- | GL_STENCIL_BUFFER_BIT

  | RLGLStencilBuffer
  deriving (RLBitField -> RLBitField -> Bool
(RLBitField -> RLBitField -> Bool)
-> (RLBitField -> RLBitField -> Bool) -> Eq RLBitField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLBitField -> RLBitField -> Bool
== :: RLBitField -> RLBitField -> Bool
$c/= :: RLBitField -> RLBitField -> Bool
/= :: RLBitField -> RLBitField -> Bool
Eq, Int -> RLBitField -> ShowS
[RLBitField] -> ShowS
RLBitField -> String
(Int -> RLBitField -> ShowS)
-> (RLBitField -> String)
-> ([RLBitField] -> ShowS)
-> Show RLBitField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLBitField -> ShowS
showsPrec :: Int -> RLBitField -> ShowS
$cshow :: RLBitField -> String
show :: RLBitField -> String
$cshowList :: [RLBitField] -> ShowS
showList :: [RLBitField] -> ShowS
Show)

instance Enum RLBitField where
  fromEnum :: RLBitField -> Int
fromEnum RLBitField
n = case RLBitField
n of
    RLBitField
RLGLColorBuffer -> Int
0x00004000
    RLBitField
RLGLDepthBuffer -> Int
0x00000100
    RLBitField
RLGLStencilBuffer -> Int
0x00000400
  
  toEnum :: Int -> RLBitField
toEnum Int
n = case Int
n of
    Int
0x00004000 -> RLBitField
RLGLColorBuffer
    Int
0x00000100 -> RLBitField
RLGLDepthBuffer
    Int
0x00000400 -> RLBitField
RLGLStencilBuffer
    Int
_ -> String -> RLBitField
forall a. HasCallStack => String -> a
error (String -> RLBitField) -> String -> RLBitField
forall a b. (a -> b) -> a -> b
$ String
"(RLGLBitField.toEnum) Invalid value: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n

instance Storable RLBitField where
  sizeOf :: RLBitField -> Int
sizeOf RLBitField
_ = Int
4
  alignment :: RLBitField -> Int
alignment RLBitField
_ = Int
4
  peek :: Ptr RLBitField -> IO RLBitField
peek Ptr RLBitField
ptr = do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr RLBitField -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLBitField
ptr)
    RLBitField -> IO RLBitField
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLBitField -> IO RLBitField) -> RLBitField -> IO RLBitField
forall a b. (a -> b) -> a -> b
$ Int -> RLBitField
forall a. Enum a => Int -> a
toEnum (Int -> RLBitField) -> Int -> RLBitField
forall a b. (a -> b) -> a -> b
$ CInt -> Int
forall a. Enum a => a -> Int
fromEnum (CInt
val :: CInt)
  poke :: Ptr RLBitField -> RLBitField -> IO ()
poke Ptr RLBitField
ptr RLBitField
v = Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RLBitField -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLBitField
ptr) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (RLBitField -> Int
forall a. Enum a => a -> Int
fromEnum RLBitField
v) :: CInt)

------------------------------------------------

-- Raylib structures ---------------------------

------------------------------------------------


---- raylib.h


data Vector2 = Vector2
  { Vector2 -> Float
vector2'x :: Float,
    Vector2 -> Float
vector2'y :: Float
  }
  deriving (Vector2 -> Vector2 -> Bool
(Vector2 -> Vector2 -> Bool)
-> (Vector2 -> Vector2 -> Bool) -> Eq Vector2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Vector2 -> Vector2 -> Bool
== :: Vector2 -> Vector2 -> Bool
$c/= :: Vector2 -> Vector2 -> Bool
/= :: Vector2 -> Vector2 -> Bool
Eq, Int -> Vector2 -> ShowS
[Vector2] -> ShowS
Vector2 -> String
(Int -> Vector2 -> ShowS)
-> (Vector2 -> String) -> ([Vector2] -> ShowS) -> Show Vector2
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Vector2 -> ShowS
showsPrec :: Int -> Vector2 -> ShowS
$cshow :: Vector2 -> String
show :: Vector2 -> String
$cshowList :: [Vector2] -> ShowS
showList :: [Vector2] -> ShowS
Show, Vector2 -> Ptr Vector2 -> IO ()
(Vector2 -> Ptr Vector2 -> IO ())
-> (Vector2 -> Ptr Vector2 -> IO ()) -> Freeable Vector2
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Vector2 -> Ptr Vector2 -> IO ()
rlFreeDependents :: Vector2 -> Ptr Vector2 -> IO ()
$crlFree :: Vector2 -> Ptr Vector2 -> IO ()
rlFree :: Vector2 -> Ptr Vector2 -> IO ()
Freeable)

instance Storable Vector2 where
  sizeOf :: Vector2 -> Int
sizeOf Vector2
_ = Int
8
  alignment :: Vector2 -> Int
alignment Vector2
_ = Int
4
  peek :: Ptr Vector2 -> IO Vector2
peek Ptr Vector2
_p = do
    Float
x <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector2 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector2
_p Int
0 :: IO CFloat)
    Float
y <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector2 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector2
_p Int
4 :: IO CFloat)
    Vector2 -> IO Vector2
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Vector2 -> IO Vector2) -> Vector2 -> IO Vector2
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Vector2
Vector2 Float
x Float
y
  poke :: Ptr Vector2 -> Vector2 -> IO ()
poke Ptr Vector2
_p (Vector2 Float
x Float
y) = do
    Ptr Vector2 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector2
_p Int
0 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x :: CFloat)
    Ptr Vector2 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector2
_p Int
4 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Vector3 = Vector3
  { Vector3 -> Float
vector3'x :: Float,
    Vector3 -> Float
vector3'y :: Float,
    Vector3 -> Float
vector3'z :: Float
  }
  deriving (Vector3 -> Vector3 -> Bool
(Vector3 -> Vector3 -> Bool)
-> (Vector3 -> Vector3 -> Bool) -> Eq Vector3
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Vector3 -> Vector3 -> Bool
== :: Vector3 -> Vector3 -> Bool
$c/= :: Vector3 -> Vector3 -> Bool
/= :: Vector3 -> Vector3 -> Bool
Eq, Int -> Vector3 -> ShowS
[Vector3] -> ShowS
Vector3 -> String
(Int -> Vector3 -> ShowS)
-> (Vector3 -> String) -> ([Vector3] -> ShowS) -> Show Vector3
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Vector3 -> ShowS
showsPrec :: Int -> Vector3 -> ShowS
$cshow :: Vector3 -> String
show :: Vector3 -> String
$cshowList :: [Vector3] -> ShowS
showList :: [Vector3] -> ShowS
Show, Vector3 -> Ptr Vector3 -> IO ()
(Vector3 -> Ptr Vector3 -> IO ())
-> (Vector3 -> Ptr Vector3 -> IO ()) -> Freeable Vector3
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Vector3 -> Ptr Vector3 -> IO ()
rlFreeDependents :: Vector3 -> Ptr Vector3 -> IO ()
$crlFree :: Vector3 -> Ptr Vector3 -> IO ()
rlFree :: Vector3 -> Ptr Vector3 -> IO ()
Freeable)

instance Storable Vector3 where
  sizeOf :: Vector3 -> Int
sizeOf Vector3
_ = Int
12
  alignment :: Vector3 -> Int
alignment Vector3
_ = Int
4
  peek :: Ptr Vector3 -> IO Vector3
peek Ptr Vector3
_p = do
    Float
x <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector3 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector3
_p Int
0 :: IO CFloat)
    Float
y <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector3 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector3
_p Int
4 :: IO CFloat)
    Float
z <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector3 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector3
_p Int
8 :: IO CFloat)
    Vector3 -> IO Vector3
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Vector3 -> IO Vector3) -> Vector3 -> IO Vector3
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Float -> Vector3
Vector3 Float
x Float
y Float
z
  poke :: Ptr Vector3 -> Vector3 -> IO ()
poke Ptr Vector3
_p (Vector3 Float
x Float
y Float
z) = do
    Ptr Vector3 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector3
_p Int
0 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x :: CFloat)
    Ptr Vector3 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector3
_p Int
4 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y :: CFloat)
    Ptr Vector3 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector3
_p Int
8 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Vector4 = Vector4
  { Vector4 -> Float
vector4'x :: Float,
    Vector4 -> Float
vector4'y :: Float,
    Vector4 -> Float
vector4'z :: Float,
    Vector4 -> Float
vector4'w :: Float
  }
  deriving (Vector4 -> Vector4 -> Bool
(Vector4 -> Vector4 -> Bool)
-> (Vector4 -> Vector4 -> Bool) -> Eq Vector4
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Vector4 -> Vector4 -> Bool
== :: Vector4 -> Vector4 -> Bool
$c/= :: Vector4 -> Vector4 -> Bool
/= :: Vector4 -> Vector4 -> Bool
Eq, Int -> Vector4 -> ShowS
[Vector4] -> ShowS
Vector4 -> String
(Int -> Vector4 -> ShowS)
-> (Vector4 -> String) -> ([Vector4] -> ShowS) -> Show Vector4
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Vector4 -> ShowS
showsPrec :: Int -> Vector4 -> ShowS
$cshow :: Vector4 -> String
show :: Vector4 -> String
$cshowList :: [Vector4] -> ShowS
showList :: [Vector4] -> ShowS
Show, Vector4 -> Ptr Vector4 -> IO ()
(Vector4 -> Ptr Vector4 -> IO ())
-> (Vector4 -> Ptr Vector4 -> IO ()) -> Freeable Vector4
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Vector4 -> Ptr Vector4 -> IO ()
rlFreeDependents :: Vector4 -> Ptr Vector4 -> IO ()
$crlFree :: Vector4 -> Ptr Vector4 -> IO ()
rlFree :: Vector4 -> Ptr Vector4 -> IO ()
Freeable)

instance Storable Vector4 where
  sizeOf :: Vector4 -> Int
sizeOf Vector4
_ = Int
16
  alignment :: Vector4 -> Int
alignment Vector4
_ = Int
4
  peek :: Ptr Vector4 -> IO Vector4
peek Ptr Vector4
_p = do
    Float
x <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector4 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector4
_p Int
0 :: IO CFloat)
    Float
y <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector4 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector4
_p Int
4 :: IO CFloat)
    Float
z <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector4 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector4
_p Int
8 :: IO CFloat)
    Float
w <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Vector4 -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Vector4
_p Int
12 :: IO CFloat)
    Vector4 -> IO Vector4
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Vector4 -> IO Vector4) -> Vector4 -> IO Vector4
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Float -> Float -> Vector4
Vector4 Float
x Float
y Float
z Float
w
  poke :: Ptr Vector4 -> Vector4 -> IO ()
poke Ptr Vector4
_p (Vector4 Float
x Float
y Float
z Float
w) = do
    Ptr Vector4 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector4
_p Int
0 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x :: CFloat)
    Ptr Vector4 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector4
_p Int
4 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y :: CFloat)
    Ptr Vector4 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector4
_p Int
8 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z :: CFloat)
    Ptr Vector4 -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Vector4
_p Int
12 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
w :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

type Quaternion = Vector4

data Matrix = Matrix
  { Matrix -> Float
matrix'm0 :: Float,
    Matrix -> Float
matrix'm4 :: Float,
    Matrix -> Float
matrix'm8 :: Float,
    Matrix -> Float
matrix'm12 :: Float,
    Matrix -> Float
matrix'm1 :: Float,
    Matrix -> Float
matrix'm5 :: Float,
    Matrix -> Float
matrix'm9 :: Float,
    Matrix -> Float
matrix'm13 :: Float,
    Matrix -> Float
matrix'm2 :: Float,
    Matrix -> Float
matrix'm6 :: Float,
    Matrix -> Float
matrix'm10 :: Float,
    Matrix -> Float
matrix'm14 :: Float,
    Matrix -> Float
matrix'm3 :: Float,
    Matrix -> Float
matrix'm7 :: Float,
    Matrix -> Float
matrix'm11 :: Float,
    Matrix -> Float
matrix'm15 :: Float
  }
  deriving (Matrix -> Matrix -> Bool
(Matrix -> Matrix -> Bool)
-> (Matrix -> Matrix -> Bool) -> Eq Matrix
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Matrix -> Matrix -> Bool
== :: Matrix -> Matrix -> Bool
$c/= :: Matrix -> Matrix -> Bool
/= :: Matrix -> Matrix -> Bool
Eq, Int -> Matrix -> ShowS
[Matrix] -> ShowS
Matrix -> String
(Int -> Matrix -> ShowS)
-> (Matrix -> String) -> ([Matrix] -> ShowS) -> Show Matrix
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Matrix -> ShowS
showsPrec :: Int -> Matrix -> ShowS
$cshow :: Matrix -> String
show :: Matrix -> String
$cshowList :: [Matrix] -> ShowS
showList :: [Matrix] -> ShowS
Show, Matrix -> Ptr Matrix -> IO ()
(Matrix -> Ptr Matrix -> IO ())
-> (Matrix -> Ptr Matrix -> IO ()) -> Freeable Matrix
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Matrix -> Ptr Matrix -> IO ()
rlFreeDependents :: Matrix -> Ptr Matrix -> IO ()
$crlFree :: Matrix -> Ptr Matrix -> IO ()
rlFree :: Matrix -> Ptr Matrix -> IO ()
Freeable)

instance Storable Matrix where
  sizeOf :: Matrix -> Int
sizeOf Matrix
_ = Int
64
  alignment :: Matrix -> Int
alignment Matrix
_ = Int
4
  peek :: Ptr Matrix -> IO Matrix
peek Ptr Matrix
_p = do
    Float
m0 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
0 :: IO CFloat)
    Float
m4 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
4 :: IO CFloat)
    Float
m8 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
8 :: IO CFloat)
    Float
m12 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
12 :: IO CFloat)
    Float
m1 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
16 :: IO CFloat)
    Float
m5 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
20 :: IO CFloat)
    Float
m9 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
24 :: IO CFloat)
    Float
m13 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
28 :: IO CFloat)
    Float
m2 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
32 :: IO CFloat)
    Float
m6 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
36 :: IO CFloat)
    Float
m10 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
40 :: IO CFloat)
    Float
m14 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
44 :: IO CFloat)
    Float
m3 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
48 :: IO CFloat)
    Float
m7 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
52 :: IO CFloat)
    Float
m11 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
56 :: IO CFloat)
    Float
m15 <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Matrix -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Matrix
_p Int
60 :: IO CFloat)
    Matrix -> IO Matrix
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Matrix -> IO Matrix) -> Matrix -> IO Matrix
forall a b. (a -> b) -> a -> b
$ Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Matrix
Matrix Float
m0 Float
m4 Float
m8 Float
m12 Float
m1 Float
m5 Float
m9 Float
m13 Float
m2 Float
m6 Float
m10 Float
m14 Float
m3 Float
m7 Float
m11 Float
m15
  poke :: Ptr Matrix -> Matrix -> IO ()
poke Ptr Matrix
_p (Matrix Float
m0 Float
m4 Float
m8 Float
m12 Float
m1 Float
m5 Float
m9 Float
m13 Float
m2 Float
m6 Float
m10 Float
m14 Float
m3 Float
m7 Float
m11 Float
m15) = do
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
0 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m0 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
4 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m4 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
8 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m8 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
12 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m12 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
16 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m1 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
20 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m5 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
24 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m9 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
28 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m13 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
32 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m2 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
36 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m6 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
40 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m10 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
44 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m14 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
48 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m3 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
52 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m7 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
56 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m11 :: CFloat)
    Ptr Matrix -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Matrix
_p Int
60 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
m15 :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

vectorToColor :: Vector4 -> Color
vectorToColor :: Vector4 -> Color
vectorToColor (Vector4 Float
x Float
y Float
z Float
w) = Word8 -> Word8 -> Word8 -> Word8 -> Color
Color (Float -> Word8
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Float -> Word8) -> Float -> Word8
forall a b. (a -> b) -> a -> b
$ Float
x Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
255) (Float -> Word8
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Float -> Word8) -> Float -> Word8
forall a b. (a -> b) -> a -> b
$ Float
y Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
255) (Float -> Word8
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Float -> Word8) -> Float -> Word8
forall a b. (a -> b) -> a -> b
$ Float
z Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
255) (Float -> Word8
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Float -> Word8) -> Float -> Word8
forall a b. (a -> b) -> a -> b
$ Float
w Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
255)

data Color = Color
  { Color -> Word8
color'r :: Word8,
    Color -> Word8
color'g :: Word8,
    Color -> Word8
color'b :: Word8,
    Color -> Word8
color'a :: Word8
  }
  deriving (Color -> Color -> Bool
(Color -> Color -> Bool) -> (Color -> Color -> Bool) -> Eq Color
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Color -> Color -> Bool
== :: Color -> Color -> Bool
$c/= :: Color -> Color -> Bool
/= :: Color -> Color -> Bool
Eq, Int -> Color -> ShowS
[Color] -> ShowS
Color -> String
(Int -> Color -> ShowS)
-> (Color -> String) -> ([Color] -> ShowS) -> Show Color
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Color -> ShowS
showsPrec :: Int -> Color -> ShowS
$cshow :: Color -> String
show :: Color -> String
$cshowList :: [Color] -> ShowS
showList :: [Color] -> ShowS
Show, Color -> Ptr Color -> IO ()
(Color -> Ptr Color -> IO ())
-> (Color -> Ptr Color -> IO ()) -> Freeable Color
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Color -> Ptr Color -> IO ()
rlFreeDependents :: Color -> Ptr Color -> IO ()
$crlFree :: Color -> Ptr Color -> IO ()
rlFree :: Color -> Ptr Color -> IO ()
Freeable)

instance Storable Color where
  sizeOf :: Color -> Int
sizeOf Color
_ = Int
4
  alignment :: Color -> Int
alignment Color
_ = Int
1
  peek :: Ptr Color -> IO Color
peek Ptr Color
_p = do
    Word8
r <- CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUChar -> Word8) -> IO CUChar -> IO Word8
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Color -> Int -> IO CUChar
forall b. Ptr b -> Int -> IO CUChar
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Color
_p Int
0 :: IO CUChar)
    Word8
g <- CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUChar -> Word8) -> IO CUChar -> IO Word8
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Color -> Int -> IO CUChar
forall b. Ptr b -> Int -> IO CUChar
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Color
_p Int
1 :: IO CUChar)
    Word8
b <- CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUChar -> Word8) -> IO CUChar -> IO Word8
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Color -> Int -> IO CUChar
forall b. Ptr b -> Int -> IO CUChar
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Color
_p Int
2 :: IO CUChar)
    Word8
a <- CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUChar -> Word8) -> IO CUChar -> IO Word8
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Color -> Int -> IO CUChar
forall b. Ptr b -> Int -> IO CUChar
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Color
_p Int
3 :: IO CUChar)
    Color -> IO Color
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Color -> IO Color) -> Color -> IO Color
forall a b. (a -> b) -> a -> b
$ Word8 -> Word8 -> Word8 -> Word8 -> Color
Color Word8
r Word8
g Word8
b Word8
a
  poke :: Ptr Color -> Color -> IO ()
poke Ptr Color
_p (Color Word8
r Word8
g Word8
b Word8
a) = do
    Ptr Color -> Int -> CUChar -> IO ()
forall b. Ptr b -> Int -> CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Color
_p Int
0 (Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
r :: CUChar)
    Ptr Color -> Int -> CUChar -> IO ()
forall b. Ptr b -> Int -> CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Color
_p Int
1 (Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
g :: CUChar)
    Ptr Color -> Int -> CUChar -> IO ()
forall b. Ptr b -> Int -> CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Color
_p Int
2 (Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
b :: CUChar)
    Ptr Color -> Int -> CUChar -> IO ()
forall b. Ptr b -> Int -> CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Color
_p Int
3 (Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
a :: CUChar)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Rectangle = Rectangle
  { Rectangle -> Float
rectangle'x :: Float,
    Rectangle -> Float
rectangle'y :: Float,
    Rectangle -> Float
rectangle'width :: Float,
    Rectangle -> Float
rectangle'height :: Float
  }
  deriving (Rectangle -> Rectangle -> Bool
(Rectangle -> Rectangle -> Bool)
-> (Rectangle -> Rectangle -> Bool) -> Eq Rectangle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Rectangle -> Rectangle -> Bool
== :: Rectangle -> Rectangle -> Bool
$c/= :: Rectangle -> Rectangle -> Bool
/= :: Rectangle -> Rectangle -> Bool
Eq, Int -> Rectangle -> ShowS
[Rectangle] -> ShowS
Rectangle -> String
(Int -> Rectangle -> ShowS)
-> (Rectangle -> String)
-> ([Rectangle] -> ShowS)
-> Show Rectangle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Rectangle -> ShowS
showsPrec :: Int -> Rectangle -> ShowS
$cshow :: Rectangle -> String
show :: Rectangle -> String
$cshowList :: [Rectangle] -> ShowS
showList :: [Rectangle] -> ShowS
Show, Rectangle -> Ptr Rectangle -> IO ()
(Rectangle -> Ptr Rectangle -> IO ())
-> (Rectangle -> Ptr Rectangle -> IO ()) -> Freeable Rectangle
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Rectangle -> Ptr Rectangle -> IO ()
rlFreeDependents :: Rectangle -> Ptr Rectangle -> IO ()
$crlFree :: Rectangle -> Ptr Rectangle -> IO ()
rlFree :: Rectangle -> Ptr Rectangle -> IO ()
Freeable)

instance Storable Rectangle where
  sizeOf :: Rectangle -> Int
sizeOf Rectangle
_ = Int
16
  alignment :: Rectangle -> Int
alignment Rectangle
_ = Int
4
  peek :: Ptr Rectangle -> IO Rectangle
peek Ptr Rectangle
_p = do
    Float
x <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Rectangle -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Rectangle
_p Int
0 :: IO CFloat)
    Float
y <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Rectangle -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Rectangle
_p Int
4 :: IO CFloat)
    Float
width <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Rectangle -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Rectangle
_p Int
8 :: IO CFloat)
    Float
height <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Rectangle -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Rectangle
_p Int
12 :: IO CFloat)
    Rectangle -> IO Rectangle
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Rectangle -> IO Rectangle) -> Rectangle -> IO Rectangle
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Float -> Float -> Rectangle
Rectangle Float
x Float
y Float
width Float
height
  poke :: Ptr Rectangle -> Rectangle -> IO ()
poke Ptr Rectangle
_p (Rectangle Float
x Float
y Float
width Float
height) = do
    Ptr Rectangle -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Rectangle
_p Int
0 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x :: CFloat)
    Ptr Rectangle -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Rectangle
_p Int
4 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y :: CFloat)
    Ptr Rectangle -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Rectangle
_p Int
8 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
width :: CFloat)
    Ptr Rectangle -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Rectangle
_p Int
12 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
height :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Image = Image
  { Image -> [Word8]
image'data :: [Word8],
    Image -> Int
image'width :: Int,
    Image -> Int
image'height :: Int,
    Image -> Int
image'mipmaps :: Int,
    Image -> PixelFormat
image'format :: PixelFormat
  }
  deriving (Image -> Image -> Bool
(Image -> Image -> Bool) -> (Image -> Image -> Bool) -> Eq Image
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Image -> Image -> Bool
== :: Image -> Image -> Bool
$c/= :: Image -> Image -> Bool
/= :: Image -> Image -> Bool
Eq, Int -> Image -> ShowS
[Image] -> ShowS
Image -> String
(Int -> Image -> ShowS)
-> (Image -> String) -> ([Image] -> ShowS) -> Show Image
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Image -> ShowS
showsPrec :: Int -> Image -> ShowS
$cshow :: Image -> String
show :: Image -> String
$cshowList :: [Image] -> ShowS
showList :: [Image] -> ShowS
Show)

instance Storable Image where
  sizeOf :: Image -> Int
sizeOf Image
_ = Int
24
  alignment :: Image -> Int
alignment Image
_ = Int
4
  peek :: Ptr Image -> IO Image
peek Ptr Image
_p = do
    Int
width <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Image -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Image
_p Int
8 :: IO CInt)
    Int
height <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Image -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Image
_p Int
12 :: IO CInt)
    Int
mipmaps <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Image -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Image
_p Int
16 :: IO CInt)
    PixelFormat
format <- Ptr Image -> Int -> IO PixelFormat
forall b. Ptr b -> Int -> IO PixelFormat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Image
_p Int
20
    Ptr CUChar
ptr <- (Ptr Image -> Int -> IO (Ptr CUChar)
forall b. Ptr b -> Int -> IO (Ptr CUChar)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Image
_p Int
0 :: IO (Ptr CUChar))
    [CUChar]
arr <- Int -> Ptr CUChar -> IO [CUChar]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray (Int -> Int -> Int -> Int
getPixelDataSize Int
width Int
height (PixelFormat -> Int
forall a. Enum a => a -> Int
fromEnum PixelFormat
format)) Ptr CUChar
ptr
    Image -> IO Image
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Image -> IO Image) -> Image -> IO Image
forall a b. (a -> b) -> a -> b
$ [Word8] -> Int -> Int -> Int -> PixelFormat -> Image
Image ((CUChar -> Word8) -> [CUChar] -> [Word8]
forall a b. (a -> b) -> [a] -> [b]
map CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral [CUChar]
arr) Int
width Int
height Int
mipmaps PixelFormat
format
  poke :: Ptr Image -> Image -> IO ()
poke Ptr Image
_p (Image [Word8]
arr Int
width Int
height Int
mipmaps PixelFormat
format) = do
    Ptr Image -> Int -> Ptr CUChar -> IO ()
forall b. Ptr b -> Int -> Ptr CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Image
_p Int
0 (Ptr CUChar -> IO ()) -> IO (Ptr CUChar) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [CUChar] -> IO (Ptr CUChar)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Word8 -> CUChar) -> [Word8] -> [CUChar]
forall a b. (a -> b) -> [a] -> [b]
map Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Word8]
arr :: [CUChar])
    Ptr Image -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Image
_p Int
8 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
width :: CInt)
    Ptr Image -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Image
_p Int
12 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
height :: CInt)
    Ptr Image -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Image
_p Int
16 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
mipmaps :: CInt)
    Ptr Image -> Int -> PixelFormat -> IO ()
forall b. Ptr b -> Int -> PixelFormat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Image
_p Int
20 PixelFormat
format
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Image where
  rlFreeDependents :: Image -> Ptr Image -> IO ()
rlFreeDependents Image
_ Ptr Image
ptr = do
    Ptr CUChar
dataPtr <- (Ptr Image -> Int -> IO (Ptr CUChar)
forall b. Ptr b -> Int -> IO (Ptr CUChar)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Image
ptr Int
0 :: IO (Ptr CUChar))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CUChar -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CUChar
dataPtr

data Texture = Texture
  { Texture -> Integer
texture'id :: Integer,
    Texture -> Int
texture'width :: Int,
    Texture -> Int
texture'height :: Int,
    Texture -> Int
texture'mipmaps :: Int,
    Texture -> PixelFormat
texture'format :: PixelFormat
  }
  deriving (Texture -> Texture -> Bool
(Texture -> Texture -> Bool)
-> (Texture -> Texture -> Bool) -> Eq Texture
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Texture -> Texture -> Bool
== :: Texture -> Texture -> Bool
$c/= :: Texture -> Texture -> Bool
/= :: Texture -> Texture -> Bool
Eq, Int -> Texture -> ShowS
[Texture] -> ShowS
Texture -> String
(Int -> Texture -> ShowS)
-> (Texture -> String) -> ([Texture] -> ShowS) -> Show Texture
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Texture -> ShowS
showsPrec :: Int -> Texture -> ShowS
$cshow :: Texture -> String
show :: Texture -> String
$cshowList :: [Texture] -> ShowS
showList :: [Texture] -> ShowS
Show, Texture -> Ptr Texture -> IO ()
(Texture -> Ptr Texture -> IO ())
-> (Texture -> Ptr Texture -> IO ()) -> Freeable Texture
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Texture -> Ptr Texture -> IO ()
rlFreeDependents :: Texture -> Ptr Texture -> IO ()
$crlFree :: Texture -> Ptr Texture -> IO ()
rlFree :: Texture -> Ptr Texture -> IO ()
Freeable)

instance Storable Texture where
  sizeOf :: Texture -> Int
sizeOf Texture
_ = Int
20
  alignment :: Texture -> Int
alignment Texture
_ = Int
4
  peek :: Ptr Texture -> IO Texture
peek Ptr Texture
_p = do
    Integer
tId <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Texture -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Texture
_p Int
0 :: IO CUInt)
    Int
width <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Texture -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Texture
_p Int
4 :: IO CInt)
    Int
height <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Texture -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Texture
_p Int
8 :: IO CInt)
    Int
mipmaps <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Texture -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Texture
_p Int
12 :: IO CInt)
    PixelFormat
format <- Ptr Texture -> Int -> IO PixelFormat
forall b. Ptr b -> Int -> IO PixelFormat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Texture
_p Int
16
    Texture -> IO Texture
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Texture -> IO Texture) -> Texture -> IO Texture
forall a b. (a -> b) -> a -> b
$ Integer -> Int -> Int -> Int -> PixelFormat -> Texture
Texture Integer
tId Int
width Int
height Int
mipmaps PixelFormat
format
  poke :: Ptr Texture -> Texture -> IO ()
poke Ptr Texture
_p (Texture Integer
tId Int
width Int
height Int
mipmaps PixelFormat
format) = do
    Ptr Texture -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Texture
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
tId :: CUInt)
    Ptr Texture -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Texture
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
width :: CInt)
    Ptr Texture -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Texture
_p Int
8 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
height :: CInt)
    Ptr Texture -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Texture
_p Int
12 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
mipmaps :: CInt)
    Ptr Texture -> Int -> PixelFormat -> IO ()
forall b. Ptr b -> Int -> PixelFormat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Texture
_p Int
16 PixelFormat
format
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

type Texture2D = Texture

type TextureCubemap = Texture

data RenderTexture = RenderTexture
  { RenderTexture -> Integer
renderTexture'id :: Integer,
    RenderTexture -> Texture
renderTexture'texture :: Texture,
    RenderTexture -> Texture
renderTexture'depth :: Texture
  }
  deriving (RenderTexture -> RenderTexture -> Bool
(RenderTexture -> RenderTexture -> Bool)
-> (RenderTexture -> RenderTexture -> Bool) -> Eq RenderTexture
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RenderTexture -> RenderTexture -> Bool
== :: RenderTexture -> RenderTexture -> Bool
$c/= :: RenderTexture -> RenderTexture -> Bool
/= :: RenderTexture -> RenderTexture -> Bool
Eq, Int -> RenderTexture -> ShowS
[RenderTexture] -> ShowS
RenderTexture -> String
(Int -> RenderTexture -> ShowS)
-> (RenderTexture -> String)
-> ([RenderTexture] -> ShowS)
-> Show RenderTexture
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RenderTexture -> ShowS
showsPrec :: Int -> RenderTexture -> ShowS
$cshow :: RenderTexture -> String
show :: RenderTexture -> String
$cshowList :: [RenderTexture] -> ShowS
showList :: [RenderTexture] -> ShowS
Show, RenderTexture -> Ptr RenderTexture -> IO ()
(RenderTexture -> Ptr RenderTexture -> IO ())
-> (RenderTexture -> Ptr RenderTexture -> IO ())
-> Freeable RenderTexture
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: RenderTexture -> Ptr RenderTexture -> IO ()
rlFreeDependents :: RenderTexture -> Ptr RenderTexture -> IO ()
$crlFree :: RenderTexture -> Ptr RenderTexture -> IO ()
rlFree :: RenderTexture -> Ptr RenderTexture -> IO ()
Freeable)

instance Storable RenderTexture where
  sizeOf :: RenderTexture -> Int
sizeOf RenderTexture
_ = Int
44
  alignment :: RenderTexture -> Int
alignment RenderTexture
_ = Int
4
  peek :: Ptr RenderTexture -> IO RenderTexture
peek Ptr RenderTexture
_p = do
    Integer
rtId <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RenderTexture -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RenderTexture
_p Int
0 :: IO CUInt)
    Texture
texture <- Ptr RenderTexture -> Int -> IO Texture
forall b. Ptr b -> Int -> IO Texture
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RenderTexture
_p Int
4
    Texture
depth <- Ptr RenderTexture -> Int -> IO Texture
forall b. Ptr b -> Int -> IO Texture
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RenderTexture
_p Int
24
    RenderTexture -> IO RenderTexture
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RenderTexture -> IO RenderTexture)
-> RenderTexture -> IO RenderTexture
forall a b. (a -> b) -> a -> b
$ Integer -> Texture -> Texture -> RenderTexture
RenderTexture Integer
rtId Texture
texture Texture
depth
  poke :: Ptr RenderTexture -> RenderTexture -> IO ()
poke Ptr RenderTexture
_p (RenderTexture Integer
rtId Texture
texture Texture
depth) = do
    Ptr RenderTexture -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RenderTexture
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
rtId :: CUInt)
    Ptr RenderTexture -> Int -> Texture -> IO ()
forall b. Ptr b -> Int -> Texture -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RenderTexture
_p Int
4 Texture
texture
    Ptr RenderTexture -> Int -> Texture -> IO ()
forall b. Ptr b -> Int -> Texture -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RenderTexture
_p Int
24 Texture
depth
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

type RenderTexture2D = RenderTexture

data NPatchInfo = NPatchInfo
  { NPatchInfo -> Rectangle
nPatchInfo'source :: Rectangle,
    NPatchInfo -> Int
nPatchInfo'left :: Int,
    NPatchInfo -> Int
nPatchInfo'top :: Int,
    NPatchInfo -> Int
nPatchInfo'right :: Int,
    NPatchInfo -> Int
nPatchInfo'bottom :: Int,
    NPatchInfo -> NPatchLayout
nPatchInfo'layout :: NPatchLayout
  }
  deriving (NPatchInfo -> NPatchInfo -> Bool
(NPatchInfo -> NPatchInfo -> Bool)
-> (NPatchInfo -> NPatchInfo -> Bool) -> Eq NPatchInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NPatchInfo -> NPatchInfo -> Bool
== :: NPatchInfo -> NPatchInfo -> Bool
$c/= :: NPatchInfo -> NPatchInfo -> Bool
/= :: NPatchInfo -> NPatchInfo -> Bool
Eq, Int -> NPatchInfo -> ShowS
[NPatchInfo] -> ShowS
NPatchInfo -> String
(Int -> NPatchInfo -> ShowS)
-> (NPatchInfo -> String)
-> ([NPatchInfo] -> ShowS)
-> Show NPatchInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NPatchInfo -> ShowS
showsPrec :: Int -> NPatchInfo -> ShowS
$cshow :: NPatchInfo -> String
show :: NPatchInfo -> String
$cshowList :: [NPatchInfo] -> ShowS
showList :: [NPatchInfo] -> ShowS
Show, NPatchInfo -> Ptr NPatchInfo -> IO ()
(NPatchInfo -> Ptr NPatchInfo -> IO ())
-> (NPatchInfo -> Ptr NPatchInfo -> IO ()) -> Freeable NPatchInfo
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: NPatchInfo -> Ptr NPatchInfo -> IO ()
rlFreeDependents :: NPatchInfo -> Ptr NPatchInfo -> IO ()
$crlFree :: NPatchInfo -> Ptr NPatchInfo -> IO ()
rlFree :: NPatchInfo -> Ptr NPatchInfo -> IO ()
Freeable)

instance Storable NPatchInfo where
  sizeOf :: NPatchInfo -> Int
sizeOf NPatchInfo
_ = Int
36
  alignment :: NPatchInfo -> Int
alignment NPatchInfo
_ = Int
4
  peek :: Ptr NPatchInfo -> IO NPatchInfo
peek Ptr NPatchInfo
_p = do
    Rectangle
source <- Ptr NPatchInfo -> Int -> IO Rectangle
forall b. Ptr b -> Int -> IO Rectangle
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr NPatchInfo
_p Int
0
    Int
left <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr NPatchInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr NPatchInfo
_p Int
16 :: IO CInt)
    Int
top <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr NPatchInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr NPatchInfo
_p Int
20 :: IO CInt)
    Int
right <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr NPatchInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr NPatchInfo
_p Int
24 :: IO CInt)
    Int
bottom <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr NPatchInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr NPatchInfo
_p Int
28 :: IO CInt)
    NPatchLayout
layout <- Ptr NPatchInfo -> Int -> IO NPatchLayout
forall b. Ptr b -> Int -> IO NPatchLayout
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr NPatchInfo
_p Int
32
    NPatchInfo -> IO NPatchInfo
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (NPatchInfo -> IO NPatchInfo) -> NPatchInfo -> IO NPatchInfo
forall a b. (a -> b) -> a -> b
$ Rectangle -> Int -> Int -> Int -> Int -> NPatchLayout -> NPatchInfo
NPatchInfo Rectangle
source Int
left Int
right Int
top Int
bottom NPatchLayout
layout
  poke :: Ptr NPatchInfo -> NPatchInfo -> IO ()
poke Ptr NPatchInfo
_p (NPatchInfo Rectangle
source Int
left Int
right Int
top Int
bottom NPatchLayout
layout) = do
    Ptr NPatchInfo -> Int -> Rectangle -> IO ()
forall b. Ptr b -> Int -> Rectangle -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr NPatchInfo
_p Int
0 Rectangle
source
    Ptr NPatchInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr NPatchInfo
_p Int
16 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
left :: CInt)
    Ptr NPatchInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr NPatchInfo
_p Int
20 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
right :: CInt)
    Ptr NPatchInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr NPatchInfo
_p Int
24 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
top :: CInt)
    Ptr NPatchInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr NPatchInfo
_p Int
28 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
bottom :: CInt)
    Ptr NPatchInfo -> Int -> NPatchLayout -> IO ()
forall b. Ptr b -> Int -> NPatchLayout -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr NPatchInfo
_p Int
32 NPatchLayout
layout
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data GlyphInfo = GlyphInfo
  { GlyphInfo -> Int
glyphInfo'value :: Int,
    GlyphInfo -> Int
glyphInfo'offsetX :: Int,
    GlyphInfo -> Int
glyphInfo'offsetY :: Int,
    GlyphInfo -> Int
glyphInfo'advanceX :: Int,
    GlyphInfo -> Image
glyphInfo'image :: Image
  }
  deriving (GlyphInfo -> GlyphInfo -> Bool
(GlyphInfo -> GlyphInfo -> Bool)
-> (GlyphInfo -> GlyphInfo -> Bool) -> Eq GlyphInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GlyphInfo -> GlyphInfo -> Bool
== :: GlyphInfo -> GlyphInfo -> Bool
$c/= :: GlyphInfo -> GlyphInfo -> Bool
/= :: GlyphInfo -> GlyphInfo -> Bool
Eq, Int -> GlyphInfo -> ShowS
[GlyphInfo] -> ShowS
GlyphInfo -> String
(Int -> GlyphInfo -> ShowS)
-> (GlyphInfo -> String)
-> ([GlyphInfo] -> ShowS)
-> Show GlyphInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GlyphInfo -> ShowS
showsPrec :: Int -> GlyphInfo -> ShowS
$cshow :: GlyphInfo -> String
show :: GlyphInfo -> String
$cshowList :: [GlyphInfo] -> ShowS
showList :: [GlyphInfo] -> ShowS
Show)

instance Storable GlyphInfo where
  sizeOf :: GlyphInfo -> Int
sizeOf GlyphInfo
_ = Int
40
  alignment :: GlyphInfo -> Int
alignment GlyphInfo
_ = Int
4
  peek :: Ptr GlyphInfo -> IO GlyphInfo
peek Ptr GlyphInfo
_p = do
    Int
value <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr GlyphInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr GlyphInfo
_p Int
0 :: IO CInt)
    Int
offsetX <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr GlyphInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr GlyphInfo
_p Int
4 :: IO CInt)
    Int
offsetY <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr GlyphInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr GlyphInfo
_p Int
8 :: IO CInt)
    Int
advanceX <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr GlyphInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr GlyphInfo
_p Int
12 :: IO CInt)
    Image
image <- Ptr GlyphInfo -> Int -> IO Image
forall b. Ptr b -> Int -> IO Image
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr GlyphInfo
_p Int
16
    GlyphInfo -> IO GlyphInfo
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (GlyphInfo -> IO GlyphInfo) -> GlyphInfo -> IO GlyphInfo
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> Int -> Image -> GlyphInfo
GlyphInfo Int
value Int
offsetX Int
offsetY Int
advanceX Image
image
  poke :: Ptr GlyphInfo -> GlyphInfo -> IO ()
poke Ptr GlyphInfo
_p (GlyphInfo Int
value Int
offsetX Int
offsetY Int
advanceX Image
image) = do
    Ptr GlyphInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr GlyphInfo
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
value :: CInt)
    Ptr GlyphInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr GlyphInfo
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
offsetX :: CInt)
    Ptr GlyphInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr GlyphInfo
_p Int
8 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
offsetY :: CInt)
    Ptr GlyphInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr GlyphInfo
_p Int
12 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
advanceX :: CInt)
    Ptr GlyphInfo -> Int -> Image -> IO ()
forall b. Ptr b -> Int -> Image -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr GlyphInfo
_p Int
16 Image
image
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable GlyphInfo where
  rlFreeDependents :: GlyphInfo -> Ptr GlyphInfo -> IO ()
rlFreeDependents GlyphInfo
_ Ptr GlyphInfo
ptr = do
    Ptr CUChar
dataPtr <- (Ptr GlyphInfo -> Int -> IO (Ptr CUChar)
forall b. Ptr b -> Int -> IO (Ptr CUChar)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr GlyphInfo
ptr Int
16 :: IO (Ptr CUChar))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CUChar -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CUChar
dataPtr

data Font = Font
  { Font -> Int
font'baseSize :: Int,
    Font -> Int
font'glyphCount :: Int,
    Font -> Int
font'glyphPadding :: Int,
    Font -> Texture
font'texture :: Texture,
    Font -> [Rectangle]
font'recs :: [Rectangle],
    Font -> [GlyphInfo]
font'glyphs :: [GlyphInfo]
  }
  deriving (Font -> Font -> Bool
(Font -> Font -> Bool) -> (Font -> Font -> Bool) -> Eq Font
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Font -> Font -> Bool
== :: Font -> Font -> Bool
$c/= :: Font -> Font -> Bool
/= :: Font -> Font -> Bool
Eq, Int -> Font -> ShowS
[Font] -> ShowS
Font -> String
(Int -> Font -> ShowS)
-> (Font -> String) -> ([Font] -> ShowS) -> Show Font
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Font -> ShowS
showsPrec :: Int -> Font -> ShowS
$cshow :: Font -> String
show :: Font -> String
$cshowList :: [Font] -> ShowS
showList :: [Font] -> ShowS
Show)

instance Storable Font where
  sizeOf :: Font -> Int
sizeOf Font
_ = Int
48
  alignment :: Font -> Int
alignment Font
_ = Int
4
  peek :: Ptr Font -> IO Font
peek Ptr Font
_p = do
    Int
baseSize <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Font -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
_p Int
0 :: IO CInt)
    Int
glyphCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Font -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
_p Int
4 :: IO CInt)
    Int
glyphPadding <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Font -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
_p Int
8 :: IO CInt)
    Texture
texture <- Ptr Font -> Int -> IO Texture
forall b. Ptr b -> Int -> IO Texture
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
_p Int
12
    Ptr Rectangle
recPtr <- (Ptr Font -> Int -> IO (Ptr Rectangle)
forall b. Ptr b -> Int -> IO (Ptr Rectangle)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
_p Int
32 :: IO (Ptr Rectangle))
    [Rectangle]
recs <- Int -> Ptr Rectangle -> IO [Rectangle]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
glyphCount Ptr Rectangle
recPtr
    Ptr GlyphInfo
glyphPtr <- (Ptr Font -> Int -> IO (Ptr GlyphInfo)
forall b. Ptr b -> Int -> IO (Ptr GlyphInfo)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
_p Int
40 :: IO (Ptr GlyphInfo))
    [GlyphInfo]
glyphs <- Int -> Ptr GlyphInfo -> IO [GlyphInfo]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
glyphCount Ptr GlyphInfo
glyphPtr
    Font -> IO Font
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Font -> IO Font) -> Font -> IO Font
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> Texture -> [Rectangle] -> [GlyphInfo] -> Font
Font Int
baseSize Int
glyphCount Int
glyphPadding Texture
texture [Rectangle]
recs [GlyphInfo]
glyphs
  poke :: Ptr Font -> Font -> IO ()
poke Ptr Font
_p (Font Int
baseSize Int
glyphCount Int
glyphPadding Texture
texture [Rectangle]
recs [GlyphInfo]
glyphs) = do
    Ptr Font -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Font
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
baseSize :: CInt)
    Ptr Font -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Font
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
glyphCount :: CInt)
    Ptr Font -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Font
_p Int
8 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
glyphPadding :: CInt)
    Ptr Font -> Int -> Texture -> IO ()
forall b. Ptr b -> Int -> Texture -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Font
_p Int
12 Texture
texture
    Ptr Font -> Int -> Ptr Rectangle -> IO ()
forall b. Ptr b -> Int -> Ptr Rectangle -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Font
_p Int
32 (Ptr Rectangle -> IO ()) -> IO (Ptr Rectangle) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Rectangle] -> IO (Ptr Rectangle)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Rectangle]
recs
    Ptr Font -> Int -> Ptr GlyphInfo -> IO ()
forall b. Ptr b -> Int -> Ptr GlyphInfo -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Font
_p Int
40 (Ptr GlyphInfo -> IO ()) -> IO (Ptr GlyphInfo) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [GlyphInfo] -> IO (Ptr GlyphInfo)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [GlyphInfo]
glyphs
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Font where
  rlFreeDependents :: Font -> Ptr Font -> IO ()
rlFreeDependents Font
val Ptr Font
ptr = do
    Ptr Rectangle
recsPtr <- (Ptr Font -> Int -> IO (Ptr Rectangle)
forall b. Ptr b -> Int -> IO (Ptr Rectangle)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
ptr Int
32 :: IO (Ptr Rectangle))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Rectangle -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Rectangle
recsPtr
    Ptr GlyphInfo
glyphsPtr <- (Ptr Font -> Int -> IO (Ptr GlyphInfo)
forall b. Ptr b -> Int -> IO (Ptr GlyphInfo)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Font
ptr Int
40 :: IO (Ptr GlyphInfo))
    [GlyphInfo] -> Ptr GlyphInfo -> IO ()
forall a. (Freeable a, Storable a) => [a] -> Ptr a -> IO ()
rlFreeArray (Font -> [GlyphInfo]
font'glyphs Font
val) Ptr GlyphInfo
glyphsPtr

data Camera3D = Camera3D
  { Camera3D -> Vector3
camera3D'position :: Vector3,
    Camera3D -> Vector3
camera3D'target :: Vector3,
    Camera3D -> Vector3
camera3D'up :: Vector3,
    Camera3D -> Float
camera3D'fovy :: Float,
    Camera3D -> CameraProjection
camera3D'projection :: CameraProjection
  }
  deriving (Camera3D -> Camera3D -> Bool
(Camera3D -> Camera3D -> Bool)
-> (Camera3D -> Camera3D -> Bool) -> Eq Camera3D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Camera3D -> Camera3D -> Bool
== :: Camera3D -> Camera3D -> Bool
$c/= :: Camera3D -> Camera3D -> Bool
/= :: Camera3D -> Camera3D -> Bool
Eq, Int -> Camera3D -> ShowS
[Camera3D] -> ShowS
Camera3D -> String
(Int -> Camera3D -> ShowS)
-> (Camera3D -> String) -> ([Camera3D] -> ShowS) -> Show Camera3D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Camera3D -> ShowS
showsPrec :: Int -> Camera3D -> ShowS
$cshow :: Camera3D -> String
show :: Camera3D -> String
$cshowList :: [Camera3D] -> ShowS
showList :: [Camera3D] -> ShowS
Show, Camera3D -> Ptr Camera3D -> IO ()
(Camera3D -> Ptr Camera3D -> IO ())
-> (Camera3D -> Ptr Camera3D -> IO ()) -> Freeable Camera3D
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Camera3D -> Ptr Camera3D -> IO ()
rlFreeDependents :: Camera3D -> Ptr Camera3D -> IO ()
$crlFree :: Camera3D -> Ptr Camera3D -> IO ()
rlFree :: Camera3D -> Ptr Camera3D -> IO ()
Freeable)

instance Storable Camera3D where
  sizeOf :: Camera3D -> Int
sizeOf Camera3D
_ = Int
44
  alignment :: Camera3D -> Int
alignment Camera3D
_ = Int
4
  peek :: Ptr Camera3D -> IO Camera3D
peek Ptr Camera3D
_p = do
    Vector3
position <- Ptr Camera3D -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera3D
_p Int
0
    Vector3
target <- Ptr Camera3D -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera3D
_p Int
12
    Vector3
up <- Ptr Camera3D -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera3D
_p Int
24
    Float
fovy <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Camera3D -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera3D
_p Int
36 :: IO CFloat)
    CameraProjection
projection <- Ptr Camera3D -> Int -> IO CameraProjection
forall b. Ptr b -> Int -> IO CameraProjection
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera3D
_p Int
40
    Camera3D -> IO Camera3D
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Camera3D -> IO Camera3D) -> Camera3D -> IO Camera3D
forall a b. (a -> b) -> a -> b
$ Vector3
-> Vector3 -> Vector3 -> Float -> CameraProjection -> Camera3D
Camera3D Vector3
position Vector3
target Vector3
up Float
fovy CameraProjection
projection
  poke :: Ptr Camera3D -> Camera3D -> IO ()
poke Ptr Camera3D
_p (Camera3D Vector3
position Vector3
target Vector3
up Float
fovy CameraProjection
projection) = do
    Ptr Camera3D -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera3D
_p Int
0 Vector3
position
    Ptr Camera3D -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera3D
_p Int
12 Vector3
target
    Ptr Camera3D -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera3D
_p Int
24 Vector3
up
    Ptr Camera3D -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera3D
_p Int
36 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
fovy :: CFloat)
    Ptr Camera3D -> Int -> CameraProjection -> IO ()
forall b. Ptr b -> Int -> CameraProjection -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera3D
_p Int
40 CameraProjection
projection
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

type Camera = Camera3D

data Camera2D = Camera2D
  { Camera2D -> Vector2
camera2D'offset :: Vector2,
    Camera2D -> Vector2
camera2D'target :: Vector2,
    Camera2D -> Float
camera2D'rotation :: Float,
    Camera2D -> Float
camera2D'zoom :: Float
  }
  deriving (Camera2D -> Camera2D -> Bool
(Camera2D -> Camera2D -> Bool)
-> (Camera2D -> Camera2D -> Bool) -> Eq Camera2D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Camera2D -> Camera2D -> Bool
== :: Camera2D -> Camera2D -> Bool
$c/= :: Camera2D -> Camera2D -> Bool
/= :: Camera2D -> Camera2D -> Bool
Eq, Int -> Camera2D -> ShowS
[Camera2D] -> ShowS
Camera2D -> String
(Int -> Camera2D -> ShowS)
-> (Camera2D -> String) -> ([Camera2D] -> ShowS) -> Show Camera2D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Camera2D -> ShowS
showsPrec :: Int -> Camera2D -> ShowS
$cshow :: Camera2D -> String
show :: Camera2D -> String
$cshowList :: [Camera2D] -> ShowS
showList :: [Camera2D] -> ShowS
Show, Camera2D -> Ptr Camera2D -> IO ()
(Camera2D -> Ptr Camera2D -> IO ())
-> (Camera2D -> Ptr Camera2D -> IO ()) -> Freeable Camera2D
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Camera2D -> Ptr Camera2D -> IO ()
rlFreeDependents :: Camera2D -> Ptr Camera2D -> IO ()
$crlFree :: Camera2D -> Ptr Camera2D -> IO ()
rlFree :: Camera2D -> Ptr Camera2D -> IO ()
Freeable)

instance Storable Camera2D where
  sizeOf :: Camera2D -> Int
sizeOf Camera2D
_ = Int
24
  alignment :: Camera2D -> Int
alignment Camera2D
_ = Int
4
  peek :: Ptr Camera2D -> IO Camera2D
peek Ptr Camera2D
_p = do
    Vector2
offset <- Ptr Camera2D -> Int -> IO Vector2
forall b. Ptr b -> Int -> IO Vector2
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera2D
_p Int
0
    Vector2
target <- Ptr Camera2D -> Int -> IO Vector2
forall b. Ptr b -> Int -> IO Vector2
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera2D
_p Int
8
    Float
rotation <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Camera2D -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera2D
_p Int
16 :: IO CFloat)
    Float
zoom <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Camera2D -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Camera2D
_p Int
20 :: IO CFloat)
    Camera2D -> IO Camera2D
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Camera2D -> IO Camera2D) -> Camera2D -> IO Camera2D
forall a b. (a -> b) -> a -> b
$ Vector2 -> Vector2 -> Float -> Float -> Camera2D
Camera2D Vector2
offset Vector2
target Float
rotation Float
zoom
  poke :: Ptr Camera2D -> Camera2D -> IO ()
poke Ptr Camera2D
_p (Camera2D Vector2
offset Vector2
target Float
rotation Float
zoom) = do
    Ptr Camera2D -> Int -> Vector2 -> IO ()
forall b. Ptr b -> Int -> Vector2 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera2D
_p Int
0 Vector2
offset
    Ptr Camera2D -> Int -> Vector2 -> IO ()
forall b. Ptr b -> Int -> Vector2 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera2D
_p Int
8 Vector2
target
    Ptr Camera2D -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera2D
_p Int
16 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
rotation :: CFloat)
    Ptr Camera2D -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Camera2D
_p Int
20 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
zoom :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Mesh = Mesh
  { Mesh -> Int
mesh'vertexCount :: Int,
    Mesh -> Int
mesh'triangleCount :: Int,
    Mesh -> [Vector3]
mesh'vertices :: [Vector3],
    Mesh -> [Vector2]
mesh'texcoords :: [Vector2],
    Mesh -> Maybe [Vector2]
mesh'texcoords2 :: Maybe [Vector2],
    Mesh -> [Vector3]
mesh'normals :: [Vector3],
    Mesh -> Maybe [Vector4]
mesh'tangents :: Maybe [Vector4],
    Mesh -> Maybe [Color]
mesh'colors :: Maybe [Color],
    Mesh -> Maybe [Word16]
mesh'indices :: Maybe [Word16],
    Mesh -> Maybe [Vector3]
mesh'animVertices :: Maybe [Vector3],
    Mesh -> Maybe [Vector3]
mesh'animNormals :: Maybe [Vector3],
    Mesh -> Maybe [Word8]
mesh'boneIds :: Maybe [Word8],
    Mesh -> Maybe [Float]
mesh'boneWeights :: Maybe [Float],
    Mesh -> Integer
mesh'vaoId :: Integer,
    Mesh -> Maybe [Integer]
mesh'vboId :: Maybe [Integer]
  }
  deriving (Mesh -> Mesh -> Bool
(Mesh -> Mesh -> Bool) -> (Mesh -> Mesh -> Bool) -> Eq Mesh
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Mesh -> Mesh -> Bool
== :: Mesh -> Mesh -> Bool
$c/= :: Mesh -> Mesh -> Bool
/= :: Mesh -> Mesh -> Bool
Eq, Int -> Mesh -> ShowS
[Mesh] -> ShowS
Mesh -> String
(Int -> Mesh -> ShowS)
-> (Mesh -> String) -> ([Mesh] -> ShowS) -> Show Mesh
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Mesh -> ShowS
showsPrec :: Int -> Mesh -> ShowS
$cshow :: Mesh -> String
show :: Mesh -> String
$cshowList :: [Mesh] -> ShowS
showList :: [Mesh] -> ShowS
Show)

instance Storable Mesh where
  sizeOf :: Mesh -> Int
sizeOf Mesh
_ = Int
112
  alignment :: Mesh -> Int
alignment Mesh
_ = Int
8
  peek :: Ptr Mesh -> IO Mesh
peek Ptr Mesh
_p = do
    Int
vertexCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Mesh -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
0 :: IO CInt)
    Int
triangleCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Mesh -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
4 :: IO CInt)
    Ptr Vector3
verticesPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
8 :: IO (Ptr Vector3))
    [Vector3]
vertices <- Int -> Ptr Vector3 -> IO [Vector3]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
vertexCount Ptr Vector3
verticesPtr
    Ptr Vector2
texcoordsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector2)
forall b. Ptr b -> Int -> IO (Ptr Vector2)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
16 :: IO (Ptr Vector2))
    [Vector2]
texcoords <- Int -> Ptr Vector2 -> IO [Vector2]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
vertexCount Ptr Vector2
texcoordsPtr
    Ptr Vector2
texcoords2Ptr <- (Ptr Mesh -> Int -> IO (Ptr Vector2)
forall b. Ptr b -> Int -> IO (Ptr Vector2)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
24 :: IO (Ptr Vector2))
    Maybe [Vector2]
texcoords2 <- Int -> Ptr Vector2 -> IO (Maybe [Vector2])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
vertexCount Ptr Vector2
texcoords2Ptr
    Ptr Vector3
normalsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
32 :: IO (Ptr Vector3))
    [Vector3]
normals <- Int -> Ptr Vector3 -> IO [Vector3]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
vertexCount Ptr Vector3
normalsPtr
    Ptr Vector4
tangentsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector4)
forall b. Ptr b -> Int -> IO (Ptr Vector4)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
40 :: IO (Ptr Vector4))
    Maybe [Vector4]
tangents <- Int -> Ptr Vector4 -> IO (Maybe [Vector4])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
vertexCount Ptr Vector4
tangentsPtr
    Ptr Color
colorsPtr <- (Ptr Mesh -> Int -> IO (Ptr Color)
forall b. Ptr b -> Int -> IO (Ptr Color)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
48 :: IO (Ptr Color))
    Maybe [Color]
colors <- Int -> Ptr Color -> IO (Maybe [Color])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
vertexCount Ptr Color
colorsPtr
    Ptr CUShort
indicesPtr <- (Ptr Mesh -> Int -> IO (Ptr CUShort)
forall b. Ptr b -> Int -> IO (Ptr CUShort)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
56 :: IO (Ptr CUShort))
    Maybe [Word16]
indices <- (\Maybe [CUShort]
m -> (CUShort -> Word16) -> [CUShort] -> [Word16]
forall a b. (a -> b) -> [a] -> [b]
map CUShort -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CUShort] -> [Word16]) -> Maybe [CUShort] -> Maybe [Word16]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [CUShort]
m) (Maybe [CUShort] -> Maybe [Word16])
-> IO (Maybe [CUShort]) -> IO (Maybe [Word16])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CUShort -> IO (Maybe [CUShort])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
vertexCount Ptr CUShort
indicesPtr
    Ptr Vector3
animVerticesPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
64 :: IO (Ptr Vector3))
    Maybe [Vector3]
animVertices <- Int -> Ptr Vector3 -> IO (Maybe [Vector3])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
vertexCount Ptr Vector3
animVerticesPtr
    Ptr Vector3
animNormalsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
72 :: IO (Ptr Vector3))
    Maybe [Vector3]
animNormals <- Int -> Ptr Vector3 -> IO (Maybe [Vector3])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
vertexCount Ptr Vector3
animNormalsPtr
    Ptr CUChar
boneIdsPtr <- (Ptr Mesh -> Int -> IO (Ptr CUChar)
forall b. Ptr b -> Int -> IO (Ptr CUChar)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
80 :: IO (Ptr CUChar))
    Maybe [Word8]
boneIds <- (\Maybe [CUChar]
m -> (CUChar -> Word8) -> [CUChar] -> [Word8]
forall a b. (a -> b) -> [a] -> [b]
map CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CUChar] -> [Word8]) -> Maybe [CUChar] -> Maybe [Word8]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [CUChar]
m) (Maybe [CUChar] -> Maybe [Word8])
-> IO (Maybe [CUChar]) -> IO (Maybe [Word8])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CUChar -> IO (Maybe [CUChar])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray (Int
vertexCount Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4) Ptr CUChar
boneIdsPtr
    Ptr CFloat
boneWeightsPtr <- (Ptr Mesh -> Int -> IO (Ptr CFloat)
forall b. Ptr b -> Int -> IO (Ptr CFloat)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
88 :: IO (Ptr CFloat))
    Maybe [Float]
boneWeights <- ((CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> Maybe [CFloat] -> Maybe [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) (Maybe [CFloat] -> Maybe [Float])
-> IO (Maybe [CFloat]) -> IO (Maybe [Float])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CFloat -> IO (Maybe [CFloat])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray (Int
vertexCount Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4) Ptr CFloat
boneWeightsPtr
    Integer
vaoId <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Mesh -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
96 :: IO CUInt)
    Ptr CUInt
vboIdPtr <- (Ptr Mesh -> Int -> IO (Ptr CUInt)
forall b. Ptr b -> Int -> IO (Ptr CUInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
_p Int
104 :: IO (Ptr CUInt))
    Maybe [Integer]
vboId <- (\Maybe [CUInt]
m -> (CUInt -> Integer) -> [CUInt] -> [Integer]
forall a b. (a -> b) -> [a] -> [b]
map CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CUInt] -> [Integer]) -> Maybe [CUInt] -> Maybe [Integer]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [CUInt]
m) (Maybe [CUInt] -> Maybe [Integer])
-> IO (Maybe [CUInt]) -> IO (Maybe [Integer])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CUInt -> IO (Maybe [CUInt])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
7 Ptr CUInt
vboIdPtr
    Mesh -> IO Mesh
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Mesh -> IO Mesh) -> Mesh -> IO Mesh
forall a b. (a -> b) -> a -> b
$ Int
-> Int
-> [Vector3]
-> [Vector2]
-> Maybe [Vector2]
-> [Vector3]
-> Maybe [Vector4]
-> Maybe [Color]
-> Maybe [Word16]
-> Maybe [Vector3]
-> Maybe [Vector3]
-> Maybe [Word8]
-> Maybe [Float]
-> Integer
-> Maybe [Integer]
-> Mesh
Mesh Int
vertexCount Int
triangleCount [Vector3]
vertices [Vector2]
texcoords Maybe [Vector2]
texcoords2 [Vector3]
normals Maybe [Vector4]
tangents Maybe [Color]
colors Maybe [Word16]
indices Maybe [Vector3]
animVertices Maybe [Vector3]
animNormals Maybe [Word8]
boneIds Maybe [Float]
boneWeights Integer
vaoId Maybe [Integer]
vboId
  poke :: Ptr Mesh -> Mesh -> IO ()
poke Ptr Mesh
_p (Mesh Int
vertexCount Int
triangleCount [Vector3]
vertices [Vector2]
texcoords Maybe [Vector2]
texcoords2 [Vector3]
normals Maybe [Vector4]
tangents Maybe [Color]
colors Maybe [Word16]
indices Maybe [Vector3]
animVertices Maybe [Vector3]
animNormals Maybe [Word8]
boneIds Maybe [Float]
boneWeights Integer
vaoId Maybe [Integer]
vboId) = do
    Ptr Mesh -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
vertexCount :: CInt)
    Ptr Mesh -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
triangleCount :: CInt)
    Ptr Mesh -> Int -> Ptr Vector3 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
8 (Ptr Vector3 -> IO ()) -> IO (Ptr Vector3) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Vector3] -> IO (Ptr Vector3)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Vector3]
vertices
    Ptr Mesh -> Int -> Ptr Vector2 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector2 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
16 (Ptr Vector2 -> IO ()) -> IO (Ptr Vector2) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Vector2] -> IO (Ptr Vector2)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Vector2]
texcoords
    Maybe [Vector2] -> IO (Ptr Vector2)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [Vector2]
texcoords2 IO (Ptr Vector2) -> (Ptr Vector2 -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr Vector2 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector2 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
24
    Ptr Mesh -> Int -> Ptr Vector3 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
32 (Ptr Vector3 -> IO ()) -> IO (Ptr Vector3) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Vector3] -> IO (Ptr Vector3)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Vector3]
normals
    Maybe [Vector4] -> IO (Ptr Vector4)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [Vector4]
tangents IO (Ptr Vector4) -> (Ptr Vector4 -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr Vector4 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector4 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
40
    Maybe [Color] -> IO (Ptr Color)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [Color]
colors IO (Ptr Color) -> (Ptr Color -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr Color -> IO ()
forall b. Ptr b -> Int -> Ptr Color -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
48
    Maybe [CUShort] -> IO (Ptr CUShort)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray ((Word16 -> CUShort) -> [Word16] -> [CUShort]
forall a b. (a -> b) -> [a] -> [b]
map Word16 -> CUShort
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Word16] -> [CUShort]) -> Maybe [Word16] -> Maybe [CUShort]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [Word16]
indices :: Maybe [CUShort]) IO (Ptr CUShort) -> (Ptr CUShort -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr CUShort -> IO ()
forall b. Ptr b -> Int -> Ptr CUShort -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
56
    Maybe [Vector3] -> IO (Ptr Vector3)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [Vector3]
animVertices IO (Ptr Vector3) -> (Ptr Vector3 -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr Vector3 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
64
    Maybe [Vector3] -> IO (Ptr Vector3)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [Vector3]
animNormals IO (Ptr Vector3) -> (Ptr Vector3 -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr Vector3 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
72
    Maybe [CUChar] -> IO (Ptr CUChar)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray ((Word8 -> CUChar) -> [Word8] -> [CUChar]
forall a b. (a -> b) -> [a] -> [b]
map Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Word8] -> [CUChar]) -> Maybe [Word8] -> Maybe [CUChar]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [Word8]
boneIds :: Maybe [CUChar]) IO (Ptr CUChar) -> (Ptr CUChar -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr CUChar -> IO ()
forall b. Ptr b -> Int -> Ptr CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
80
    Maybe [CFloat] -> IO (Ptr CFloat)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([Float] -> [CFloat]) -> Maybe [Float] -> Maybe [CFloat]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [Float]
boneWeights :: Maybe [CFloat]) IO (Ptr CFloat) -> (Ptr CFloat -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr CFloat -> IO ()
forall b. Ptr b -> Int -> Ptr CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
88
    Ptr Mesh -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
96 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
vaoId :: CUInt)
    Maybe [CUInt] -> IO (Ptr CUInt)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray ((Integer -> CUInt) -> [Integer] -> [CUInt]
forall a b. (a -> b) -> [a] -> [b]
map Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Integer] -> [CUInt]) -> Maybe [Integer] -> Maybe [CUInt]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [Integer]
vboId :: Maybe [CUInt]) IO (Ptr CUInt) -> (Ptr CUInt -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Mesh -> Int -> Ptr CUInt -> IO ()
forall b. Ptr b -> Int -> Ptr CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Mesh
_p Int
104
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Mesh where
  rlFreeDependents :: Mesh -> Ptr Mesh -> IO ()
rlFreeDependents Mesh
_ Ptr Mesh
ptr = do
    Ptr Float
verticesPtr <- (Ptr Mesh -> Int -> IO (Ptr Float)
forall b. Ptr b -> Int -> IO (Ptr Float)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
8 :: IO (Ptr Float))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Float -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Float
verticesPtr
    Ptr Vector2
texcoordsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector2)
forall b. Ptr b -> Int -> IO (Ptr Vector2)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
16 :: IO (Ptr Vector2))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector2 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector2
texcoordsPtr
    Ptr Vector2
texcoords2Ptr <- (Ptr Mesh -> Int -> IO (Ptr Vector2)
forall b. Ptr b -> Int -> IO (Ptr Vector2)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
24 :: IO (Ptr Vector2))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector2 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector2
texcoords2Ptr
    Ptr Vector3
normalsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
32 :: IO (Ptr Vector3))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector3 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector3
normalsPtr
    Ptr Vector4
tangentsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector4)
forall b. Ptr b -> Int -> IO (Ptr Vector4)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
40 :: IO (Ptr Vector4))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector4 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector4
tangentsPtr
    Ptr Color
colorsPtr <- (Ptr Mesh -> Int -> IO (Ptr Color)
forall b. Ptr b -> Int -> IO (Ptr Color)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
48 :: IO (Ptr Color))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Color -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Color
colorsPtr
    Ptr CUShort
indicesPtr <- (Ptr Mesh -> Int -> IO (Ptr CUShort)
forall b. Ptr b -> Int -> IO (Ptr CUShort)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
56 :: IO (Ptr CUShort))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CUShort -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CUShort
indicesPtr
    Ptr Vector3
animVerticesPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
64 :: IO (Ptr Vector3))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector3 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector3
animVerticesPtr
    Ptr Vector3
animNormalsPtr <- (Ptr Mesh -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
72 :: IO (Ptr Vector3))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector3 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector3
animNormalsPtr
    Ptr CUChar
boneIdsPtr <- (Ptr Mesh -> Int -> IO (Ptr CUChar)
forall b. Ptr b -> Int -> IO (Ptr CUChar)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
80 :: IO (Ptr CUChar))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CUChar -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CUChar
boneIdsPtr
    Ptr CFloat
boneWeightsPtr <- (Ptr Mesh -> Int -> IO (Ptr CFloat)
forall b. Ptr b -> Int -> IO (Ptr CFloat)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
88 :: IO (Ptr CFloat))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CFloat -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CFloat
boneWeightsPtr
    Ptr CUInt
vboIdPtr <- (Ptr Mesh -> Int -> IO (Ptr CUInt)
forall b. Ptr b -> Int -> IO (Ptr CUInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Mesh
ptr Int
104 :: IO (Ptr CUInt))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CUInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CUInt
vboIdPtr

data Shader = Shader
  { Shader -> Integer
shader'id :: Integer,
    Shader -> [Int]
shader'locs :: [Int]
  }
  deriving (Shader -> Shader -> Bool
(Shader -> Shader -> Bool)
-> (Shader -> Shader -> Bool) -> Eq Shader
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Shader -> Shader -> Bool
== :: Shader -> Shader -> Bool
$c/= :: Shader -> Shader -> Bool
/= :: Shader -> Shader -> Bool
Eq, Int -> Shader -> ShowS
[Shader] -> ShowS
Shader -> String
(Int -> Shader -> ShowS)
-> (Shader -> String) -> ([Shader] -> ShowS) -> Show Shader
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Shader -> ShowS
showsPrec :: Int -> Shader -> ShowS
$cshow :: Shader -> String
show :: Shader -> String
$cshowList :: [Shader] -> ShowS
showList :: [Shader] -> ShowS
Show)

instance Storable Shader where
  sizeOf :: Shader -> Int
sizeOf Shader
_ = Int
16
  alignment :: Shader -> Int
alignment Shader
_ = Int
8
  peek :: Ptr Shader -> IO Shader
peek Ptr Shader
_p = do
    Integer
sId <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Shader -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Shader
_p Int
0 :: IO CUInt)
    Ptr CInt
locsPtr <- (Ptr Shader -> Int -> IO (Ptr CInt)
forall b. Ptr b -> Int -> IO (Ptr CInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Shader
_p Int
8 :: IO (Ptr CInt))
    [Int]
locs <- (CInt -> Int) -> [CInt] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CInt] -> [Int]) -> IO [CInt] -> IO [Int]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
32 Ptr CInt
locsPtr
    Shader -> IO Shader
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Shader -> IO Shader) -> Shader -> IO Shader
forall a b. (a -> b) -> a -> b
$ Integer -> [Int] -> Shader
Shader Integer
sId [Int]
locs
  poke :: Ptr Shader -> Shader -> IO ()
poke Ptr Shader
_p (Shader Integer
sId [Int]
locs) = do
    Ptr Shader -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Shader
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
sId :: CUInt)
    CUInt
defaultShaderId <- IO CUInt
c'rlGetShaderIdDefault
    Ptr CInt
locsArr <- [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
locs :: [CInt])
    if Integer
sId Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
== CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
defaultShaderId
      then do
        ForeignPtr CInt
locsPtr <- FinalizerPtr CInt -> Ptr CInt -> IO (ForeignPtr CInt)
forall a. FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)
newForeignPtr FinalizerPtr CInt
forall a. FunPtr (Ptr a -> IO ())
p'free Ptr CInt
locsArr
        ForeignPtr CInt -> (Ptr CInt -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr CInt
locsPtr ((Ptr CInt -> IO ()) -> IO ()) -> (Ptr CInt -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Shader -> Int -> Ptr CInt -> IO ()
forall b. Ptr b -> Int -> Ptr CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Shader
_p Int
8
      else Ptr Shader -> Int -> Ptr CInt -> IO ()
forall b. Ptr b -> Int -> Ptr CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Shader
_p Int
8 Ptr CInt
locsArr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Shader where
  rlFreeDependents :: Shader -> Ptr Shader -> IO ()
rlFreeDependents Shader
val Ptr Shader
ptr = do
    CUInt
defaultShaderId <- IO CUInt
c'rlGetShaderIdDefault
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless
      (Shader -> Integer
shader'id Shader
val Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
== CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
defaultShaderId)
      ( do
          Ptr CInt
locsPtr <- (Ptr Shader -> Int -> IO (Ptr CInt)
forall b. Ptr b -> Int -> IO (Ptr CInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Shader
ptr Int
8 :: IO (Ptr CInt))
          Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
locsPtr
      )

data MaterialMap = MaterialMap
  { MaterialMap -> Texture
materialMap'texture :: Texture,
    MaterialMap -> Color
materialMap'color :: Color,
    MaterialMap -> Float
materialMap'value :: Float
  }
  deriving (MaterialMap -> MaterialMap -> Bool
(MaterialMap -> MaterialMap -> Bool)
-> (MaterialMap -> MaterialMap -> Bool) -> Eq MaterialMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MaterialMap -> MaterialMap -> Bool
== :: MaterialMap -> MaterialMap -> Bool
$c/= :: MaterialMap -> MaterialMap -> Bool
/= :: MaterialMap -> MaterialMap -> Bool
Eq, Int -> MaterialMap -> ShowS
[MaterialMap] -> ShowS
MaterialMap -> String
(Int -> MaterialMap -> ShowS)
-> (MaterialMap -> String)
-> ([MaterialMap] -> ShowS)
-> Show MaterialMap
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MaterialMap -> ShowS
showsPrec :: Int -> MaterialMap -> ShowS
$cshow :: MaterialMap -> String
show :: MaterialMap -> String
$cshowList :: [MaterialMap] -> ShowS
showList :: [MaterialMap] -> ShowS
Show, MaterialMap -> Ptr MaterialMap -> IO ()
(MaterialMap -> Ptr MaterialMap -> IO ())
-> (MaterialMap -> Ptr MaterialMap -> IO ())
-> Freeable MaterialMap
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: MaterialMap -> Ptr MaterialMap -> IO ()
rlFreeDependents :: MaterialMap -> Ptr MaterialMap -> IO ()
$crlFree :: MaterialMap -> Ptr MaterialMap -> IO ()
rlFree :: MaterialMap -> Ptr MaterialMap -> IO ()
Freeable)

instance Storable MaterialMap where
  sizeOf :: MaterialMap -> Int
sizeOf MaterialMap
_ = Int
28
  alignment :: MaterialMap -> Int
alignment MaterialMap
_ = Int
4
  peek :: Ptr MaterialMap -> IO MaterialMap
peek Ptr MaterialMap
_p = do
    Texture
texture <- Ptr MaterialMap -> Int -> IO Texture
forall b. Ptr b -> Int -> IO Texture
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr MaterialMap
_p Int
0
    Color
color <- Ptr MaterialMap -> Int -> IO Color
forall b. Ptr b -> Int -> IO Color
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr MaterialMap
_p Int
20
    Float
value <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr MaterialMap -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr MaterialMap
_p Int
24 :: IO CFloat)
    MaterialMap -> IO MaterialMap
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (MaterialMap -> IO MaterialMap) -> MaterialMap -> IO MaterialMap
forall a b. (a -> b) -> a -> b
$ Texture -> Color -> Float -> MaterialMap
MaterialMap Texture
texture Color
color Float
value
  poke :: Ptr MaterialMap -> MaterialMap -> IO ()
poke Ptr MaterialMap
_p (MaterialMap Texture
texture Color
color Float
value) = do
    Ptr MaterialMap -> Int -> Texture -> IO ()
forall b. Ptr b -> Int -> Texture -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr MaterialMap
_p Int
0 Texture
texture
    Ptr MaterialMap -> Int -> Color -> IO ()
forall b. Ptr b -> Int -> Color -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr MaterialMap
_p Int
20 Color
color
    Ptr MaterialMap -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr MaterialMap
_p Int
24 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
value :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Material = Material
  { Material -> Shader
material'shader :: Shader,
    Material -> Maybe [MaterialMap]
material'maps :: Maybe [MaterialMap],
    Material -> [Float]
material'params :: [Float]
  }
  deriving (Material -> Material -> Bool
(Material -> Material -> Bool)
-> (Material -> Material -> Bool) -> Eq Material
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Material -> Material -> Bool
== :: Material -> Material -> Bool
$c/= :: Material -> Material -> Bool
/= :: Material -> Material -> Bool
Eq, Int -> Material -> ShowS
[Material] -> ShowS
Material -> String
(Int -> Material -> ShowS)
-> (Material -> String) -> ([Material] -> ShowS) -> Show Material
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Material -> ShowS
showsPrec :: Int -> Material -> ShowS
$cshow :: Material -> String
show :: Material -> String
$cshowList :: [Material] -> ShowS
showList :: [Material] -> ShowS
Show)

instance Storable Material where
  sizeOf :: Material -> Int
sizeOf Material
_ = Int
40
  alignment :: Material -> Int
alignment Material
_ = Int
8
  peek :: Ptr Material -> IO Material
peek Ptr Material
_p = do
    Shader
shader <- Ptr Material -> Int -> IO Shader
forall b. Ptr b -> Int -> IO Shader
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Material
_p Int
0
    Ptr MaterialMap
mapsPtr <- (Ptr Material -> Int -> IO (Ptr MaterialMap)
forall b. Ptr b -> Int -> IO (Ptr MaterialMap)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Material
_p Int
16 :: IO (Ptr MaterialMap))
    Maybe [MaterialMap]
maps <- Int -> Ptr MaterialMap -> IO (Maybe [MaterialMap])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
12 Ptr MaterialMap
mapsPtr
    [Float]
params <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
4 (Ptr Material -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr Material
_p :: Ptr CFloat) Int
24
    Material -> IO Material
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Material -> IO Material) -> Material -> IO Material
forall a b. (a -> b) -> a -> b
$ Shader -> Maybe [MaterialMap] -> [Float] -> Material
Material Shader
shader Maybe [MaterialMap]
maps [Float]
params
  poke :: Ptr Material -> Material -> IO ()
poke Ptr Material
_p (Material Shader
shader Maybe [MaterialMap]
maps [Float]
params) = do
    Ptr Material -> Int -> Shader -> IO ()
forall b. Ptr b -> Int -> Shader -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Material
_p Int
0 Shader
shader
    Ptr Material -> Int -> Ptr MaterialMap -> IO ()
forall b. Ptr b -> Int -> Ptr MaterialMap -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Material
_p Int
16 (Ptr MaterialMap -> IO ()) -> IO (Ptr MaterialMap) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Maybe [MaterialMap] -> IO (Ptr MaterialMap)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [MaterialMap]
maps
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr Material -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr Material
_p :: Ptr CFloat) Int
24 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
params :: [CFloat])
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Material where
  rlFreeDependents :: Material -> Ptr Material -> IO ()
rlFreeDependents Material
val Ptr Material
ptr = do
    Shader -> Ptr Shader -> IO ()
forall a. Freeable a => a -> Ptr a -> IO ()
rlFreeDependents (Material -> Shader
material'shader Material
val) (Ptr Material -> Ptr Shader
forall a b. Ptr a -> Ptr b
castPtr Ptr Material
ptr :: Ptr Shader)
    Ptr MaterialMap
mapsPtr <- (Ptr Material -> Int -> IO (Ptr MaterialMap)
forall b. Ptr b -> Int -> IO (Ptr MaterialMap)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Material
ptr Int
16 :: IO (Ptr MaterialMap))
    Maybe [MaterialMap] -> Ptr MaterialMap -> IO ()
forall a. (Freeable a, Storable a) => Maybe [a] -> Ptr a -> IO ()
rlFreeMaybeArray (Material -> Maybe [MaterialMap]
material'maps Material
val) Ptr MaterialMap
mapsPtr

data Transform = Transform
  { Transform -> Vector3
transform'translation :: Vector3,
    Transform -> Vector4
transform'rotation :: Quaternion,
    Transform -> Vector3
transform'scale :: Vector3
  }
  deriving (Transform -> Transform -> Bool
(Transform -> Transform -> Bool)
-> (Transform -> Transform -> Bool) -> Eq Transform
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Transform -> Transform -> Bool
== :: Transform -> Transform -> Bool
$c/= :: Transform -> Transform -> Bool
/= :: Transform -> Transform -> Bool
Eq, Int -> Transform -> ShowS
[Transform] -> ShowS
Transform -> String
(Int -> Transform -> ShowS)
-> (Transform -> String)
-> ([Transform] -> ShowS)
-> Show Transform
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Transform -> ShowS
showsPrec :: Int -> Transform -> ShowS
$cshow :: Transform -> String
show :: Transform -> String
$cshowList :: [Transform] -> ShowS
showList :: [Transform] -> ShowS
Show, Transform -> Ptr Transform -> IO ()
(Transform -> Ptr Transform -> IO ())
-> (Transform -> Ptr Transform -> IO ()) -> Freeable Transform
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Transform -> Ptr Transform -> IO ()
rlFreeDependents :: Transform -> Ptr Transform -> IO ()
$crlFree :: Transform -> Ptr Transform -> IO ()
rlFree :: Transform -> Ptr Transform -> IO ()
Freeable)

instance Storable Transform where
  sizeOf :: Transform -> Int
sizeOf Transform
_ = Int
40
  alignment :: Transform -> Int
alignment Transform
_ = Int
4
  peek :: Ptr Transform -> IO Transform
peek Ptr Transform
_p = do
    Vector3
translation <- Ptr Transform -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Transform
_p Int
0
    Vector4
rotation <- Ptr Transform -> Int -> IO Vector4
forall b. Ptr b -> Int -> IO Vector4
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Transform
_p Int
12
    Vector3
scale <- Ptr Transform -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Transform
_p Int
28
    Transform -> IO Transform
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Transform -> IO Transform) -> Transform -> IO Transform
forall a b. (a -> b) -> a -> b
$ Vector3 -> Vector4 -> Vector3 -> Transform
Transform Vector3
translation Vector4
rotation Vector3
scale
  poke :: Ptr Transform -> Transform -> IO ()
poke Ptr Transform
_p (Transform Vector3
translation Vector4
rotation Vector3
scale) = do
    Ptr Transform -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Transform
_p Int
0 Vector3
translation
    Ptr Transform -> Int -> Vector4 -> IO ()
forall b. Ptr b -> Int -> Vector4 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Transform
_p Int
12 Vector4
rotation
    Ptr Transform -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Transform
_p Int
28 Vector3
scale
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data BoneInfo = BoneInfo
  { BoneInfo -> String
boneInfo'name :: String,
    BoneInfo -> Int
boneinfo'parent :: Int
  }
  deriving (BoneInfo -> BoneInfo -> Bool
(BoneInfo -> BoneInfo -> Bool)
-> (BoneInfo -> BoneInfo -> Bool) -> Eq BoneInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BoneInfo -> BoneInfo -> Bool
== :: BoneInfo -> BoneInfo -> Bool
$c/= :: BoneInfo -> BoneInfo -> Bool
/= :: BoneInfo -> BoneInfo -> Bool
Eq, Int -> BoneInfo -> ShowS
[BoneInfo] -> ShowS
BoneInfo -> String
(Int -> BoneInfo -> ShowS)
-> (BoneInfo -> String) -> ([BoneInfo] -> ShowS) -> Show BoneInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BoneInfo -> ShowS
showsPrec :: Int -> BoneInfo -> ShowS
$cshow :: BoneInfo -> String
show :: BoneInfo -> String
$cshowList :: [BoneInfo] -> ShowS
showList :: [BoneInfo] -> ShowS
Show, BoneInfo -> Ptr BoneInfo -> IO ()
(BoneInfo -> Ptr BoneInfo -> IO ())
-> (BoneInfo -> Ptr BoneInfo -> IO ()) -> Freeable BoneInfo
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: BoneInfo -> Ptr BoneInfo -> IO ()
rlFreeDependents :: BoneInfo -> Ptr BoneInfo -> IO ()
$crlFree :: BoneInfo -> Ptr BoneInfo -> IO ()
rlFree :: BoneInfo -> Ptr BoneInfo -> IO ()
Freeable)

instance Storable BoneInfo where
  sizeOf :: BoneInfo -> Int
sizeOf BoneInfo
_ = Int
36
  alignment :: BoneInfo -> Int
alignment BoneInfo
_ = Int
4
  peek :: Ptr BoneInfo -> IO BoneInfo
peek Ptr BoneInfo
_p = do
    String
name <- (CChar -> Char) -> [CChar] -> String
forall a b. (a -> b) -> [a] -> [b]
map CChar -> Char
castCCharToChar ([CChar] -> String) -> ([CChar] -> [CChar]) -> [CChar] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CChar -> Bool) -> [CChar] -> [CChar]
forall a. (a -> Bool) -> [a] -> [a]
takeWhile (CChar -> CChar -> Bool
forall a. Eq a => a -> a -> Bool
/= CChar
0) ([CChar] -> String) -> IO [CChar] -> IO String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CChar -> IO [CChar]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekStaticArray Int
32 (Ptr BoneInfo -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr Ptr BoneInfo
_p :: Ptr CChar)
    Int
parent <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr BoneInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr BoneInfo
_p Int
32 :: IO CInt)
    BoneInfo -> IO BoneInfo
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (BoneInfo -> IO BoneInfo) -> BoneInfo -> IO BoneInfo
forall a b. (a -> b) -> a -> b
$ String -> Int -> BoneInfo
BoneInfo String
name Int
parent
  poke :: Ptr BoneInfo -> BoneInfo -> IO ()
poke Ptr BoneInfo
_p (BoneInfo String
name Int
parent) = do
    Ptr CChar -> [CChar] -> IO ()
forall a. Storable a => Ptr a -> [a] -> IO ()
pokeStaticArray (Ptr BoneInfo -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr Ptr BoneInfo
_p :: Ptr CChar) (Int -> CChar -> [CChar] -> [CChar]
forall a. Int -> a -> [a] -> [a]
rightPad Int
32 CChar
0 ([CChar] -> [CChar]) -> [CChar] -> [CChar]
forall a b. (a -> b) -> a -> b
$ (Char -> CChar) -> String -> [CChar]
forall a b. (a -> b) -> [a] -> [b]
map Char -> CChar
castCharToCChar String
name)
    Ptr BoneInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr BoneInfo
_p Int
32 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
parent :: CInt)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Model = Model
  { Model -> Matrix
model'transform :: Matrix,
    Model -> [Mesh]
model'meshes :: [Mesh],
    Model -> [Material]
model'materials :: [Material],
    Model -> [Int]
model'meshMaterial :: [Int],
    Model -> Int
model'boneCount :: Int,
    Model -> Maybe [BoneInfo]
model'bones :: Maybe [BoneInfo],
    Model -> Maybe [Transform]
model'bindPose :: Maybe [Transform]
  }
  deriving (Model -> Model -> Bool
(Model -> Model -> Bool) -> (Model -> Model -> Bool) -> Eq Model
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Model -> Model -> Bool
== :: Model -> Model -> Bool
$c/= :: Model -> Model -> Bool
/= :: Model -> Model -> Bool
Eq, Int -> Model -> ShowS
[Model] -> ShowS
Model -> String
(Int -> Model -> ShowS)
-> (Model -> String) -> ([Model] -> ShowS) -> Show Model
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Model -> ShowS
showsPrec :: Int -> Model -> ShowS
$cshow :: Model -> String
show :: Model -> String
$cshowList :: [Model] -> ShowS
showList :: [Model] -> ShowS
Show)

instance Storable Model where
  sizeOf :: Model -> Int
sizeOf Model
_ = Int
120
  alignment :: Model -> Int
alignment Model
_ = Int
4
  peek :: Ptr Model -> IO Model
peek Ptr Model
_p = do
    Matrix
transform <- Ptr Model -> Int -> IO Matrix
forall b. Ptr b -> Int -> IO Matrix
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
0
    Int
meshCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Model -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
64 :: IO CInt)
    Int
materialCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Model -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
68 :: IO CInt)
    Ptr Mesh
meshesPtr <- (Ptr Model -> Int -> IO (Ptr Mesh)
forall b. Ptr b -> Int -> IO (Ptr Mesh)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
72 :: IO (Ptr Mesh))
    [Mesh]
meshes <- Int -> Ptr Mesh -> IO [Mesh]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
meshCount Ptr Mesh
meshesPtr
    Ptr Material
materialsPtr <- (Ptr Model -> Int -> IO (Ptr Material)
forall b. Ptr b -> Int -> IO (Ptr Material)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
80 :: IO (Ptr Material))
    [Material]
materials <- Int -> Ptr Material -> IO [Material]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
materialCount Ptr Material
materialsPtr
    Ptr CInt
meshMaterialPtr <- (Ptr Model -> Int -> IO (Ptr CInt)
forall b. Ptr b -> Int -> IO (Ptr CInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
88 :: IO (Ptr CInt))
    [Int]
meshMaterial <- (CInt -> Int) -> [CInt] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CInt] -> [Int]) -> IO [CInt] -> IO [Int]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
meshCount Ptr CInt
meshMaterialPtr
    Int
boneCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Model -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
96 :: IO CInt)
    Ptr BoneInfo
bonesPtr <- (Ptr Model -> Int -> IO (Ptr BoneInfo)
forall b. Ptr b -> Int -> IO (Ptr BoneInfo)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
104 :: IO (Ptr BoneInfo))
    Maybe [BoneInfo]
bones <- Int -> Ptr BoneInfo -> IO (Maybe [BoneInfo])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
boneCount Ptr BoneInfo
bonesPtr
    Ptr Transform
bindPosePtr <- (Ptr Model -> Int -> IO (Ptr Transform)
forall b. Ptr b -> Int -> IO (Ptr Transform)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
_p Int
112 :: IO (Ptr Transform))
    Maybe [Transform]
bindPose <- Int -> Ptr Transform -> IO (Maybe [Transform])
forall a. Storable a => Int -> Ptr a -> IO (Maybe [a])
peekMaybeArray Int
boneCount Ptr Transform
bindPosePtr
    Model -> IO Model
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Model -> IO Model) -> Model -> IO Model
forall a b. (a -> b) -> a -> b
$ Matrix
-> [Mesh]
-> [Material]
-> [Int]
-> Int
-> Maybe [BoneInfo]
-> Maybe [Transform]
-> Model
Model Matrix
transform [Mesh]
meshes [Material]
materials [Int]
meshMaterial Int
boneCount Maybe [BoneInfo]
bones Maybe [Transform]
bindPose
  poke :: Ptr Model -> Model -> IO ()
poke Ptr Model
_p (Model Matrix
transform [Mesh]
meshes [Material]
materials [Int]
meshMaterial Int
boneCount Maybe [BoneInfo]
bones Maybe [Transform]
bindPose) = do
    Ptr Model -> Int -> Matrix -> IO ()
forall b. Ptr b -> Int -> Matrix -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
0 Matrix
transform
    Ptr Model -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
64 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ [Mesh] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Mesh]
meshes :: CInt)
    Ptr Model -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
68 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ [Material] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Material]
materials :: CInt)
    Ptr Model -> Int -> Ptr Mesh -> IO ()
forall b. Ptr b -> Int -> Ptr Mesh -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
72 (Ptr Mesh -> IO ()) -> IO (Ptr Mesh) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Mesh] -> IO (Ptr Mesh)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Mesh]
meshes
    Ptr Model -> Int -> Ptr Material -> IO ()
forall b. Ptr b -> Int -> Ptr Material -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
80 (Ptr Material -> IO ()) -> IO (Ptr Material) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Material] -> IO (Ptr Material)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Material]
materials
    Ptr Model -> Int -> Ptr CInt -> IO ()
forall b. Ptr b -> Int -> Ptr CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
88 (Ptr CInt -> IO ()) -> IO (Ptr CInt) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [CInt] -> IO (Ptr CInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
meshMaterial :: [CInt])
    Ptr Model -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
96 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
boneCount :: CInt)
    Maybe [BoneInfo] -> IO (Ptr BoneInfo)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [BoneInfo]
bones IO (Ptr BoneInfo) -> (Ptr BoneInfo -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Model -> Int -> Ptr BoneInfo -> IO ()
forall b. Ptr b -> Int -> Ptr BoneInfo -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
104
    Maybe [Transform] -> IO (Ptr Transform)
forall a. Storable a => Maybe [a] -> IO (Ptr a)
newMaybeArray Maybe [Transform]
bindPose IO (Ptr Transform) -> (Ptr Transform -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Model -> Int -> Ptr Transform -> IO ()
forall b. Ptr b -> Int -> Ptr Transform -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Model
_p Int
112
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Model where
  rlFreeDependents :: Model -> Ptr Model -> IO ()
rlFreeDependents Model
val Ptr Model
ptr = do
    Ptr Mesh
meshesPtr <- (Ptr Model -> Int -> IO (Ptr Mesh)
forall b. Ptr b -> Int -> IO (Ptr Mesh)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
ptr Int
72 :: IO (Ptr Mesh))
    [Mesh] -> Ptr Mesh -> IO ()
forall a. (Freeable a, Storable a) => [a] -> Ptr a -> IO ()
rlFreeArray (Model -> [Mesh]
model'meshes Model
val) Ptr Mesh
meshesPtr
    Ptr Material
materialsPtr <- (Ptr Model -> Int -> IO (Ptr Material)
forall b. Ptr b -> Int -> IO (Ptr Material)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
ptr Int
80 :: IO (Ptr Material))
    [Material] -> Ptr Material -> IO ()
forall a. (Freeable a, Storable a) => [a] -> Ptr a -> IO ()
rlFreeArray (Model -> [Material]
model'materials Model
val) Ptr Material
materialsPtr
    Ptr CInt
meshMaterialPtr <- (Ptr Model -> Int -> IO (Ptr CInt)
forall b. Ptr b -> Int -> IO (Ptr CInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
ptr Int
88 :: IO (Ptr CInt))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CInt
meshMaterialPtr
    Ptr BoneInfo
bonesPtr <- (Ptr Model -> Int -> IO (Ptr BoneInfo)
forall b. Ptr b -> Int -> IO (Ptr BoneInfo)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
ptr Int
104 :: IO (Ptr BoneInfo))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr BoneInfo -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr BoneInfo
bonesPtr
    Ptr Transform
bindPosePtr <- (Ptr Model -> Int -> IO (Ptr Transform)
forall b. Ptr b -> Int -> IO (Ptr Transform)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Model
ptr Int
112 :: IO (Ptr Transform))
    Ptr () -> IO ()
freeMaybePtr (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Transform -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Transform
bindPosePtr

data ModelAnimation = ModelAnimation
  { ModelAnimation -> Int
modelAnimation'boneCount :: Int,
    ModelAnimation -> Int
modelAnimation'frameCount :: Int,
    ModelAnimation -> [BoneInfo]
modelAnimation'bones :: [BoneInfo],
    ModelAnimation -> [[Transform]]
modelAnimation'framePoses :: [[Transform]],
    ModelAnimation -> String
modelAnimation'name :: String
  }
  deriving (ModelAnimation -> ModelAnimation -> Bool
(ModelAnimation -> ModelAnimation -> Bool)
-> (ModelAnimation -> ModelAnimation -> Bool) -> Eq ModelAnimation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ModelAnimation -> ModelAnimation -> Bool
== :: ModelAnimation -> ModelAnimation -> Bool
$c/= :: ModelAnimation -> ModelAnimation -> Bool
/= :: ModelAnimation -> ModelAnimation -> Bool
Eq, Int -> ModelAnimation -> ShowS
[ModelAnimation] -> ShowS
ModelAnimation -> String
(Int -> ModelAnimation -> ShowS)
-> (ModelAnimation -> String)
-> ([ModelAnimation] -> ShowS)
-> Show ModelAnimation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ModelAnimation -> ShowS
showsPrec :: Int -> ModelAnimation -> ShowS
$cshow :: ModelAnimation -> String
show :: ModelAnimation -> String
$cshowList :: [ModelAnimation] -> ShowS
showList :: [ModelAnimation] -> ShowS
Show)

instance Storable ModelAnimation where
  sizeOf :: ModelAnimation -> Int
sizeOf ModelAnimation
_ = Int
56
  alignment :: ModelAnimation -> Int
alignment ModelAnimation
_ = Int
4
  peek :: Ptr ModelAnimation -> IO ModelAnimation
peek Ptr ModelAnimation
_p = do
    Int
boneCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr ModelAnimation -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr ModelAnimation
_p Int
0 :: IO CInt)
    Int
frameCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr ModelAnimation -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr ModelAnimation
_p Int
4 :: IO CInt)
    Ptr BoneInfo
bonesPtr <- (Ptr ModelAnimation -> Int -> IO (Ptr BoneInfo)
forall b. Ptr b -> Int -> IO (Ptr BoneInfo)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr ModelAnimation
_p Int
8 :: IO (Ptr BoneInfo))
    [BoneInfo]
bones <- Int -> Ptr BoneInfo -> IO [BoneInfo]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
boneCount Ptr BoneInfo
bonesPtr
    Ptr (Ptr Transform)
framePosesPtr <- (Ptr ModelAnimation -> Int -> IO (Ptr (Ptr Transform))
forall b. Ptr b -> Int -> IO (Ptr (Ptr Transform))
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr ModelAnimation
_p Int
16 :: IO (Ptr (Ptr Transform)))
    [Ptr Transform]
framePosesPtrArr <- Int -> Ptr (Ptr Transform) -> IO [Ptr Transform]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
frameCount Ptr (Ptr Transform)
framePosesPtr
    [[Transform]]
framePoses <- (Ptr Transform -> IO [Transform])
-> [Ptr Transform] -> IO [[Transform]]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM (Int -> Ptr Transform -> IO [Transform]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
boneCount) [Ptr Transform]
framePosesPtrArr
    String
name <- (CChar -> Char) -> [CChar] -> String
forall a b. (a -> b) -> [a] -> [b]
map CChar -> Char
castCCharToChar ([CChar] -> String) -> IO [CChar] -> IO String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CChar -> Int -> IO [CChar]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
32 (Ptr ModelAnimation -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr Ptr ModelAnimation
_p) Int
24
    ModelAnimation -> IO ModelAnimation
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ModelAnimation -> IO ModelAnimation)
-> ModelAnimation -> IO ModelAnimation
forall a b. (a -> b) -> a -> b
$ Int
-> Int -> [BoneInfo] -> [[Transform]] -> String -> ModelAnimation
ModelAnimation Int
boneCount Int
frameCount [BoneInfo]
bones [[Transform]]
framePoses String
name
  poke :: Ptr ModelAnimation -> ModelAnimation -> IO ()
poke Ptr ModelAnimation
_p (ModelAnimation Int
boneCount Int
frameCount [BoneInfo]
bones [[Transform]]
framePoses String
name) = do
    Ptr ModelAnimation -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr ModelAnimation
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
boneCount :: CInt)
    Ptr ModelAnimation -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr ModelAnimation
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
frameCount :: CInt)
    Ptr ModelAnimation -> Int -> Ptr BoneInfo -> IO ()
forall b. Ptr b -> Int -> Ptr BoneInfo -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr ModelAnimation
_p Int
8 (Ptr BoneInfo -> IO ()) -> IO (Ptr BoneInfo) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [BoneInfo] -> IO (Ptr BoneInfo)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [BoneInfo]
bones
    ([Transform] -> IO (Ptr Transform))
-> [[Transform]] -> IO [Ptr Transform]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM [Transform] -> IO (Ptr Transform)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [[Transform]]
framePoses IO [Ptr Transform]
-> ([Ptr Transform] -> IO (Ptr (Ptr Transform)))
-> IO (Ptr (Ptr Transform))
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [Ptr Transform] -> IO (Ptr (Ptr Transform))
forall a. Storable a => [a] -> IO (Ptr a)
newArray IO (Ptr (Ptr Transform)) -> (Ptr (Ptr Transform) -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr ModelAnimation -> Int -> Ptr (Ptr Transform) -> IO ()
forall b. Ptr b -> Int -> Ptr (Ptr Transform) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr ModelAnimation
_p Int
16
    Ptr CChar -> Int -> [CChar] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr ModelAnimation -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr Ptr ModelAnimation
_p) Int
24 ((Char -> CChar) -> String -> [CChar]
forall a b. (a -> b) -> [a] -> [b]
map Char -> CChar
castCharToCChar String
name)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable ModelAnimation where
  rlFreeDependents :: ModelAnimation -> Ptr ModelAnimation -> IO ()
rlFreeDependents ModelAnimation
val Ptr ModelAnimation
ptr = do
    Ptr BoneInfo
bonesPtr <- (Ptr ModelAnimation -> Int -> IO (Ptr BoneInfo)
forall b. Ptr b -> Int -> IO (Ptr BoneInfo)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr ModelAnimation
ptr Int
8 :: IO (Ptr BoneInfo))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr BoneInfo -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr BoneInfo
bonesPtr
    Ptr (Ptr Transform)
framePosesPtr <- (Ptr ModelAnimation -> Int -> IO (Ptr (Ptr Transform))
forall b. Ptr b -> Int -> IO (Ptr (Ptr Transform))
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr ModelAnimation
ptr Int
16 :: IO (Ptr (Ptr Transform)))
    [Ptr Transform]
framePosesPtrArr <- Int -> Ptr (Ptr Transform) -> IO [Ptr Transform]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray (ModelAnimation -> Int
modelAnimation'frameCount ModelAnimation
val) Ptr (Ptr Transform)
framePosesPtr
    [Ptr Transform] -> (Ptr Transform -> IO ()) -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [Ptr Transform]
framePosesPtrArr (Ptr () -> IO ()
c'free (Ptr () -> IO ())
-> (Ptr Transform -> Ptr ()) -> Ptr Transform -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Transform -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr)
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr Transform) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr (Ptr Transform)
framePosesPtr

data Ray = Ray
  { Ray -> Vector3
ray'position :: Vector3,
    Ray -> Vector3
ray'direction :: Vector3
  }
  deriving (Ray -> Ray -> Bool
(Ray -> Ray -> Bool) -> (Ray -> Ray -> Bool) -> Eq Ray
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Ray -> Ray -> Bool
== :: Ray -> Ray -> Bool
$c/= :: Ray -> Ray -> Bool
/= :: Ray -> Ray -> Bool
Eq, Int -> Ray -> ShowS
[Ray] -> ShowS
Ray -> String
(Int -> Ray -> ShowS)
-> (Ray -> String) -> ([Ray] -> ShowS) -> Show Ray
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Ray -> ShowS
showsPrec :: Int -> Ray -> ShowS
$cshow :: Ray -> String
show :: Ray -> String
$cshowList :: [Ray] -> ShowS
showList :: [Ray] -> ShowS
Show, Ray -> Ptr Ray -> IO ()
(Ray -> Ptr Ray -> IO ())
-> (Ray -> Ptr Ray -> IO ()) -> Freeable Ray
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Ray -> Ptr Ray -> IO ()
rlFreeDependents :: Ray -> Ptr Ray -> IO ()
$crlFree :: Ray -> Ptr Ray -> IO ()
rlFree :: Ray -> Ptr Ray -> IO ()
Freeable)

instance Storable Ray where
  sizeOf :: Ray -> Int
sizeOf Ray
_ = Int
24
  alignment :: Ray -> Int
alignment Ray
_ = Int
4
  peek :: Ptr Ray -> IO Ray
peek Ptr Ray
_p = do
    Vector3
position <- Ptr Ray -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Ray
_p Int
0
    Vector3
direction <- Ptr Ray -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Ray
_p Int
12
    Ray -> IO Ray
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ray -> IO Ray) -> Ray -> IO Ray
forall a b. (a -> b) -> a -> b
$ Vector3 -> Vector3 -> Ray
Ray Vector3
position Vector3
direction
  poke :: Ptr Ray -> Ray -> IO ()
poke Ptr Ray
_p (Ray Vector3
position Vector3
direction) = do
    Ptr Ray -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Ray
_p Int
0 Vector3
position
    Ptr Ray -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Ray
_p Int
12 Vector3
direction
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data RayCollision = RayCollision
  { RayCollision -> Bool
rayCollision'hit :: Bool,
    RayCollision -> Float
rayCollision'distance :: Float,
    RayCollision -> Vector3
rayCollision'point :: Vector3,
    RayCollision -> Vector3
rayCollision'normal :: Vector3
  }
  deriving (RayCollision -> RayCollision -> Bool
(RayCollision -> RayCollision -> Bool)
-> (RayCollision -> RayCollision -> Bool) -> Eq RayCollision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RayCollision -> RayCollision -> Bool
== :: RayCollision -> RayCollision -> Bool
$c/= :: RayCollision -> RayCollision -> Bool
/= :: RayCollision -> RayCollision -> Bool
Eq, Int -> RayCollision -> ShowS
[RayCollision] -> ShowS
RayCollision -> String
(Int -> RayCollision -> ShowS)
-> (RayCollision -> String)
-> ([RayCollision] -> ShowS)
-> Show RayCollision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RayCollision -> ShowS
showsPrec :: Int -> RayCollision -> ShowS
$cshow :: RayCollision -> String
show :: RayCollision -> String
$cshowList :: [RayCollision] -> ShowS
showList :: [RayCollision] -> ShowS
Show, RayCollision -> Ptr RayCollision -> IO ()
(RayCollision -> Ptr RayCollision -> IO ())
-> (RayCollision -> Ptr RayCollision -> IO ())
-> Freeable RayCollision
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: RayCollision -> Ptr RayCollision -> IO ()
rlFreeDependents :: RayCollision -> Ptr RayCollision -> IO ()
$crlFree :: RayCollision -> Ptr RayCollision -> IO ()
rlFree :: RayCollision -> Ptr RayCollision -> IO ()
Freeable)

instance Storable RayCollision where
  sizeOf :: RayCollision -> Int
sizeOf RayCollision
_ = Int
32
  alignment :: RayCollision -> Int
alignment RayCollision
_ = Int
4
  peek :: Ptr RayCollision -> IO RayCollision
peek Ptr RayCollision
_p = do
    Bool
hit <- CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RayCollision -> Int -> IO CBool
forall b. Ptr b -> Int -> IO CBool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RayCollision
_p Int
0 :: IO CBool)
    Float
distance <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RayCollision -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RayCollision
_p Int
4 :: IO CFloat)
    Vector3
point <- Ptr RayCollision -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RayCollision
_p Int
8
    Vector3
normal <- Ptr RayCollision -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RayCollision
_p Int
20
    RayCollision -> IO RayCollision
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RayCollision -> IO RayCollision)
-> RayCollision -> IO RayCollision
forall a b. (a -> b) -> a -> b
$ Bool -> Float -> Vector3 -> Vector3 -> RayCollision
RayCollision Bool
hit Float
distance Vector3
point Vector3
normal
  poke :: Ptr RayCollision -> RayCollision -> IO ()
poke Ptr RayCollision
_p (RayCollision Bool
hit Float
distance Vector3
point Vector3
normal) = do
    Ptr RayCollision -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RayCollision
_p Int
0 (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
hit :: CInt)
    Ptr RayCollision -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RayCollision
_p Int
4 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
distance :: CFloat)
    Ptr RayCollision -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RayCollision
_p Int
8 Vector3
point
    Ptr RayCollision -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RayCollision
_p Int
20 Vector3
normal
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data BoundingBox = BoundingBox
  { BoundingBox -> Vector3
boundingBox'min :: Vector3,
    BoundingBox -> Vector3
boundingBox'max :: Vector3
  }
  deriving (BoundingBox -> BoundingBox -> Bool
(BoundingBox -> BoundingBox -> Bool)
-> (BoundingBox -> BoundingBox -> Bool) -> Eq BoundingBox
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BoundingBox -> BoundingBox -> Bool
== :: BoundingBox -> BoundingBox -> Bool
$c/= :: BoundingBox -> BoundingBox -> Bool
/= :: BoundingBox -> BoundingBox -> Bool
Eq, Int -> BoundingBox -> ShowS
[BoundingBox] -> ShowS
BoundingBox -> String
(Int -> BoundingBox -> ShowS)
-> (BoundingBox -> String)
-> ([BoundingBox] -> ShowS)
-> Show BoundingBox
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BoundingBox -> ShowS
showsPrec :: Int -> BoundingBox -> ShowS
$cshow :: BoundingBox -> String
show :: BoundingBox -> String
$cshowList :: [BoundingBox] -> ShowS
showList :: [BoundingBox] -> ShowS
Show, BoundingBox -> Ptr BoundingBox -> IO ()
(BoundingBox -> Ptr BoundingBox -> IO ())
-> (BoundingBox -> Ptr BoundingBox -> IO ())
-> Freeable BoundingBox
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: BoundingBox -> Ptr BoundingBox -> IO ()
rlFreeDependents :: BoundingBox -> Ptr BoundingBox -> IO ()
$crlFree :: BoundingBox -> Ptr BoundingBox -> IO ()
rlFree :: BoundingBox -> Ptr BoundingBox -> IO ()
Freeable)

instance Storable BoundingBox where
  sizeOf :: BoundingBox -> Int
sizeOf BoundingBox
_ = Int
24
  alignment :: BoundingBox -> Int
alignment BoundingBox
_ = Int
4
  peek :: Ptr BoundingBox -> IO BoundingBox
peek Ptr BoundingBox
_p = do
    Vector3
bMin <- Ptr BoundingBox -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr BoundingBox
_p Int
0
    Vector3
bMax <- Ptr BoundingBox -> Int -> IO Vector3
forall b. Ptr b -> Int -> IO Vector3
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr BoundingBox
_p Int
12
    BoundingBox -> IO BoundingBox
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (BoundingBox -> IO BoundingBox) -> BoundingBox -> IO BoundingBox
forall a b. (a -> b) -> a -> b
$ Vector3 -> Vector3 -> BoundingBox
BoundingBox Vector3
bMin Vector3
bMax
  poke :: Ptr BoundingBox -> BoundingBox -> IO ()
poke Ptr BoundingBox
_p (BoundingBox Vector3
bMin Vector3
bMax) = do
    Ptr BoundingBox -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr BoundingBox
_p Int
0 Vector3
bMin
    Ptr BoundingBox -> Int -> Vector3 -> IO ()
forall b. Ptr b -> Int -> Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr BoundingBox
_p Int
12 Vector3
bMax
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Wave = Wave
  { Wave -> Integer
wave'frameCount :: Integer,
    Wave -> Integer
wave'sampleRate :: Integer,
    Wave -> Integer
wave'sampleSize :: Integer,
    Wave -> Integer
wave'channels :: Integer,
    Wave -> [Int]
wave'data :: [Int]
  }
  deriving (Wave -> Wave -> Bool
(Wave -> Wave -> Bool) -> (Wave -> Wave -> Bool) -> Eq Wave
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Wave -> Wave -> Bool
== :: Wave -> Wave -> Bool
$c/= :: Wave -> Wave -> Bool
/= :: Wave -> Wave -> Bool
Eq, Int -> Wave -> ShowS
[Wave] -> ShowS
Wave -> String
(Int -> Wave -> ShowS)
-> (Wave -> String) -> ([Wave] -> ShowS) -> Show Wave
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Wave -> ShowS
showsPrec :: Int -> Wave -> ShowS
$cshow :: Wave -> String
show :: Wave -> String
$cshowList :: [Wave] -> ShowS
showList :: [Wave] -> ShowS
Show)

instance Storable Wave where
  sizeOf :: Wave -> Int
sizeOf Wave
_ = Int
24
  alignment :: Wave -> Int
alignment Wave
_ = Int
4
  peek :: Ptr Wave -> IO Wave
peek Ptr Wave
_p = do
    Integer
frameCount <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Wave -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Wave
_p Int
0 :: IO CUInt)
    Integer
sampleRate <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Wave -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Wave
_p Int
4 :: IO CUInt)
    Integer
sampleSize <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Wave -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Wave
_p Int
8 :: IO CUInt)
    Integer
channels <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Wave -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Wave
_p Int
12 :: IO CUInt)
    Ptr CShort
wDataPtr <- (Ptr Wave -> Int -> IO (Ptr CShort)
forall b. Ptr b -> Int -> IO (Ptr CShort)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Wave
_p Int
16 :: IO (Ptr CShort))
    [Int]
wData <- (CShort -> Int) -> [CShort] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map CShort -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CShort] -> [Int]) -> IO [CShort] -> IO [Int]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CShort -> IO [CShort]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray (Integer -> Int
forall a. Num a => Integer -> a
fromInteger (Integer -> Int) -> Integer -> Int
forall a b. (a -> b) -> a -> b
$ Integer
frameCount Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
* Integer
channels) Ptr CShort
wDataPtr
    Wave -> IO Wave
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Wave -> IO Wave) -> Wave -> IO Wave
forall a b. (a -> b) -> a -> b
$ Integer -> Integer -> Integer -> Integer -> [Int] -> Wave
Wave Integer
frameCount Integer
sampleRate Integer
sampleSize Integer
channels [Int]
wData
  poke :: Ptr Wave -> Wave -> IO ()
poke Ptr Wave
_p (Wave Integer
frameCount Integer
sampleRate Integer
sampleSize Integer
channels [Int]
wData) = do
    Ptr Wave -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Wave
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
frameCount :: CUInt)
    Ptr Wave -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Wave
_p Int
4 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
sampleRate :: CUInt)
    Ptr Wave -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Wave
_p Int
8 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
sampleSize :: CUInt)
    Ptr Wave -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Wave
_p Int
12 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
channels :: CUInt)
    Ptr Wave -> Int -> Ptr CShort -> IO ()
forall b. Ptr b -> Int -> Ptr CShort -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Wave
_p Int
16 (Ptr CShort -> IO ()) -> IO (Ptr CShort) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [CShort] -> IO (Ptr CShort)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Int -> CShort) -> [Int] -> [CShort]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CShort
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
wData :: [CShort])
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable Wave where
  rlFreeDependents :: Wave -> Ptr Wave -> IO ()
rlFreeDependents Wave
_ Ptr Wave
ptr = do
    Ptr CShort
dataPtr <- Ptr Wave -> Int -> IO (Ptr CShort)
forall b. Ptr b -> Int -> IO (Ptr CShort)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Wave
ptr Int
16 :: IO (Ptr CShort)
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CShort -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CShort
dataPtr

-- RAudioBuffer/Processor don't work perfectly right now, I need to fix them later on.

-- They are currently used as `Ptr`s because peeking/poking them every time

-- an audio function is called doesn't work properly (they are stored in a

-- linked list in C, which makes it very difficult to properly marshal them)

data RAudioBuffer = RAudioBuffer
  { RAudioBuffer -> [Int]
rAudioBuffer'converter :: [Int], -- Implemented as an array of 39 integers because binding the entire `ma_data_converter` type is too painful

    RAudioBuffer -> AudioCallback
rAudioBuffer'callback :: AudioCallback,
    RAudioBuffer -> Maybe RAudioProcessor
rAudioBuffer'processor :: Maybe RAudioProcessor,
    RAudioBuffer -> Float
rAudioBuffer'volume :: Float,
    RAudioBuffer -> Float
rAudioBuffer'pitch :: Float,
    RAudioBuffer -> Float
rAudioBuffer'pan :: Float,
    RAudioBuffer -> Bool
rAudioBuffer'playing :: Bool,
    RAudioBuffer -> Bool
rAudioBuffer'paused :: Bool,
    RAudioBuffer -> Bool
rAudioBuffer'looping :: Bool,
    RAudioBuffer -> Int
rAudioBuffer'usage :: Int,
    RAudioBuffer -> [Bool]
rAudioBuffer'isSubBufferProcessed :: [Bool],
    RAudioBuffer -> Integer
rAudioBuffer'sizeInFrames :: Integer,
    RAudioBuffer -> Integer
rAudioBuffer'frameCursorPos :: Integer,
    RAudioBuffer -> Integer
rAudioBuffer'framesProcessed :: Integer,
    RAudioBuffer -> [Word8]
rAudioBuffer'data :: [Word8],
    RAudioBuffer -> Maybe RAudioBuffer
rAudioBuffer'next :: Maybe RAudioBuffer,
    RAudioBuffer -> Maybe RAudioBuffer
rAudioBuffer'prev :: Maybe RAudioBuffer
  }
  deriving (RAudioBuffer -> RAudioBuffer -> Bool
(RAudioBuffer -> RAudioBuffer -> Bool)
-> (RAudioBuffer -> RAudioBuffer -> Bool) -> Eq RAudioBuffer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RAudioBuffer -> RAudioBuffer -> Bool
== :: RAudioBuffer -> RAudioBuffer -> Bool
$c/= :: RAudioBuffer -> RAudioBuffer -> Bool
/= :: RAudioBuffer -> RAudioBuffer -> Bool
Eq, Int -> RAudioBuffer -> ShowS
[RAudioBuffer] -> ShowS
RAudioBuffer -> String
(Int -> RAudioBuffer -> ShowS)
-> (RAudioBuffer -> String)
-> ([RAudioBuffer] -> ShowS)
-> Show RAudioBuffer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RAudioBuffer -> ShowS
showsPrec :: Int -> RAudioBuffer -> ShowS
$cshow :: RAudioBuffer -> String
show :: RAudioBuffer -> String
$cshowList :: [RAudioBuffer] -> ShowS
showList :: [RAudioBuffer] -> ShowS
Show, RAudioBuffer -> Ptr RAudioBuffer -> IO ()
(RAudioBuffer -> Ptr RAudioBuffer -> IO ())
-> (RAudioBuffer -> Ptr RAudioBuffer -> IO ())
-> Freeable RAudioBuffer
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: RAudioBuffer -> Ptr RAudioBuffer -> IO ()
rlFreeDependents :: RAudioBuffer -> Ptr RAudioBuffer -> IO ()
$crlFree :: RAudioBuffer -> Ptr RAudioBuffer -> IO ()
rlFree :: RAudioBuffer -> Ptr RAudioBuffer -> IO ()
Freeable)

instance Storable RAudioBuffer where
  sizeOf :: RAudioBuffer -> Int
sizeOf RAudioBuffer
_ = Int
392
  alignment :: RAudioBuffer -> Int
alignment RAudioBuffer
_ = Int
8
  peek :: Ptr RAudioBuffer -> IO RAudioBuffer
peek Ptr RAudioBuffer
_p = do
    Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer
base <- Ptr RAudioBuffer
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
forall {b}.
Ptr b
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
loadBase Ptr RAudioBuffer
_p
    Ptr Any
nextPtr <- Ptr RAudioBuffer -> Int -> IO (Ptr Any)
forall b. Ptr b -> Int -> IO (Ptr Any)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RAudioBuffer
_p Int
376
    Maybe RAudioBuffer
next <- Ptr Any -> IO (Maybe RAudioBuffer)
forall {b}. Ptr b -> IO (Maybe RAudioBuffer)
loadNext Ptr Any
nextPtr
    Ptr Any
prevPtr <- Ptr RAudioBuffer -> Int -> IO (Ptr Any)
forall b. Ptr b -> Int -> IO (Ptr Any)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RAudioBuffer
_p Int
384
    Maybe RAudioBuffer
prev <- Ptr Any -> IO (Maybe RAudioBuffer)
forall {b}. Ptr b -> IO (Maybe RAudioBuffer)
loadPrev Ptr Any
prevPtr
    RAudioBuffer -> IO RAudioBuffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RAudioBuffer -> IO RAudioBuffer)
-> RAudioBuffer -> IO RAudioBuffer
forall a b. (a -> b) -> a -> b
$
      let p :: RAudioBuffer
p =
            Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer
base
              ((\RAudioBuffer
a -> RAudioBuffer
a {rAudioBuffer'prev = Just p}) (RAudioBuffer -> RAudioBuffer)
-> Maybe RAudioBuffer -> Maybe RAudioBuffer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioBuffer
next)
              ((\RAudioBuffer
a -> RAudioBuffer
a {rAudioBuffer'next = Just p}) (RAudioBuffer -> RAudioBuffer)
-> Maybe RAudioBuffer -> Maybe RAudioBuffer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioBuffer
prev)
       in RAudioBuffer
p
    where
      getBytesPerSample :: Int -> Integer
getBytesPerSample = ([Integer
0, Integer
1, Integer
2, Integer
3, Integer
4, Integer
4] [Integer] -> Int -> Integer
forall a. HasCallStack => [a] -> Int -> a
!!)
      loadBase :: Ptr b
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
loadBase Ptr b
ptr = do
        [Int]
converter <- (CInt -> Int) -> [CInt] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CInt] -> [Int]) -> IO [CInt] -> IO [Int]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekStaticArray Int
39 (Ptr b -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr b
ptr) :: IO [CInt])
        AudioCallback
callback <- Ptr b -> Int -> IO AudioCallback
forall b. Ptr b -> Int -> IO AudioCallback
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
312
        Ptr RAudioProcessor
pPtr <- Ptr b -> Int -> IO (Ptr RAudioProcessor)
forall b. Ptr b -> Int -> IO (Ptr RAudioProcessor)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
320 :: IO (Ptr RAudioProcessor)
        Maybe RAudioProcessor
processor <- if Ptr RAudioProcessor
pPtr Ptr RAudioProcessor -> Ptr RAudioProcessor -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr RAudioProcessor
forall a. Ptr a
nullPtr then Maybe RAudioProcessor -> IO (Maybe RAudioProcessor)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RAudioProcessor
forall a. Maybe a
Nothing else RAudioProcessor -> Maybe RAudioProcessor
forall a. a -> Maybe a
Just (RAudioProcessor -> Maybe RAudioProcessor)
-> IO RAudioProcessor -> IO (Maybe RAudioProcessor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr RAudioProcessor -> IO RAudioProcessor
forall a. Storable a => Ptr a -> IO a
peek Ptr RAudioProcessor
pPtr

        Float
volume <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
328 :: IO CFloat)
        Float
pitch <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
332 :: IO CFloat)
        Float
pan <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
336 :: IO CFloat)

        Bool
playing <- CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CBool
forall b. Ptr b -> Int -> IO CBool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
340 :: IO CBool)
        Bool
paused <- CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CBool
forall b. Ptr b -> Int -> IO CBool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
341 :: IO CBool)
        Bool
looping <- CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CBool
forall b. Ptr b -> Int -> IO CBool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
342 :: IO CBool)
        Int
usage <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
344 :: IO CInt)

        [Bool]
isSubBufferProcessed <- (CBool -> Bool) -> [CBool] -> [Bool]
forall a b. (a -> b) -> [a] -> [b]
map CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool ([CBool] -> [Bool]) -> IO [CBool] -> IO [Bool]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CBool -> Int -> IO [CBool]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr b -> Ptr CBool
forall a b. Ptr a -> Ptr b
castPtr Ptr b
ptr :: Ptr CBool) Int
348
        Integer
sizeInFrames <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
352 :: IO CUInt)
        Integer
frameCursorPos <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
356 :: IO CUInt)
        Integer
framesProcessed <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr b -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
360 :: IO CUInt)

        [Word8]
bData <- (CUChar -> Word8) -> [CUChar] -> [Word8]
forall a b. (a -> b) -> [a] -> [b]
map CUChar -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CUChar] -> [Word8]) -> IO [CUChar] -> IO [Word8]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CUChar -> IO [CUChar]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray (Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Int) -> Integer -> Int
forall a b. (a -> b) -> a -> b
$ Integer
sizeInFrames Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
* Integer
2 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
* Int -> Integer
getBytesPerSample ([Int] -> Int
forall a. HasCallStack => [a] -> a
head [Int]
converter)) (Ptr CUChar -> IO [CUChar]) -> IO (Ptr CUChar) -> IO [CUChar]
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (Ptr b -> Int -> IO (Ptr CUChar)
forall b. Ptr b -> Int -> IO (Ptr CUChar)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
368 :: IO (Ptr CUChar)))

        (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
 -> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer))
-> (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
forall a b. (a -> b) -> a -> b
$ [Int]
-> AudioCallback
-> Maybe RAudioProcessor
-> Float
-> Float
-> Float
-> Bool
-> Bool
-> Bool
-> Int
-> [Bool]
-> Integer
-> Integer
-> Integer
-> [Word8]
-> Maybe RAudioBuffer
-> Maybe RAudioBuffer
-> RAudioBuffer
RAudioBuffer [Int]
converter AudioCallback
callback Maybe RAudioProcessor
processor Float
volume Float
pitch Float
pan Bool
playing Bool
paused Bool
looping Int
usage [Bool]
isSubBufferProcessed Integer
sizeInFrames Integer
frameCursorPos Integer
framesProcessed [Word8]
bData
      loadNext :: Ptr b -> IO (Maybe RAudioBuffer)
loadNext Ptr b
ptr =
        if Ptr b
ptr Ptr b -> Ptr b -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr b
forall a. Ptr a
nullPtr
          then Maybe RAudioBuffer -> IO (Maybe RAudioBuffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RAudioBuffer
forall a. Maybe a
Nothing
          else do
            Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer
base <- Ptr b
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
forall {b}.
Ptr b
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
loadBase Ptr b
ptr
            Ptr b
nextPtr <- Ptr b -> Int -> IO (Ptr b)
forall b. Ptr b -> Int -> IO (Ptr b)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
376
            Maybe RAudioBuffer
next <- Ptr b -> IO (Maybe RAudioBuffer)
loadNext Ptr b
nextPtr
            let p :: RAudioBuffer
p = Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer
base ((\RAudioBuffer
a -> RAudioBuffer
a {rAudioBuffer'prev = Just p}) (RAudioBuffer -> RAudioBuffer)
-> Maybe RAudioBuffer -> Maybe RAudioBuffer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioBuffer
next) Maybe RAudioBuffer
forall a. Maybe a
Nothing
             in Maybe RAudioBuffer -> IO (Maybe RAudioBuffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RAudioBuffer -> Maybe RAudioBuffer
forall a. a -> Maybe a
Just RAudioBuffer
p)

      loadPrev :: Ptr b -> IO (Maybe RAudioBuffer)
loadPrev Ptr b
ptr =
        if Ptr b
ptr Ptr b -> Ptr b -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr b
forall a. Ptr a
nullPtr
          then Maybe RAudioBuffer -> IO (Maybe RAudioBuffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RAudioBuffer
forall a. Maybe a
Nothing
          else do
            Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer
base <- Ptr b
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
forall {b}.
Ptr b
-> IO (Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer)
loadBase Ptr b
ptr
            Ptr b
prevPtr <- Ptr b -> Int -> IO (Ptr b)
forall b. Ptr b -> Int -> IO (Ptr b)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
384
            Maybe RAudioBuffer
prev <- Ptr b -> IO (Maybe RAudioBuffer)
loadPrev Ptr b
prevPtr
            let p :: RAudioBuffer
p = Maybe RAudioBuffer -> Maybe RAudioBuffer -> RAudioBuffer
base Maybe RAudioBuffer
forall a. Maybe a
Nothing ((\RAudioBuffer
a -> RAudioBuffer
a {rAudioBuffer'next = Just p}) (RAudioBuffer -> RAudioBuffer)
-> Maybe RAudioBuffer -> Maybe RAudioBuffer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioBuffer
prev)
             in Maybe RAudioBuffer -> IO (Maybe RAudioBuffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RAudioBuffer -> Maybe RAudioBuffer
forall a. a -> Maybe a
Just RAudioBuffer
p)
  poke :: Ptr RAudioBuffer -> RAudioBuffer -> IO ()
poke Ptr RAudioBuffer
_p RAudioBuffer
a = do
    Ptr RAudioBuffer -> RAudioBuffer -> IO ()
forall {b}. Ptr b -> RAudioBuffer -> IO ()
pokeBase Ptr RAudioBuffer
_p RAudioBuffer
a
    Ptr RAudioBuffer -> Maybe RAudioBuffer -> IO ()
forall {b}. Storable b => Ptr b -> Maybe RAudioBuffer -> IO ()
pokeNext Ptr RAudioBuffer
_p (Maybe RAudioBuffer -> IO ()) -> Maybe RAudioBuffer -> IO ()
forall a b. (a -> b) -> a -> b
$ RAudioBuffer -> Maybe RAudioBuffer
rAudioBuffer'next RAudioBuffer
a
    Ptr RAudioBuffer -> Maybe RAudioBuffer -> IO ()
forall {b}. Storable b => Ptr b -> Maybe RAudioBuffer -> IO ()
pokePrev Ptr RAudioBuffer
_p (Maybe RAudioBuffer -> IO ()) -> Maybe RAudioBuffer -> IO ()
forall a b. (a -> b) -> a -> b
$ RAudioBuffer -> Maybe RAudioBuffer
rAudioBuffer'prev RAudioBuffer
a
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
    where
      pokeBase :: Ptr b -> RAudioBuffer -> IO ()
pokeBase Ptr b
ptr (RAudioBuffer [Int]
converter AudioCallback
callback Maybe RAudioProcessor
processor Float
volume Float
pitch Float
pan Bool
playing Bool
paused Bool
looping Int
usage [Bool]
isSubBufferProcessed Integer
sizeInFrames Integer
frameCursorPos Integer
framesProcessed [Word8]
bData Maybe RAudioBuffer
_ Maybe RAudioBuffer
_) = do
        Ptr CInt -> [CInt] -> IO ()
forall a. Storable a => Ptr a -> [a] -> IO ()
pokeStaticArray (Ptr b -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr b
ptr) ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
converter :: [CInt])
        Ptr b -> Int -> AudioCallback -> IO ()
forall b. Ptr b -> Int -> AudioCallback -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
312 AudioCallback
callback
        Ptr (Ptr RAudioProcessor) -> Int -> Maybe RAudioProcessor -> IO ()
forall a. Storable a => Ptr (Ptr a) -> Int -> Maybe a -> IO ()
pokeMaybeOff (Ptr b -> Ptr (Ptr RAudioProcessor)
forall a b. Ptr a -> Ptr b
castPtr Ptr b
ptr) Int
320 Maybe RAudioProcessor
processor

        Ptr b -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
328 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
volume :: CFloat)
        Ptr b -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
332 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
pitch :: CFloat)
        Ptr b -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
336 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
pan :: CFloat)

        Ptr b -> Int -> CBool -> IO ()
forall b. Ptr b -> Int -> CBool -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
340 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
playing :: CBool)
        Ptr b -> Int -> CBool -> IO ()
forall b. Ptr b -> Int -> CBool -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
341 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
paused :: CBool)
        Ptr b -> Int -> CBool -> IO ()
forall b. Ptr b -> Int -> CBool -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
342 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
looping :: CBool)
        Ptr b -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
344 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
usage :: CInt)

        Ptr CBool -> Int -> [CBool] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr b -> Ptr CBool
forall a b. Ptr a -> Ptr b
castPtr Ptr b
ptr) Int
348 ((Bool -> CBool) -> [Bool] -> [CBool]
forall a b. (a -> b) -> [a] -> [b]
map Bool -> CBool
forall a. Num a => Bool -> a
fromBool [Bool]
isSubBufferProcessed :: [CBool])
        Ptr b -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
352 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
sizeInFrames :: CUInt)
        Ptr b -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
356 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
frameCursorPos :: CUInt)
        Ptr b -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
360 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
framesProcessed :: CUInt)

        Ptr b -> Int -> Ptr CUChar -> IO ()
forall b. Ptr b -> Int -> Ptr CUChar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
ptr Int
368 (Ptr CUChar -> IO ()) -> IO (Ptr CUChar) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [CUChar] -> IO (Ptr CUChar)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Word8 -> CUChar) -> [Word8] -> [CUChar]
forall a b. (a -> b) -> [a] -> [b]
map Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Word8]
bData :: [CUChar])

        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
      pokeNext :: Ptr b -> Maybe RAudioBuffer -> IO ()
pokeNext Ptr b
basePtr Maybe RAudioBuffer
pNext =
        case Maybe RAudioBuffer
pNext of
          Maybe RAudioBuffer
Nothing -> Ptr b -> Int -> Ptr Any -> IO ()
forall b. Ptr b -> Int -> Ptr Any -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
basePtr Int
376 Ptr Any
forall a. Ptr a
nullPtr
          Just RAudioBuffer
val -> do
            Ptr b
nextPtr <- IO (Ptr b)
forall a. Storable a => IO (Ptr a)
malloc
            Ptr b -> RAudioBuffer -> IO ()
forall {b}. Ptr b -> RAudioBuffer -> IO ()
pokeBase Ptr b
nextPtr RAudioBuffer
val
            Ptr b -> Maybe RAudioBuffer -> IO ()
pokeNext Ptr b
nextPtr (RAudioBuffer -> Maybe RAudioBuffer
rAudioBuffer'next RAudioBuffer
val)
            Ptr b -> Int -> Ptr b -> IO ()
forall b. Ptr b -> Int -> Ptr b -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
nextPtr Int
384 Ptr b
basePtr
            Ptr b -> Int -> Ptr b -> IO ()
forall b. Ptr b -> Int -> Ptr b -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
basePtr Int
376 Ptr b
nextPtr
      pokePrev :: Ptr b -> Maybe RAudioBuffer -> IO ()
pokePrev Ptr b
basePtr Maybe RAudioBuffer
pPrev =
        case Maybe RAudioBuffer
pPrev of
          Maybe RAudioBuffer
Nothing -> Ptr b -> Int -> Ptr Any -> IO ()
forall b. Ptr b -> Int -> Ptr Any -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
basePtr Int
384 Ptr Any
forall a. Ptr a
nullPtr
          Just RAudioBuffer
val -> do
            Ptr b
prevPtr <- IO (Ptr b)
forall a. Storable a => IO (Ptr a)
malloc
            Ptr b -> RAudioBuffer -> IO ()
forall {b}. Ptr b -> RAudioBuffer -> IO ()
pokeBase Ptr b
prevPtr RAudioBuffer
val
            Ptr b -> Int -> Ptr b -> IO ()
forall b. Ptr b -> Int -> Ptr b -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
prevPtr Int
376 Ptr b
basePtr
            Ptr b -> Maybe RAudioBuffer -> IO ()
pokePrev Ptr b
prevPtr (RAudioBuffer -> Maybe RAudioBuffer
rAudioBuffer'prev RAudioBuffer
val)
            Ptr b -> Int -> Ptr b -> IO ()
forall b. Ptr b -> Int -> Ptr b -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr b
basePtr Int
384 Ptr b
prevPtr

data RAudioProcessor = RAudioProcessor
  { RAudioProcessor -> Maybe AudioCallback
rAudioProcessor'process :: Maybe AudioCallback,
    RAudioProcessor -> Maybe RAudioProcessor
rAudioProcessor'next :: Maybe RAudioProcessor,
    RAudioProcessor -> Maybe RAudioProcessor
rAudioProcessor'prev :: Maybe RAudioProcessor
  }
  deriving (RAudioProcessor -> RAudioProcessor -> Bool
(RAudioProcessor -> RAudioProcessor -> Bool)
-> (RAudioProcessor -> RAudioProcessor -> Bool)
-> Eq RAudioProcessor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RAudioProcessor -> RAudioProcessor -> Bool
== :: RAudioProcessor -> RAudioProcessor -> Bool
$c/= :: RAudioProcessor -> RAudioProcessor -> Bool
/= :: RAudioProcessor -> RAudioProcessor -> Bool
Eq, Int -> RAudioProcessor -> ShowS
[RAudioProcessor] -> ShowS
RAudioProcessor -> String
(Int -> RAudioProcessor -> ShowS)
-> (RAudioProcessor -> String)
-> ([RAudioProcessor] -> ShowS)
-> Show RAudioProcessor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RAudioProcessor -> ShowS
showsPrec :: Int -> RAudioProcessor -> ShowS
$cshow :: RAudioProcessor -> String
show :: RAudioProcessor -> String
$cshowList :: [RAudioProcessor] -> ShowS
showList :: [RAudioProcessor] -> ShowS
Show, RAudioProcessor -> Ptr RAudioProcessor -> IO ()
(RAudioProcessor -> Ptr RAudioProcessor -> IO ())
-> (RAudioProcessor -> Ptr RAudioProcessor -> IO ())
-> Freeable RAudioProcessor
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: RAudioProcessor -> Ptr RAudioProcessor -> IO ()
rlFreeDependents :: RAudioProcessor -> Ptr RAudioProcessor -> IO ()
$crlFree :: RAudioProcessor -> Ptr RAudioProcessor -> IO ()
rlFree :: RAudioProcessor -> Ptr RAudioProcessor -> IO ()
Freeable)

instance Storable RAudioProcessor where
  sizeOf :: RAudioProcessor -> Int
sizeOf RAudioProcessor
_ = Int
24
  alignment :: RAudioProcessor -> Int
alignment RAudioProcessor
_ = Int
8
  peek :: Ptr RAudioProcessor -> IO RAudioProcessor
peek Ptr RAudioProcessor
_p = do
    Maybe AudioCallback
process <- Ptr RAudioProcessor -> IO (Maybe AudioCallback)
forall {b} {a}. Ptr b -> IO (Maybe (FunPtr a))
loadProcess Ptr RAudioProcessor
_p
    Ptr Any
nextPtr <- Ptr RAudioProcessor -> Int -> IO (Ptr Any)
forall b. Ptr b -> Int -> IO (Ptr Any)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RAudioProcessor
_p Int
8
    Maybe RAudioProcessor
next <- Ptr Any -> IO (Maybe RAudioProcessor)
forall {b}. Ptr b -> IO (Maybe RAudioProcessor)
loadNext Ptr Any
nextPtr
    Ptr Any
prevPtr <- Ptr RAudioProcessor -> Int -> IO (Ptr Any)
forall b. Ptr b -> Int -> IO (Ptr Any)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RAudioProcessor
_p Int
16
    Maybe RAudioProcessor
prev <- Ptr Any -> IO (Maybe RAudioProcessor)
forall {b}. Ptr b -> IO (Maybe RAudioProcessor)
loadPrev Ptr Any
prevPtr
    RAudioProcessor -> IO RAudioProcessor
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RAudioProcessor -> IO RAudioProcessor)
-> RAudioProcessor -> IO RAudioProcessor
forall a b. (a -> b) -> a -> b
$ let p :: RAudioProcessor
p = Maybe AudioCallback
-> Maybe RAudioProcessor
-> Maybe RAudioProcessor
-> RAudioProcessor
RAudioProcessor Maybe AudioCallback
process ((\RAudioProcessor
a -> RAudioProcessor
a {rAudioProcessor'prev = Just p}) (RAudioProcessor -> RAudioProcessor)
-> Maybe RAudioProcessor -> Maybe RAudioProcessor
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioProcessor
next) ((\RAudioProcessor
a -> RAudioProcessor
a {rAudioProcessor'next = Just p}) (RAudioProcessor -> RAudioProcessor)
-> Maybe RAudioProcessor -> Maybe RAudioProcessor
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioProcessor
prev) in RAudioProcessor
p
    where
      loadProcess :: Ptr b -> IO (Maybe (FunPtr a))
loadProcess Ptr b
ptr = do
        FunPtr a
funPtr <- Ptr b -> Int -> IO (FunPtr a)
forall b. Ptr b -> Int -> IO (FunPtr a)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
0
        if FunPtr a
funPtr FunPtr a -> FunPtr a -> Bool
forall a. Eq a => a -> a -> Bool
== FunPtr a
forall a. FunPtr a
nullFunPtr then Maybe (FunPtr a) -> IO (Maybe (FunPtr a))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (FunPtr a)
forall a. Maybe a
Nothing else Maybe (FunPtr a) -> IO (Maybe (FunPtr a))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (FunPtr a -> Maybe (FunPtr a)
forall a. a -> Maybe a
Just FunPtr a
funPtr)
      loadNext :: Ptr b -> IO (Maybe RAudioProcessor)
loadNext Ptr b
ptr =
        if Ptr b
ptr Ptr b -> Ptr b -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr b
forall a. Ptr a
nullPtr
          then Maybe RAudioProcessor -> IO (Maybe RAudioProcessor)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RAudioProcessor
forall a. Maybe a
Nothing
          else do
            Maybe AudioCallback
process <- Ptr b -> IO (Maybe AudioCallback)
forall {b} {a}. Ptr b -> IO (Maybe (FunPtr a))
loadProcess Ptr b
ptr
            Ptr b
nextPtr <- Ptr b -> Int -> IO (Ptr b)
forall b. Ptr b -> Int -> IO (Ptr b)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
8
            Maybe RAudioProcessor
next <- Ptr b -> IO (Maybe RAudioProcessor)
loadNext Ptr b
nextPtr
            let p :: RAudioProcessor
p = Maybe AudioCallback
-> Maybe RAudioProcessor
-> Maybe RAudioProcessor
-> RAudioProcessor
RAudioProcessor Maybe AudioCallback
process ((\RAudioProcessor
a -> RAudioProcessor
a {rAudioProcessor'prev = Just p}) (RAudioProcessor -> RAudioProcessor)
-> Maybe RAudioProcessor -> Maybe RAudioProcessor
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioProcessor
next) Maybe RAudioProcessor
forall a. Maybe a
Nothing
             in Maybe RAudioProcessor -> IO (Maybe RAudioProcessor)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RAudioProcessor -> Maybe RAudioProcessor
forall a. a -> Maybe a
Just RAudioProcessor
p)

      loadPrev :: Ptr b -> IO (Maybe RAudioProcessor)
loadPrev Ptr b
ptr =
        if Ptr b
ptr Ptr b -> Ptr b -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr b
forall a. Ptr a
nullPtr
          then Maybe RAudioProcessor -> IO (Maybe RAudioProcessor)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RAudioProcessor
forall a. Maybe a
Nothing
          else do
            Maybe AudioCallback
process <- Ptr b -> IO (Maybe AudioCallback)
forall {b} {a}. Ptr b -> IO (Maybe (FunPtr a))
loadProcess Ptr b
ptr
            Ptr b
prevPtr <- Ptr b -> Int -> IO (Ptr b)
forall b. Ptr b -> Int -> IO (Ptr b)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr b
ptr Int
16
            Maybe RAudioProcessor
prev <- Ptr b -> IO (Maybe RAudioProcessor)
loadPrev Ptr b
prevPtr
            let p :: RAudioProcessor
p = Maybe AudioCallback
-> Maybe RAudioProcessor
-> Maybe RAudioProcessor
-> RAudioProcessor
RAudioProcessor Maybe AudioCallback
process Maybe RAudioProcessor
forall a. Maybe a
Nothing ((\RAudioProcessor
a -> RAudioProcessor
a {rAudioProcessor'next = Just p}) (RAudioProcessor -> RAudioProcessor)
-> Maybe RAudioProcessor -> Maybe RAudioProcessor
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe RAudioProcessor
prev)
             in Maybe RAudioProcessor -> IO (Maybe RAudioProcessor)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RAudioProcessor -> Maybe RAudioProcessor
forall a. a -> Maybe a
Just RAudioProcessor
p)
  poke :: Ptr RAudioProcessor -> RAudioProcessor -> IO ()
poke Ptr RAudioProcessor
_p (RAudioProcessor Maybe AudioCallback
process Maybe RAudioProcessor
next Maybe RAudioProcessor
prev) = do
    Ptr (Ptr AudioCallback) -> Int -> Maybe AudioCallback -> IO ()
forall a. Storable a => Ptr (Ptr a) -> Int -> Maybe a -> IO ()
pokeMaybeOff (Ptr RAudioProcessor -> Ptr (Ptr AudioCallback)
forall a b. Ptr a -> Ptr b
castPtr Ptr RAudioProcessor
_p) Int
0 Maybe AudioCallback
process
    Ptr (Ptr AudioCallback) -> Maybe RAudioProcessor -> IO ()
pokeNext (Ptr RAudioProcessor -> Ptr (Ptr AudioCallback)
forall a b. Ptr a -> Ptr b
castPtr Ptr RAudioProcessor
_p) Maybe RAudioProcessor
next
    Ptr (Ptr AudioCallback) -> Maybe RAudioProcessor -> IO ()
pokePrev (Ptr RAudioProcessor -> Ptr (Ptr AudioCallback)
forall a b. Ptr a -> Ptr b
castPtr Ptr RAudioProcessor
_p) Maybe RAudioProcessor
prev
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
    where
      pokeNext :: Ptr (Ptr AudioCallback) -> Maybe RAudioProcessor -> IO ()
pokeNext Ptr (Ptr AudioCallback)
basePtr Maybe RAudioProcessor
pNext =
        case Maybe RAudioProcessor
pNext of
          Maybe RAudioProcessor
Nothing -> Ptr (Ptr AudioCallback) -> Int -> Ptr Any -> IO ()
forall b. Ptr b -> Int -> Ptr Any -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr (Ptr AudioCallback)
basePtr Int
8 Ptr Any
forall a. Ptr a
nullPtr
          Just RAudioProcessor
val -> do
            Ptr (Ptr AudioCallback)
nextPtr <- IO (Ptr (Ptr AudioCallback))
forall a. Storable a => IO (Ptr a)
malloc
            Ptr (Ptr AudioCallback) -> Int -> Maybe AudioCallback -> IO ()
forall a. Storable a => Ptr (Ptr a) -> Int -> Maybe a -> IO ()
pokeMaybeOff Ptr (Ptr AudioCallback)
nextPtr Int
0 (RAudioProcessor -> Maybe AudioCallback
rAudioProcessor'process RAudioProcessor
val)
            Ptr (Ptr AudioCallback) -> Maybe RAudioProcessor -> IO ()
pokeNext Ptr (Ptr AudioCallback)
nextPtr (RAudioProcessor -> Maybe RAudioProcessor
rAudioProcessor'next RAudioProcessor
val)
            Ptr (Ptr AudioCallback) -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall b. Ptr b -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr (Ptr AudioCallback)
nextPtr Int
16 Ptr (Ptr AudioCallback)
basePtr
            Ptr (Ptr AudioCallback) -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall b. Ptr b -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr (Ptr AudioCallback)
basePtr Int
8 Ptr (Ptr AudioCallback)
nextPtr
      pokePrev :: Ptr (Ptr AudioCallback) -> Maybe RAudioProcessor -> IO ()
pokePrev Ptr (Ptr AudioCallback)
basePtr Maybe RAudioProcessor
pPrev =
        case Maybe RAudioProcessor
pPrev of
          Maybe RAudioProcessor
Nothing -> Ptr (Ptr AudioCallback) -> Int -> Ptr Any -> IO ()
forall b. Ptr b -> Int -> Ptr Any -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr (Ptr AudioCallback)
basePtr Int
16 Ptr Any
forall a. Ptr a
nullPtr
          Just RAudioProcessor
val -> do
            Ptr (Ptr AudioCallback)
prevPtr <- IO (Ptr (Ptr AudioCallback))
forall a. Storable a => IO (Ptr a)
malloc
            Ptr (Ptr AudioCallback) -> Int -> Maybe AudioCallback -> IO ()
forall a. Storable a => Ptr (Ptr a) -> Int -> Maybe a -> IO ()
pokeMaybeOff Ptr (Ptr AudioCallback)
prevPtr Int
0 (RAudioProcessor -> Maybe AudioCallback
rAudioProcessor'process RAudioProcessor
val)
            Ptr (Ptr AudioCallback) -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall b. Ptr b -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr (Ptr AudioCallback)
prevPtr Int
8 Ptr (Ptr AudioCallback)
basePtr
            Ptr (Ptr AudioCallback) -> Maybe RAudioProcessor -> IO ()
pokePrev Ptr (Ptr AudioCallback)
prevPtr (RAudioProcessor -> Maybe RAudioProcessor
rAudioProcessor'prev RAudioProcessor
val)
            Ptr (Ptr AudioCallback) -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall b. Ptr b -> Int -> Ptr (Ptr AudioCallback) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr (Ptr AudioCallback)
basePtr Int
16 Ptr (Ptr AudioCallback)
prevPtr

data AudioStream = AudioStream
  { AudioStream -> Ptr RAudioBuffer
audioStream'buffer :: Ptr RAudioBuffer,
    AudioStream -> Ptr RAudioProcessor
audioStream'processor :: Ptr RAudioProcessor,
    AudioStream -> Integer
audioStream'sampleRate :: Integer,
    AudioStream -> Integer
audioStream'sampleSize :: Integer,
    AudioStream -> Integer
audiostream'channels :: Integer
  }
  deriving (AudioStream -> AudioStream -> Bool
(AudioStream -> AudioStream -> Bool)
-> (AudioStream -> AudioStream -> Bool) -> Eq AudioStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AudioStream -> AudioStream -> Bool
== :: AudioStream -> AudioStream -> Bool
$c/= :: AudioStream -> AudioStream -> Bool
/= :: AudioStream -> AudioStream -> Bool
Eq, Int -> AudioStream -> ShowS
[AudioStream] -> ShowS
AudioStream -> String
(Int -> AudioStream -> ShowS)
-> (AudioStream -> String)
-> ([AudioStream] -> ShowS)
-> Show AudioStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AudioStream -> ShowS
showsPrec :: Int -> AudioStream -> ShowS
$cshow :: AudioStream -> String
show :: AudioStream -> String
$cshowList :: [AudioStream] -> ShowS
showList :: [AudioStream] -> ShowS
Show, AudioStream -> Ptr AudioStream -> IO ()
(AudioStream -> Ptr AudioStream -> IO ())
-> (AudioStream -> Ptr AudioStream -> IO ())
-> Freeable AudioStream
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: AudioStream -> Ptr AudioStream -> IO ()
rlFreeDependents :: AudioStream -> Ptr AudioStream -> IO ()
$crlFree :: AudioStream -> Ptr AudioStream -> IO ()
rlFree :: AudioStream -> Ptr AudioStream -> IO ()
Freeable)

instance Storable AudioStream where
  sizeOf :: AudioStream -> Int
sizeOf AudioStream
_ = Int
32
  alignment :: AudioStream -> Int
alignment AudioStream
_ = Int
8
  peek :: Ptr AudioStream -> IO AudioStream
peek Ptr AudioStream
_p = do
    Ptr RAudioBuffer
buffer <- Ptr AudioStream -> Int -> IO (Ptr RAudioBuffer)
forall b. Ptr b -> Int -> IO (Ptr RAudioBuffer)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AudioStream
_p Int
0
    Ptr RAudioProcessor
processor <- Ptr AudioStream -> Int -> IO (Ptr RAudioProcessor)
forall b. Ptr b -> Int -> IO (Ptr RAudioProcessor)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AudioStream
_p Int
8
    Integer
sampleRate <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AudioStream -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AudioStream
_p Int
16 :: IO CUInt)
    Integer
sampleSize <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AudioStream -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AudioStream
_p Int
20 :: IO CUInt)
    Integer
channels <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AudioStream -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AudioStream
_p Int
24 :: IO CUInt)
    AudioStream -> IO AudioStream
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (AudioStream -> IO AudioStream) -> AudioStream -> IO AudioStream
forall a b. (a -> b) -> a -> b
$ Ptr RAudioBuffer
-> Ptr RAudioProcessor
-> Integer
-> Integer
-> Integer
-> AudioStream
AudioStream Ptr RAudioBuffer
buffer Ptr RAudioProcessor
processor Integer
sampleRate Integer
sampleSize Integer
channels
  poke :: Ptr AudioStream -> AudioStream -> IO ()
poke Ptr AudioStream
_p (AudioStream Ptr RAudioBuffer
buffer Ptr RAudioProcessor
processor Integer
sampleRate Integer
sampleSize Integer
channels) = do
    Ptr AudioStream -> Int -> Ptr RAudioBuffer -> IO ()
forall b. Ptr b -> Int -> Ptr RAudioBuffer -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AudioStream
_p Int
0 Ptr RAudioBuffer
buffer
    Ptr AudioStream -> Int -> Ptr RAudioProcessor -> IO ()
forall b. Ptr b -> Int -> Ptr RAudioProcessor -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AudioStream
_p Int
8 Ptr RAudioProcessor
processor
    Ptr AudioStream -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AudioStream
_p Int
16 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
sampleRate :: CUInt)
    Ptr AudioStream -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AudioStream
_p Int
20 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
sampleSize :: CUInt)
    Ptr AudioStream -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AudioStream
_p Int
24 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
channels :: CUInt)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Sound = Sound
  { Sound -> AudioStream
sound'stream :: AudioStream,
    Sound -> Integer
sound'frameCount :: Integer
  }
  deriving (Sound -> Sound -> Bool
(Sound -> Sound -> Bool) -> (Sound -> Sound -> Bool) -> Eq Sound
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Sound -> Sound -> Bool
== :: Sound -> Sound -> Bool
$c/= :: Sound -> Sound -> Bool
/= :: Sound -> Sound -> Bool
Eq, Int -> Sound -> ShowS
[Sound] -> ShowS
Sound -> String
(Int -> Sound -> ShowS)
-> (Sound -> String) -> ([Sound] -> ShowS) -> Show Sound
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Sound -> ShowS
showsPrec :: Int -> Sound -> ShowS
$cshow :: Sound -> String
show :: Sound -> String
$cshowList :: [Sound] -> ShowS
showList :: [Sound] -> ShowS
Show, Sound -> Ptr Sound -> IO ()
(Sound -> Ptr Sound -> IO ())
-> (Sound -> Ptr Sound -> IO ()) -> Freeable Sound
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Sound -> Ptr Sound -> IO ()
rlFreeDependents :: Sound -> Ptr Sound -> IO ()
$crlFree :: Sound -> Ptr Sound -> IO ()
rlFree :: Sound -> Ptr Sound -> IO ()
Freeable)

instance Storable Sound where
  sizeOf :: Sound -> Int
sizeOf Sound
_ = Int
40
  alignment :: Sound -> Int
alignment Sound
_ = Int
8
  peek :: Ptr Sound -> IO Sound
peek Ptr Sound
_p = do
    AudioStream
stream <- Ptr Sound -> Int -> IO AudioStream
forall b. Ptr b -> Int -> IO AudioStream
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Sound
_p Int
0
    Integer
frameCount <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Sound -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Sound
_p Int
32 :: IO CUInt)
    Sound -> IO Sound
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sound -> IO Sound) -> Sound -> IO Sound
forall a b. (a -> b) -> a -> b
$ AudioStream -> Integer -> Sound
Sound AudioStream
stream Integer
frameCount
  poke :: Ptr Sound -> Sound -> IO ()
poke Ptr Sound
_p (Sound AudioStream
stream Integer
frameCount) = do
    Ptr Sound -> Int -> AudioStream -> IO ()
forall b. Ptr b -> Int -> AudioStream -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Sound
_p Int
0 AudioStream
stream
    Ptr Sound -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Sound
_p Int
32 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
frameCount :: CUInt)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data Music = Music
  { Music -> AudioStream
music'stream :: AudioStream,
    Music -> Integer
music'frameCount :: Integer,
    Music -> Bool
music'looping :: Bool,
    Music -> MusicContextType
music'ctxType :: MusicContextType,
    Music -> Ptr ()
music'ctxData :: Ptr ()
  }
  deriving (Music -> Music -> Bool
(Music -> Music -> Bool) -> (Music -> Music -> Bool) -> Eq Music
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Music -> Music -> Bool
== :: Music -> Music -> Bool
$c/= :: Music -> Music -> Bool
/= :: Music -> Music -> Bool
Eq, Int -> Music -> ShowS
[Music] -> ShowS
Music -> String
(Int -> Music -> ShowS)
-> (Music -> String) -> ([Music] -> ShowS) -> Show Music
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Music -> ShowS
showsPrec :: Int -> Music -> ShowS
$cshow :: Music -> String
show :: Music -> String
$cshowList :: [Music] -> ShowS
showList :: [Music] -> ShowS
Show, Music -> Ptr Music -> IO ()
(Music -> Ptr Music -> IO ())
-> (Music -> Ptr Music -> IO ()) -> Freeable Music
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: Music -> Ptr Music -> IO ()
rlFreeDependents :: Music -> Ptr Music -> IO ()
$crlFree :: Music -> Ptr Music -> IO ()
rlFree :: Music -> Ptr Music -> IO ()
Freeable)

instance Storable Music where
  sizeOf :: Music -> Int
sizeOf Music
_ = Int
56
  alignment :: Music -> Int
alignment Music
_ = Int
4
  peek :: Ptr Music -> IO Music
peek Ptr Music
_p = do
    AudioStream
stream <- Ptr Music -> Int -> IO AudioStream
forall b. Ptr b -> Int -> IO AudioStream
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Music
_p Int
0
    Integer
frameCount <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Music -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Music
_p Int
32 :: IO CUInt)
    Bool
looping <- CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Music -> Int -> IO CBool
forall b. Ptr b -> Int -> IO CBool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Music
_p Int
36 :: IO CBool)
    MusicContextType
ctxType <- Ptr Music -> Int -> IO MusicContextType
forall b. Ptr b -> Int -> IO MusicContextType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Music
_p Int
40
    Ptr ()
ctxData <- Ptr Music -> Int -> IO (Ptr ())
forall b. Ptr b -> Int -> IO (Ptr ())
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr Music
_p Int
48
    Music -> IO Music
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Music -> IO Music) -> Music -> IO Music
forall a b. (a -> b) -> a -> b
$ AudioStream
-> Integer -> Bool -> MusicContextType -> Ptr () -> Music
Music AudioStream
stream Integer
frameCount Bool
looping MusicContextType
ctxType Ptr ()
ctxData
  poke :: Ptr Music -> Music -> IO ()
poke Ptr Music
_p (Music AudioStream
stream Integer
frameCount Bool
looping MusicContextType
ctxType Ptr ()
ctxData) = do
    Ptr Music -> Int -> AudioStream -> IO ()
forall b. Ptr b -> Int -> AudioStream -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Music
_p Int
0 AudioStream
stream
    Ptr Music -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Music
_p Int
32 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
frameCount :: CUInt)
    Ptr Music -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Music
_p Int
36 (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
looping :: CInt)
    Ptr Music -> Int -> MusicContextType -> IO ()
forall b. Ptr b -> Int -> MusicContextType -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Music
_p Int
40 MusicContextType
ctxType
    Ptr Music -> Int -> Ptr () -> IO ()
forall b. Ptr b -> Int -> Ptr () -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr Music
_p Int
48 Ptr ()
ctxData
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data VrDeviceInfo = VrDeviceInfo
  { VrDeviceInfo -> Int
vrDeviceInfo'hResolution :: Int,
    VrDeviceInfo -> Int
vrDeviceInfo'vResolution :: Int,
    VrDeviceInfo -> Float
vrDeviceInfo'hScreenSize :: Float,
    VrDeviceInfo -> Float
vrDeviceInfo'vScreenSize :: Float,
    VrDeviceInfo -> Float
vrDeviceInfo'eyeToScreenDistance :: Float,
    VrDeviceInfo -> Float
vrDeviceInfo'lensSeparationDistance :: Float,
    VrDeviceInfo -> Float
vrDeviceInfo'interpupillaryDistance :: Float,
    VrDeviceInfo -> [Float]
vrDeviceInfo'lensDistortionValues :: [Float],
    VrDeviceInfo -> [Float]
vrDeviceInfo'chromaAbCorrection :: [Float]
  }
  deriving (VrDeviceInfo -> VrDeviceInfo -> Bool
(VrDeviceInfo -> VrDeviceInfo -> Bool)
-> (VrDeviceInfo -> VrDeviceInfo -> Bool) -> Eq VrDeviceInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VrDeviceInfo -> VrDeviceInfo -> Bool
== :: VrDeviceInfo -> VrDeviceInfo -> Bool
$c/= :: VrDeviceInfo -> VrDeviceInfo -> Bool
/= :: VrDeviceInfo -> VrDeviceInfo -> Bool
Eq, Int -> VrDeviceInfo -> ShowS
[VrDeviceInfo] -> ShowS
VrDeviceInfo -> String
(Int -> VrDeviceInfo -> ShowS)
-> (VrDeviceInfo -> String)
-> ([VrDeviceInfo] -> ShowS)
-> Show VrDeviceInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VrDeviceInfo -> ShowS
showsPrec :: Int -> VrDeviceInfo -> ShowS
$cshow :: VrDeviceInfo -> String
show :: VrDeviceInfo -> String
$cshowList :: [VrDeviceInfo] -> ShowS
showList :: [VrDeviceInfo] -> ShowS
Show, VrDeviceInfo -> Ptr VrDeviceInfo -> IO ()
(VrDeviceInfo -> Ptr VrDeviceInfo -> IO ())
-> (VrDeviceInfo -> Ptr VrDeviceInfo -> IO ())
-> Freeable VrDeviceInfo
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: VrDeviceInfo -> Ptr VrDeviceInfo -> IO ()
rlFreeDependents :: VrDeviceInfo -> Ptr VrDeviceInfo -> IO ()
$crlFree :: VrDeviceInfo -> Ptr VrDeviceInfo -> IO ()
rlFree :: VrDeviceInfo -> Ptr VrDeviceInfo -> IO ()
Freeable)

instance Storable VrDeviceInfo where
  sizeOf :: VrDeviceInfo -> Int
sizeOf VrDeviceInfo
_ = Int
60
  alignment :: VrDeviceInfo -> Int
alignment VrDeviceInfo
_ = Int
4
  peek :: Ptr VrDeviceInfo -> IO VrDeviceInfo
peek Ptr VrDeviceInfo
_p = do
    Int
hResolution <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
0 :: IO CInt)
    Int
vResolution <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
4 :: IO CInt)
    Float
hScreenSize <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
8 :: IO CFloat)
    Float
vScreenSize <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
12 :: IO CFloat)
    Float
eyeToScreenDistance <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
16 :: IO CFloat)
    Float
lensSeparationDistance <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
20 :: IO CFloat)
    Float
interpupillaryDistance <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr VrDeviceInfo -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr VrDeviceInfo
_p Int
24 :: IO CFloat)
    [Float]
lensDistortionValues <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
4 (Ptr VrDeviceInfo -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrDeviceInfo
_p) Int
28 :: IO [CFloat])
    [Float]
chromaAbCorrection <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
4 (Ptr VrDeviceInfo -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrDeviceInfo
_p) Int
44 :: IO [CFloat])
    VrDeviceInfo -> IO VrDeviceInfo
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (VrDeviceInfo -> IO VrDeviceInfo)
-> VrDeviceInfo -> IO VrDeviceInfo
forall a b. (a -> b) -> a -> b
$ Int
-> Int
-> Float
-> Float
-> Float
-> Float
-> Float
-> [Float]
-> [Float]
-> VrDeviceInfo
VrDeviceInfo Int
hResolution Int
vResolution Float
hScreenSize Float
vScreenSize Float
eyeToScreenDistance Float
lensSeparationDistance Float
interpupillaryDistance [Float]
lensDistortionValues [Float]
chromaAbCorrection
  poke :: Ptr VrDeviceInfo -> VrDeviceInfo -> IO ()
poke Ptr VrDeviceInfo
_p (VrDeviceInfo Int
hResolution Int
vResolution Float
hScreenSize Float
vScreenSize Float
eyeToScreenDistance Float
lensSeparationDistance Float
interpupillaryDistance [Float]
lensDistortionValues [Float]
chromaAbCorrection) = do
    Ptr VrDeviceInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hResolution :: CInt)
    Ptr VrDeviceInfo -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
vResolution :: CInt)
    Ptr VrDeviceInfo -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
8 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
hScreenSize :: CFloat)
    Ptr VrDeviceInfo -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
12 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
vScreenSize :: CFloat)
    Ptr VrDeviceInfo -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
16 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
eyeToScreenDistance :: CFloat)
    Ptr VrDeviceInfo -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
20 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
lensSeparationDistance :: CFloat)
    Ptr VrDeviceInfo -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr VrDeviceInfo
_p Int
24 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
interpupillaryDistance :: CFloat)
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrDeviceInfo -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrDeviceInfo
_p) Int
28 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
lensDistortionValues :: [CFloat])
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrDeviceInfo -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrDeviceInfo
_p) Int
44 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
chromaAbCorrection :: [CFloat])
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data VrStereoConfig = VrStereoConfig
  { VrStereoConfig -> [Matrix]
vrStereoConfig'projection :: [Matrix],
    VrStereoConfig -> [Matrix]
vrStereoConfig'viewOffset :: [Matrix],
    VrStereoConfig -> [Float]
vrStereoConfig'leftLensCenter :: [Float],
    VrStereoConfig -> [Float]
vrStereoConfig'rightLensCenter :: [Float],
    VrStereoConfig -> [Float]
vrStereoConfig'leftScreenCenter :: [Float],
    VrStereoConfig -> [Float]
vrStereoConfig'rightScreenCenter :: [Float],
    VrStereoConfig -> [Float]
vrStereoConfig'scale :: [Float],
    VrStereoConfig -> [Float]
vrStereoConfig'scaleIn :: [Float]
  }
  deriving (VrStereoConfig -> VrStereoConfig -> Bool
(VrStereoConfig -> VrStereoConfig -> Bool)
-> (VrStereoConfig -> VrStereoConfig -> Bool) -> Eq VrStereoConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VrStereoConfig -> VrStereoConfig -> Bool
== :: VrStereoConfig -> VrStereoConfig -> Bool
$c/= :: VrStereoConfig -> VrStereoConfig -> Bool
/= :: VrStereoConfig -> VrStereoConfig -> Bool
Eq, Int -> VrStereoConfig -> ShowS
[VrStereoConfig] -> ShowS
VrStereoConfig -> String
(Int -> VrStereoConfig -> ShowS)
-> (VrStereoConfig -> String)
-> ([VrStereoConfig] -> ShowS)
-> Show VrStereoConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VrStereoConfig -> ShowS
showsPrec :: Int -> VrStereoConfig -> ShowS
$cshow :: VrStereoConfig -> String
show :: VrStereoConfig -> String
$cshowList :: [VrStereoConfig] -> ShowS
showList :: [VrStereoConfig] -> ShowS
Show, VrStereoConfig -> Ptr VrStereoConfig -> IO ()
(VrStereoConfig -> Ptr VrStereoConfig -> IO ())
-> (VrStereoConfig -> Ptr VrStereoConfig -> IO ())
-> Freeable VrStereoConfig
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: VrStereoConfig -> Ptr VrStereoConfig -> IO ()
rlFreeDependents :: VrStereoConfig -> Ptr VrStereoConfig -> IO ()
$crlFree :: VrStereoConfig -> Ptr VrStereoConfig -> IO ()
rlFree :: VrStereoConfig -> Ptr VrStereoConfig -> IO ()
Freeable)

instance Storable VrStereoConfig where
  sizeOf :: VrStereoConfig -> Int
sizeOf VrStereoConfig
_ = Int
304
  alignment :: VrStereoConfig -> Int
alignment VrStereoConfig
_ = Int
4
  peek :: Ptr VrStereoConfig -> IO VrStereoConfig
peek Ptr VrStereoConfig
_p = do
    [Matrix]
projection <- Int -> Ptr Matrix -> Int -> IO [Matrix]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr Matrix
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
0
    [Matrix]
viewOffset <- Int -> Ptr Matrix -> Int -> IO [Matrix]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr Matrix
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
128
    [Float]
leftLensCenter <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
256 :: IO [CFloat])
    [Float]
rightLensCenter <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
264 :: IO [CFloat])
    [Float]
leftScreenCenter <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
272 :: IO [CFloat])
    [Float]
rightScreenCenter <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
280 :: IO [CFloat])
    [Float]
scale <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
288 :: IO [CFloat])
    [Float]
scaleIn <- (CFloat -> Float) -> [CFloat] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
map CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac ([CFloat] -> [Float]) -> IO [CFloat] -> IO [Float]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Ptr CFloat -> Int -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
2 (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
296 :: IO [CFloat])
    VrStereoConfig -> IO VrStereoConfig
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (VrStereoConfig -> IO VrStereoConfig)
-> VrStereoConfig -> IO VrStereoConfig
forall a b. (a -> b) -> a -> b
$ [Matrix]
-> [Matrix]
-> [Float]
-> [Float]
-> [Float]
-> [Float]
-> [Float]
-> [Float]
-> VrStereoConfig
VrStereoConfig [Matrix]
projection [Matrix]
viewOffset [Float]
leftLensCenter [Float]
rightLensCenter [Float]
leftScreenCenter [Float]
rightScreenCenter [Float]
scale [Float]
scaleIn
  poke :: Ptr VrStereoConfig -> VrStereoConfig -> IO ()
poke Ptr VrStereoConfig
_p (VrStereoConfig [Matrix]
projection [Matrix]
viewOffset [Float]
leftLensCenter [Float]
rightLensCenter [Float]
leftScreenCenter [Float]
rightScreenCenter [Float]
scale [Float]
scaleIn) = do
    Ptr Matrix -> Int -> [Matrix] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr Matrix
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
0 [Matrix]
projection
    Ptr Matrix -> Int -> [Matrix] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr Matrix
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
128 [Matrix]
viewOffset
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
256 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
leftLensCenter :: [CFloat])
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
264 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
rightLensCenter :: [CFloat])
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
272 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
leftScreenCenter :: [CFloat])
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
280 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
rightScreenCenter :: [CFloat])
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
288 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
scale :: [CFloat])
    Ptr CFloat -> Int -> [CFloat] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr VrStereoConfig -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr VrStereoConfig
_p) Int
296 ((Float -> CFloat) -> [Float] -> [CFloat]
forall a b. (a -> b) -> [a] -> [b]
map Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac [Float]
scaleIn :: [CFloat])
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data FilePathList = FilePathList
  { FilePathList -> Integer
filePathlist'capacity :: Integer,
    FilePathList -> [String]
filePathList'paths :: [String]
  }
  deriving (FilePathList -> FilePathList -> Bool
(FilePathList -> FilePathList -> Bool)
-> (FilePathList -> FilePathList -> Bool) -> Eq FilePathList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FilePathList -> FilePathList -> Bool
== :: FilePathList -> FilePathList -> Bool
$c/= :: FilePathList -> FilePathList -> Bool
/= :: FilePathList -> FilePathList -> Bool
Eq, Int -> FilePathList -> ShowS
[FilePathList] -> ShowS
FilePathList -> String
(Int -> FilePathList -> ShowS)
-> (FilePathList -> String)
-> ([FilePathList] -> ShowS)
-> Show FilePathList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FilePathList -> ShowS
showsPrec :: Int -> FilePathList -> ShowS
$cshow :: FilePathList -> String
show :: FilePathList -> String
$cshowList :: [FilePathList] -> ShowS
showList :: [FilePathList] -> ShowS
Show)
  
instance Storable FilePathList where
  sizeOf :: FilePathList -> Int
sizeOf FilePathList
_ = Int
16
  alignment :: FilePathList -> Int
alignment FilePathList
_ = Int
4
  peek :: Ptr FilePathList -> IO FilePathList
peek Ptr FilePathList
_p = do
    Integer
capacity <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr FilePathList -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr FilePathList
_p Int
0 :: IO CUInt)
    Int
count <- CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Int) -> IO CUInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr FilePathList -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr FilePathList
_p Int
4 :: IO CUInt)
    Ptr (Ptr CChar)
pathsPtr <- (Ptr FilePathList -> Int -> IO (Ptr (Ptr CChar))
forall b. Ptr b -> Int -> IO (Ptr (Ptr CChar))
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr FilePathList
_p Int
8 :: IO (Ptr CString))
    [Ptr CChar]
pathsCStrings <- Int -> Ptr (Ptr CChar) -> IO [Ptr CChar]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
count Ptr (Ptr CChar)
pathsPtr
    [String]
paths <- (Ptr CChar -> IO String) -> [Ptr CChar] -> IO [String]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM Ptr CChar -> IO String
peekCString [Ptr CChar]
pathsCStrings
    FilePathList -> IO FilePathList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (FilePathList -> IO FilePathList)
-> FilePathList -> IO FilePathList
forall a b. (a -> b) -> a -> b
$ Integer -> [String] -> FilePathList
FilePathList Integer
capacity [String]
paths
  poke :: Ptr FilePathList -> FilePathList -> IO ()
poke Ptr FilePathList
_p (FilePathList Integer
capacity [String]
paths) = do
    Ptr FilePathList -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr FilePathList
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
capacity :: CUInt)
    Ptr FilePathList -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr FilePathList
_p Int
4 (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([String] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [String]
paths) :: CUInt)
    [Ptr CChar]
pathsCStrings <- (String -> IO (Ptr CChar)) -> [String] -> IO [Ptr CChar]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM String -> IO (Ptr CChar)
newCString [String]
paths
    Ptr FilePathList -> Int -> Ptr (Ptr CChar) -> IO ()
forall b. Ptr b -> Int -> Ptr (Ptr CChar) -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr FilePathList
_p Int
8 (Ptr (Ptr CChar) -> IO ()) -> IO (Ptr (Ptr CChar)) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Ptr CChar] -> IO (Ptr (Ptr CChar))
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Ptr CChar]
pathsCStrings
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable FilePathList where
  rlFreeDependents :: FilePathList -> Ptr FilePathList -> IO ()
rlFreeDependents FilePathList
val Ptr FilePathList
ptr = do
    Ptr (Ptr CChar)
pathsPtr <- (Ptr FilePathList -> Int -> IO (Ptr (Ptr CChar))
forall b. Ptr b -> Int -> IO (Ptr (Ptr CChar))
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr FilePathList
ptr Int
8 :: IO (Ptr CString))
    [Ptr CChar]
pathsCStrings <- Int -> Ptr (Ptr CChar) -> IO [Ptr CChar]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray ([String] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ([String] -> Int) -> [String] -> Int
forall a b. (a -> b) -> a -> b
$ FilePathList -> [String]
filePathList'paths FilePathList
val) Ptr (Ptr CChar)
pathsPtr
    (Ptr CChar -> IO ()) -> [Ptr CChar] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> (Ptr CChar -> Ptr ()) -> Ptr CChar -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr CChar -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr) [Ptr CChar]
pathsCStrings
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr CChar) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr (Ptr CChar)
pathsPtr

data AutomationEvent = AutomationEvent
  {
    AutomationEvent -> Integer
automationEvent'frame :: Integer,
    AutomationEvent -> Integer
automationEvent'type :: Integer,
    AutomationEvent -> [Int]
automationEvent'params :: [Int]
  }
  deriving (AutomationEvent -> AutomationEvent -> Bool
(AutomationEvent -> AutomationEvent -> Bool)
-> (AutomationEvent -> AutomationEvent -> Bool)
-> Eq AutomationEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AutomationEvent -> AutomationEvent -> Bool
== :: AutomationEvent -> AutomationEvent -> Bool
$c/= :: AutomationEvent -> AutomationEvent -> Bool
/= :: AutomationEvent -> AutomationEvent -> Bool
Eq, Int -> AutomationEvent -> ShowS
[AutomationEvent] -> ShowS
AutomationEvent -> String
(Int -> AutomationEvent -> ShowS)
-> (AutomationEvent -> String)
-> ([AutomationEvent] -> ShowS)
-> Show AutomationEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AutomationEvent -> ShowS
showsPrec :: Int -> AutomationEvent -> ShowS
$cshow :: AutomationEvent -> String
show :: AutomationEvent -> String
$cshowList :: [AutomationEvent] -> ShowS
showList :: [AutomationEvent] -> ShowS
Show, AutomationEvent -> Ptr AutomationEvent -> IO ()
(AutomationEvent -> Ptr AutomationEvent -> IO ())
-> (AutomationEvent -> Ptr AutomationEvent -> IO ())
-> Freeable AutomationEvent
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: AutomationEvent -> Ptr AutomationEvent -> IO ()
rlFreeDependents :: AutomationEvent -> Ptr AutomationEvent -> IO ()
$crlFree :: AutomationEvent -> Ptr AutomationEvent -> IO ()
rlFree :: AutomationEvent -> Ptr AutomationEvent -> IO ()
Freeable)

instance Storable AutomationEvent where
  sizeOf :: AutomationEvent -> Int
sizeOf AutomationEvent
_ = Int
24
  alignment :: AutomationEvent -> Int
alignment AutomationEvent
_ = Int
4
  peek :: Ptr AutomationEvent -> IO AutomationEvent
peek Ptr AutomationEvent
_p = do
    Integer
frame <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AutomationEvent -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AutomationEvent
_p Int
0 :: IO CUInt)
    Integer
aeType <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AutomationEvent -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AutomationEvent
_p Int
4 :: IO CUInt)
    [Int]
params <- (CInt -> Int) -> [CInt] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CInt] -> [Int]) -> IO [CInt] -> IO [Int]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CInt -> Int -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
4 (Ptr AutomationEvent -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr AutomationEvent
_p :: Ptr CInt) Int
8
    AutomationEvent -> IO AutomationEvent
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (AutomationEvent -> IO AutomationEvent)
-> AutomationEvent -> IO AutomationEvent
forall a b. (a -> b) -> a -> b
$ Integer -> Integer -> [Int] -> AutomationEvent
AutomationEvent Integer
frame Integer
aeType [Int]
params
  poke :: Ptr AutomationEvent -> AutomationEvent -> IO ()
poke Ptr AutomationEvent
_p (AutomationEvent Integer
frame Integer
aeType [Int]
params) = do
    Ptr AutomationEvent -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AutomationEvent
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
frame :: CUInt)
    Ptr AutomationEvent -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AutomationEvent
_p Int
4 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
aeType :: CUInt)
    Ptr CInt -> Int -> [CInt] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr AutomationEvent -> Ptr CInt
forall a b. Ptr a -> Ptr b
castPtr Ptr AutomationEvent
_p :: Ptr CInt) Int
8 ((Int -> CInt) -> [Int] -> [CInt]
forall a b. (a -> b) -> [a] -> [b]
map Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
params)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

data AutomationEventList = AutomationEventList
  {
    AutomationEventList -> Integer
automationEventList'capacity :: Integer,
    AutomationEventList -> [AutomationEvent]
automationEventList'events :: [AutomationEvent]
  } deriving (AutomationEventList -> AutomationEventList -> Bool
(AutomationEventList -> AutomationEventList -> Bool)
-> (AutomationEventList -> AutomationEventList -> Bool)
-> Eq AutomationEventList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AutomationEventList -> AutomationEventList -> Bool
== :: AutomationEventList -> AutomationEventList -> Bool
$c/= :: AutomationEventList -> AutomationEventList -> Bool
/= :: AutomationEventList -> AutomationEventList -> Bool
Eq, Int -> AutomationEventList -> ShowS
[AutomationEventList] -> ShowS
AutomationEventList -> String
(Int -> AutomationEventList -> ShowS)
-> (AutomationEventList -> String)
-> ([AutomationEventList] -> ShowS)
-> Show AutomationEventList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AutomationEventList -> ShowS
showsPrec :: Int -> AutomationEventList -> ShowS
$cshow :: AutomationEventList -> String
show :: AutomationEventList -> String
$cshowList :: [AutomationEventList] -> ShowS
showList :: [AutomationEventList] -> ShowS
Show)

instance Storable AutomationEventList where
  sizeOf :: AutomationEventList -> Int
sizeOf AutomationEventList
_ = Int
16
  alignment :: AutomationEventList -> Int
alignment AutomationEventList
_ = Int
8
  peek :: Ptr AutomationEventList -> IO AutomationEventList
peek Ptr AutomationEventList
_p = do
    Integer
capacity <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AutomationEventList -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AutomationEventList
_p Int
0 :: IO CUInt)
    Int
count <- CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Int) -> IO CUInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr AutomationEventList -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AutomationEventList
_p Int
4 :: IO CUInt)
    Ptr AutomationEvent
eventsPtr <- (Ptr AutomationEventList -> Int -> IO (Ptr AutomationEvent)
forall b. Ptr b -> Int -> IO (Ptr AutomationEvent)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AutomationEventList
_p Int
8 :: IO (Ptr AutomationEvent))
    [AutomationEvent]
events <- Int -> Ptr AutomationEvent -> IO [AutomationEvent]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
count Ptr AutomationEvent
eventsPtr
    AutomationEventList -> IO AutomationEventList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (AutomationEventList -> IO AutomationEventList)
-> AutomationEventList -> IO AutomationEventList
forall a b. (a -> b) -> a -> b
$ Integer -> [AutomationEvent] -> AutomationEventList
AutomationEventList Integer
capacity [AutomationEvent]
events
  poke :: Ptr AutomationEventList -> AutomationEventList -> IO ()
poke Ptr AutomationEventList
_p (AutomationEventList Integer
capacity [AutomationEvent]
events) = do
    Ptr AutomationEventList -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AutomationEventList
_p Int
0 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
capacity :: CUInt)
    Ptr AutomationEventList -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AutomationEventList
_p Int
4 (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([AutomationEvent] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [AutomationEvent]
events) :: CUInt)
    Ptr Any
ptr <- Int -> IO (Ptr Any)
forall a. Int -> IO (Ptr a)
callocBytes (Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
capacity Int -> Int -> Int
forall a. Num a => a -> a -> a
* AutomationEvent -> Int
forall a. Storable a => a -> Int
sizeOf (AutomationEvent
forall a. HasCallStack => a
undefined :: AutomationEvent))
    Ptr AutomationEventList -> Int -> Ptr Any -> IO ()
forall b. Ptr b -> Int -> Ptr Any -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr AutomationEventList
_p Int
8 Ptr Any
ptr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable AutomationEventList where
  rlFreeDependents :: AutomationEventList -> Ptr AutomationEventList -> IO ()
rlFreeDependents AutomationEventList
_ Ptr AutomationEventList
ptr = do
    Ptr AutomationEvent
eventsPtr <- (Ptr AutomationEventList -> Int -> IO (Ptr AutomationEvent)
forall b. Ptr b -> Int -> IO (Ptr AutomationEvent)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr AutomationEventList
ptr Int
8 :: IO (Ptr AutomationEvent))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr AutomationEvent -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr AutomationEvent
eventsPtr

type AutomationEventListRef = Ptr AutomationEventList

---- rlgl.h


-- | Dynamic vertex buffers (position + texcoords + colors + indices arrays)

data RLVertexBuffer = RLVertexBuffer
  { -- | Number of elements in the buffer (QUADS)

    RLVertexBuffer -> Int
rlVertexBuffer'elementCount :: Int,
    -- | Vertex position (shader-location = 0)

    RLVertexBuffer -> [Vector3]
rlVertexBuffer'vertices :: [Vector3],
    -- | Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)

    RLVertexBuffer -> [Vector2]
rlVertexBuffer'texcoords :: [Vector2],
    -- | Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)

    RLVertexBuffer -> [Color]
rlVertexBuffer'colors :: [Color],
    -- | Vertex indices (in case vertex data comes indexed) (6 indices per quad)

    RLVertexBuffer -> [Integer]
rlVertexBuffer'indices :: [Integer],
    -- | OpenGL Vertex Array Object id

    RLVertexBuffer -> Integer
rlVertexBuffer'vaoId :: Integer,
    -- | OpenGL Vertex Buffer Objects id (4 types of vertex data)

    RLVertexBuffer -> [Integer]
rlVertexBuffer'vboId :: [Integer]
  }
  deriving (RLVertexBuffer -> RLVertexBuffer -> Bool
(RLVertexBuffer -> RLVertexBuffer -> Bool)
-> (RLVertexBuffer -> RLVertexBuffer -> Bool) -> Eq RLVertexBuffer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLVertexBuffer -> RLVertexBuffer -> Bool
== :: RLVertexBuffer -> RLVertexBuffer -> Bool
$c/= :: RLVertexBuffer -> RLVertexBuffer -> Bool
/= :: RLVertexBuffer -> RLVertexBuffer -> Bool
Eq, Int -> RLVertexBuffer -> ShowS
[RLVertexBuffer] -> ShowS
RLVertexBuffer -> String
(Int -> RLVertexBuffer -> ShowS)
-> (RLVertexBuffer -> String)
-> ([RLVertexBuffer] -> ShowS)
-> Show RLVertexBuffer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLVertexBuffer -> ShowS
showsPrec :: Int -> RLVertexBuffer -> ShowS
$cshow :: RLVertexBuffer -> String
show :: RLVertexBuffer -> String
$cshowList :: [RLVertexBuffer] -> ShowS
showList :: [RLVertexBuffer] -> ShowS
Show)

instance Storable RLVertexBuffer where
  sizeOf :: RLVertexBuffer -> Int
sizeOf RLVertexBuffer
_ = Int
64
  alignment :: RLVertexBuffer -> Int
alignment RLVertexBuffer
_ = Int
8
  peek :: Ptr RLVertexBuffer -> IO RLVertexBuffer
peek Ptr RLVertexBuffer
_p = do
    Int
elementCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLVertexBuffer -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
_p Int
0 :: IO CInt)
    Ptr Vector3
verticesPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
_p Int
8 :: IO (Ptr Vector3))
    [Vector3]
vertices <- Int -> Ptr Vector3 -> IO [Vector3]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
elementCount Ptr Vector3
verticesPtr
    Ptr Vector2
texcoordsPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr Vector2)
forall b. Ptr b -> Int -> IO (Ptr Vector2)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
_p Int
16 :: IO (Ptr Vector2))
    [Vector2]
texcoords <- Int -> Ptr Vector2 -> IO [Vector2]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
elementCount Ptr Vector2
texcoordsPtr
    Ptr Color
colorsPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr Color)
forall b. Ptr b -> Int -> IO (Ptr Color)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
_p Int
24 :: IO (Ptr Color))
    [Color]
colors <- Int -> Ptr Color -> IO [Color]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
elementCount Ptr Color
colorsPtr
    Ptr CUInt
indicesPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr CUInt)
forall b. Ptr b -> Int -> IO (Ptr CUInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
_p Int
32 :: IO (Ptr CUInt))
    [Integer]
indices <- (CUInt -> Integer) -> [CUInt] -> [Integer]
forall a b. (a -> b) -> [a] -> [b]
map CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CUInt] -> [Integer]) -> IO [CUInt] -> IO [Integer]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CUInt -> IO [CUInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
elementCount Ptr CUInt
indicesPtr
    Integer
vaoId <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLVertexBuffer -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
_p Int
40 :: IO CUInt)
    [Integer]
vboId <- (CUInt -> Integer) -> [CUInt] -> [Integer]
forall a b. (a -> b) -> [a] -> [b]
map CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([CUInt] -> [Integer]) -> IO [CUInt] -> IO [Integer]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> Ptr CUInt -> Int -> IO [CUInt]
forall a. Storable a => Int -> Ptr a -> Int -> IO [a]
peekStaticArrayOff Int
4 (Ptr RLVertexBuffer -> Ptr CUInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLVertexBuffer
_p :: Ptr CUInt) Int
44
    RLVertexBuffer -> IO RLVertexBuffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLVertexBuffer -> IO RLVertexBuffer)
-> RLVertexBuffer -> IO RLVertexBuffer
forall a b. (a -> b) -> a -> b
$ Int
-> [Vector3]
-> [Vector2]
-> [Color]
-> [Integer]
-> Integer
-> [Integer]
-> RLVertexBuffer
RLVertexBuffer Int
elementCount [Vector3]
vertices [Vector2]
texcoords [Color]
colors [Integer]
indices Integer
vaoId [Integer]
vboId
  poke :: Ptr RLVertexBuffer -> RLVertexBuffer -> IO ()
poke Ptr RLVertexBuffer
_p (RLVertexBuffer Int
elementCount [Vector3]
vertices [Vector2]
texcoords [Color]
colors [Integer]
indices Integer
vaoId [Integer]
vboId) = do
    Ptr RLVertexBuffer -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLVertexBuffer
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
elementCount :: CInt)
    Ptr RLVertexBuffer -> Int -> Ptr Vector3 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector3 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLVertexBuffer
_p Int
8 (Ptr Vector3 -> IO ()) -> IO (Ptr Vector3) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Vector3] -> IO (Ptr Vector3)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Vector3]
vertices
    Ptr RLVertexBuffer -> Int -> Ptr Vector2 -> IO ()
forall b. Ptr b -> Int -> Ptr Vector2 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLVertexBuffer
_p Int
16 (Ptr Vector2 -> IO ()) -> IO (Ptr Vector2) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Vector2] -> IO (Ptr Vector2)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Vector2]
texcoords
    Ptr RLVertexBuffer -> Int -> Ptr Color -> IO ()
forall b. Ptr b -> Int -> Ptr Color -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLVertexBuffer
_p Int
24 (Ptr Color -> IO ()) -> IO (Ptr Color) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [Color] -> IO (Ptr Color)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [Color]
colors
    Ptr RLVertexBuffer -> Int -> Ptr CUInt -> IO ()
forall b. Ptr b -> Int -> Ptr CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLVertexBuffer
_p Int
32 (Ptr CUInt -> IO ()) -> IO (Ptr CUInt) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [CUInt] -> IO (Ptr CUInt)
forall a. Storable a => [a] -> IO (Ptr a)
newArray ((Integer -> CUInt) -> [Integer] -> [CUInt]
forall a b. (a -> b) -> [a] -> [b]
map Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Integer]
indices :: [CUInt])
    Ptr RLVertexBuffer -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLVertexBuffer
_p Int
40 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
vaoId :: CUInt)
    Ptr CUInt -> Int -> [CUInt] -> IO ()
forall a. Storable a => Ptr a -> Int -> [a] -> IO ()
pokeStaticArrayOff (Ptr RLVertexBuffer -> Ptr CUInt
forall a b. Ptr a -> Ptr b
castPtr Ptr RLVertexBuffer
_p) Int
44 ((Integer -> CUInt) -> [Integer] -> [CUInt]
forall a b. (a -> b) -> [a] -> [b]
map Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Integer]
vboId :: [CUInt])
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable RLVertexBuffer where
  rlFreeDependents :: RLVertexBuffer -> Ptr RLVertexBuffer -> IO ()
rlFreeDependents RLVertexBuffer
_ Ptr RLVertexBuffer
ptr = do
    Ptr Vector3
verticesPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr Vector3)
forall b. Ptr b -> Int -> IO (Ptr Vector3)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
ptr Int
8 :: IO (Ptr Vector3))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector3 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector3
verticesPtr
    Ptr Vector2
texcoordsPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr Vector2)
forall b. Ptr b -> Int -> IO (Ptr Vector2)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
ptr Int
16 :: IO (Ptr Vector2))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Vector2 -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Vector2
texcoordsPtr
    Ptr Color
colorsPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr Color)
forall b. Ptr b -> Int -> IO (Ptr Color)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
ptr Int
24 :: IO (Ptr Color))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Color -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Color
colorsPtr
    Ptr CUInt
indicesPtr <- (Ptr RLVertexBuffer -> Int -> IO (Ptr CUInt)
forall b. Ptr b -> Int -> IO (Ptr CUInt)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLVertexBuffer
ptr Int
32 :: IO (Ptr CUInt))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CUInt -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr CUInt
indicesPtr

-- | Draw call type.

-- NOTE: Only texture changes register a new draw, other state-change-related elements are not

-- used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any

-- of those state changes happen (this is done in the core module).

data RLDrawCall = RLDrawCall
  { -- | Drawing mode: LINES, TRIANGLES, QUADS

    RLDrawCall -> RLDrawMode
rlDrawCall'mode :: RLDrawMode,
    -- | Number of vertices of the draw

    RLDrawCall -> Int
rlDrawCall'vertexCount :: Int,
    -- | Number of vertices required for index alignment (LINES, TRIANGLES)

    RLDrawCall -> Int
rlDrawCall'vertexAlignment :: Int,
    -- | Texture id to be used on the draw -> Used to create new draw call if changed

    RLDrawCall -> Integer
rlDrawCall'textureId :: Integer
  }
  deriving (RLDrawCall -> RLDrawCall -> Bool
(RLDrawCall -> RLDrawCall -> Bool)
-> (RLDrawCall -> RLDrawCall -> Bool) -> Eq RLDrawCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLDrawCall -> RLDrawCall -> Bool
== :: RLDrawCall -> RLDrawCall -> Bool
$c/= :: RLDrawCall -> RLDrawCall -> Bool
/= :: RLDrawCall -> RLDrawCall -> Bool
Eq, Int -> RLDrawCall -> ShowS
[RLDrawCall] -> ShowS
RLDrawCall -> String
(Int -> RLDrawCall -> ShowS)
-> (RLDrawCall -> String)
-> ([RLDrawCall] -> ShowS)
-> Show RLDrawCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLDrawCall -> ShowS
showsPrec :: Int -> RLDrawCall -> ShowS
$cshow :: RLDrawCall -> String
show :: RLDrawCall -> String
$cshowList :: [RLDrawCall] -> ShowS
showList :: [RLDrawCall] -> ShowS
Show, RLDrawCall -> Ptr RLDrawCall -> IO ()
(RLDrawCall -> Ptr RLDrawCall -> IO ())
-> (RLDrawCall -> Ptr RLDrawCall -> IO ()) -> Freeable RLDrawCall
forall a.
(a -> Ptr a -> IO ()) -> (a -> Ptr a -> IO ()) -> Freeable a
$crlFreeDependents :: RLDrawCall -> Ptr RLDrawCall -> IO ()
rlFreeDependents :: RLDrawCall -> Ptr RLDrawCall -> IO ()
$crlFree :: RLDrawCall -> Ptr RLDrawCall -> IO ()
rlFree :: RLDrawCall -> Ptr RLDrawCall -> IO ()
Freeable)

instance Storable RLDrawCall where
  sizeOf :: RLDrawCall -> Int
sizeOf RLDrawCall
_ = Int
16
  alignment :: RLDrawCall -> Int
alignment RLDrawCall
_ = Int
8
  peek :: Ptr RLDrawCall -> IO RLDrawCall
peek Ptr RLDrawCall
_p = do
    RLDrawMode
mode <- Ptr RLDrawCall -> Int -> IO RLDrawMode
forall b. Ptr b -> Int -> IO RLDrawMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLDrawCall
_p Int
0
    Int
vertexCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLDrawCall -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLDrawCall
_p Int
4 :: IO CInt)
    Int
vertexAlignment <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLDrawCall -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLDrawCall
_p Int
8 :: IO CInt)
    Integer
textureId <- CUInt -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Integer) -> IO CUInt -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLDrawCall -> Int -> IO CUInt
forall b. Ptr b -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLDrawCall
_p Int
12 :: IO CUInt)
    RLDrawCall -> IO RLDrawCall
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLDrawCall -> IO RLDrawCall) -> RLDrawCall -> IO RLDrawCall
forall a b. (a -> b) -> a -> b
$ RLDrawMode -> Int -> Int -> Integer -> RLDrawCall
RLDrawCall RLDrawMode
mode Int
vertexCount Int
vertexAlignment Integer
textureId
  poke :: Ptr RLDrawCall -> RLDrawCall -> IO ()
poke Ptr RLDrawCall
_p (RLDrawCall RLDrawMode
mode Int
vertexCount Int
vertexAlignment Integer
textureId) = do
    Ptr RLDrawCall -> Int -> RLDrawMode -> IO ()
forall b. Ptr b -> Int -> RLDrawMode -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLDrawCall
_p Int
0 RLDrawMode
mode
    Ptr RLDrawCall -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLDrawCall
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
vertexCount :: CInt)
    Ptr RLDrawCall -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLDrawCall
_p Int
8 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
vertexAlignment :: CInt)
    Ptr RLDrawCall -> Int -> CUInt -> IO ()
forall b. Ptr b -> Int -> CUInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLDrawCall
_p Int
12 (Integer -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
textureId :: CUInt)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

-- rlRenderBatch type

data RLRenderBatch = RLRenderBatch
  { -- | Number of vertex buffers (multi-buffering support)

    RLRenderBatch -> Int
rlRenderBatch'bufferCount :: Int,
    -- | Current buffer tracking in case of multi-buffering

    RLRenderBatch -> Int
rlRenderBatch'currentBuffer :: Int,
    -- | Dynamic buffer(s) for vertex data

    RLRenderBatch -> [RLVertexBuffer]
rlRenderBatch'vertexBuffers :: [RLVertexBuffer],
    -- | Draw calls array, depends on textureId

    RLRenderBatch -> [RLDrawCall]
rlRenderBatch'draws :: [RLDrawCall],
    -- | Draw calls counter

    RLRenderBatch -> Int
rlRenderBatch'drawCounter :: Int,
    -- | Current depth value for next draw

    RLRenderBatch -> Float
rlRenderBatch'currentDepth :: Float
  }
  deriving (RLRenderBatch -> RLRenderBatch -> Bool
(RLRenderBatch -> RLRenderBatch -> Bool)
-> (RLRenderBatch -> RLRenderBatch -> Bool) -> Eq RLRenderBatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RLRenderBatch -> RLRenderBatch -> Bool
== :: RLRenderBatch -> RLRenderBatch -> Bool
$c/= :: RLRenderBatch -> RLRenderBatch -> Bool
/= :: RLRenderBatch -> RLRenderBatch -> Bool
Eq, Int -> RLRenderBatch -> ShowS
[RLRenderBatch] -> ShowS
RLRenderBatch -> String
(Int -> RLRenderBatch -> ShowS)
-> (RLRenderBatch -> String)
-> ([RLRenderBatch] -> ShowS)
-> Show RLRenderBatch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RLRenderBatch -> ShowS
showsPrec :: Int -> RLRenderBatch -> ShowS
$cshow :: RLRenderBatch -> String
show :: RLRenderBatch -> String
$cshowList :: [RLRenderBatch] -> ShowS
showList :: [RLRenderBatch] -> ShowS
Show)

instance Storable RLRenderBatch where
  sizeOf :: RLRenderBatch -> Int
sizeOf RLRenderBatch
_ = Int
32
  alignment :: RLRenderBatch -> Int
alignment RLRenderBatch
_ = Int
8
  peek :: Ptr RLRenderBatch -> IO RLRenderBatch
peek Ptr RLRenderBatch
_p = do
    Int
bufferCount <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLRenderBatch -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
_p Int
0 :: IO CInt)
    Int
currentBuffer <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLRenderBatch -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
_p Int
4 :: IO CInt)
    Ptr RLVertexBuffer
vertexBuffersPtr <- (Ptr RLRenderBatch -> Int -> IO (Ptr RLVertexBuffer)
forall b. Ptr b -> Int -> IO (Ptr RLVertexBuffer)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
_p Int
8 :: IO (Ptr RLVertexBuffer))
    [RLVertexBuffer]
vertexBuffers <- Int -> Ptr RLVertexBuffer -> IO [RLVertexBuffer]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
bufferCount Ptr RLVertexBuffer
vertexBuffersPtr
    Ptr RLDrawCall
drawsPtr <- (Ptr RLRenderBatch -> Int -> IO (Ptr RLDrawCall)
forall b. Ptr b -> Int -> IO (Ptr RLDrawCall)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
_p Int
16 :: IO (Ptr RLDrawCall))
    [RLDrawCall]
draws <- Int -> Ptr RLDrawCall -> IO [RLDrawCall]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
256 Ptr RLDrawCall
drawsPtr
    Int
drawCounter <- CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLRenderBatch -> Int -> IO CInt
forall b. Ptr b -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
_p Int
24 :: IO CInt)
    Float
currentDepth <- CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr RLRenderBatch -> Int -> IO CFloat
forall b. Ptr b -> Int -> IO CFloat
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
_p Int
28 :: IO CFloat)
    RLRenderBatch -> IO RLRenderBatch
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RLRenderBatch -> IO RLRenderBatch)
-> RLRenderBatch -> IO RLRenderBatch
forall a b. (a -> b) -> a -> b
$ Int
-> Int
-> [RLVertexBuffer]
-> [RLDrawCall]
-> Int
-> Float
-> RLRenderBatch
RLRenderBatch Int
bufferCount Int
currentBuffer [RLVertexBuffer]
vertexBuffers [RLDrawCall]
draws Int
drawCounter Float
currentDepth
  poke :: Ptr RLRenderBatch -> RLRenderBatch -> IO ()
poke Ptr RLRenderBatch
_p (RLRenderBatch Int
bufferCount Int
currentBuffer [RLVertexBuffer]
vertexBuffers [RLDrawCall]
draws Int
drawCounter Float
currentDepth) = do
    Ptr RLRenderBatch -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLRenderBatch
_p Int
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
bufferCount :: CInt)
    Ptr RLRenderBatch -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLRenderBatch
_p Int
4 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentBuffer :: CInt)
    Ptr RLRenderBatch -> Int -> Ptr RLVertexBuffer -> IO ()
forall b. Ptr b -> Int -> Ptr RLVertexBuffer -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLRenderBatch
_p Int
8 (Ptr RLVertexBuffer -> IO ()) -> IO (Ptr RLVertexBuffer) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [RLVertexBuffer] -> IO (Ptr RLVertexBuffer)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [RLVertexBuffer]
vertexBuffers
    Ptr RLRenderBatch -> Int -> Ptr RLDrawCall -> IO ()
forall b. Ptr b -> Int -> Ptr RLDrawCall -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLRenderBatch
_p Int
16 (Ptr RLDrawCall -> IO ()) -> IO (Ptr RLDrawCall) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [RLDrawCall] -> IO (Ptr RLDrawCall)
forall a. Storable a => [a] -> IO (Ptr a)
newArray [RLDrawCall]
draws
    Ptr RLRenderBatch -> Int -> CInt -> IO ()
forall b. Ptr b -> Int -> CInt -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLRenderBatch
_p Int
24 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
drawCounter :: CInt)
    Ptr RLRenderBatch -> Int -> CFloat -> IO ()
forall b. Ptr b -> Int -> CFloat -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RLRenderBatch
_p Int
28 (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
currentDepth :: CFloat)
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

instance Freeable RLRenderBatch where
  rlFreeDependents :: RLRenderBatch -> Ptr RLRenderBatch -> IO ()
rlFreeDependents RLRenderBatch
val Ptr RLRenderBatch
ptr = do
    Ptr RLVertexBuffer
vertexBuffersPtr <- (Ptr RLRenderBatch -> Int -> IO (Ptr RLVertexBuffer)
forall b. Ptr b -> Int -> IO (Ptr RLVertexBuffer)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
ptr Int
8 :: IO (Ptr RLVertexBuffer))
    [RLVertexBuffer] -> Ptr RLVertexBuffer -> IO ()
forall a. (Freeable a, Storable a) => [a] -> Ptr a -> IO ()
rlFreeArray (RLRenderBatch -> [RLVertexBuffer]
rlRenderBatch'vertexBuffers RLRenderBatch
val) Ptr RLVertexBuffer
vertexBuffersPtr
    Ptr RLDrawCall
drawsPtr <- (Ptr RLRenderBatch -> Int -> IO (Ptr RLDrawCall)
forall b. Ptr b -> Int -> IO (Ptr RLDrawCall)
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RLRenderBatch
ptr Int
16 :: IO (Ptr RLDrawCall))
    Ptr () -> IO ()
c'free (Ptr () -> IO ()) -> Ptr () -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr RLDrawCall -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr RLDrawCall
drawsPtr

------------------------------------------------

-- Raylib callbacks ----------------------------

------------------------------------------------


type LoadFileDataCallback = FunPtr (CString -> Ptr CUInt -> IO (Ptr CUChar))

type SaveFileDataCallback = FunPtr (CString -> Ptr () -> CUInt -> IO CInt)

type LoadFileTextCallback = FunPtr (CString -> IO CString)

type SaveFileTextCallback = FunPtr (CString -> CString -> IO CInt)

type AudioCallback = FunPtr (Ptr () -> CUInt -> IO ())