| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Box3D.RecPlayer
Synopsis
- create :: Ptr () -> Int -> Int -> IO (Ptr RecPlayer)
- destroy :: Ptr RecPlayer -> IO ()
- stepFrame :: Ptr RecPlayer -> IO Bool
- restart :: Ptr RecPlayer -> IO ()
- seekFrame :: Ptr RecPlayer -> Int -> IO ()
- getWorldId :: Ptr RecPlayer -> IO WorldId
- getFrame :: Ptr RecPlayer -> IO Int
- getFrameCount :: Ptr RecPlayer -> IO Int
- isAtEnd :: Ptr RecPlayer -> IO Bool
- hasDiverged :: Ptr RecPlayer -> IO Bool
- getInfo :: Ptr RecPlayer -> Ptr RecPlayerInfo -> IO ()
- getDivergeFrame :: Ptr RecPlayer -> IO Int
- setWorkerCount :: Ptr RecPlayer -> Int -> IO ()
- setKeyframePolicy :: Ptr RecPlayer -> CSize -> Int -> IO ()
- getKeyframeBudget :: Ptr RecPlayer -> IO CSize
- getKeyframeMinInterval :: Ptr RecPlayer -> IO Int
- getKeyframeInterval :: Ptr RecPlayer -> IO Int
- getKeyframeBytes :: Ptr RecPlayer -> IO CSize
- getBodyCount :: Ptr RecPlayer -> IO Int
- getBodyId :: Ptr RecPlayer -> Int -> IO BodyId
- setDebugShapeCallbacks :: Ptr RecPlayer -> FunPtr CreateDebugShapeCallback -> FunPtr DestroyDebugShapeCallback -> Ptr () -> IO ()
- drawFrameQueries :: Ptr RecPlayer -> Ptr DebugDraw -> Int -> Int -> IO ()
- getFrameQueryCount :: Ptr RecPlayer -> IO Int
- getFrameQuery :: Ptr RecPlayer -> Int -> Ptr RecQueryInfo -> IO ()
- getFrameQueryHit :: Ptr RecPlayer -> Int -> Int -> Ptr RecQueryHit -> IO ()
Documentation
Arguments
| :: Ptr () |
|
| -> Int |
|
| -> Int |
|
| -> IO (Ptr RecPlayer) |
Create a player over a recording. Owns a private copy of the bytes.
Returns: a new player, or NULL on bad header or deserialization failure
Binds b3RecPlayer_Create.
destroy :: Ptr RecPlayer -> IO () Source #
Destroy the player and free all memory. Restores the previous global length scale.
Binds b3RecPlayer_Destroy.
stepFrame :: Ptr RecPlayer -> IO Bool Source #
Advance one frame: dispatch ops until the next Step completes.
Returns: true when a frame was stepped, false at end-of-recording
Binds b3RecPlayer_StepFrame.
restart :: Ptr RecPlayer -> IO () Source #
Rewind to frame 0 (in-place restore so the world id stays stable).
Binds b3RecPlayer_Restart.
Seek to a specific frame. Forward seek steps op-by-op; backward seek restores the nearest keyframe then re-steps the remaining gap.
Binds b3RecPlayer_SeekFrame.
getWorldId :: Ptr RecPlayer -> IO WorldId Source #
Returns: the world currently driven by this player
Binds b3RecPlayer_GetWorldId.
getFrame :: Ptr RecPlayer -> IO Int Source #
Returns: the last fully-stepped frame index (0 before any step)
Binds b3RecPlayer_GetFrame.
getFrameCount :: Ptr RecPlayer -> IO Int Source #
Returns: total number of recorded frames
Binds b3RecPlayer_GetFrameCount.
isAtEnd :: Ptr RecPlayer -> IO Bool Source #
Returns: true when the op stream is exhausted
Binds b3RecPlayer_IsAtEnd.
hasDiverged :: Ptr RecPlayer -> IO Bool Source #
Returns: true when any StateHash mismatch has been detected
Binds b3RecPlayer_HasDiverged.
Arguments
| :: Ptr RecPlayer | |
| -> Ptr RecPlayerInfo | Result buffer. |
| -> IO () |
Returns: a summary of the recording read at open: frame count, recorded tuning, and bounds
Binds b3RecPlayer_GetInfo.
getDivergeFrame :: Ptr RecPlayer -> IO Int Source #
Returns: the first frame at which replay diverged, or -1 if it has not diverged
Binds b3RecPlayer_GetDivergeFrame.
Set the worker count of the replay world. Clamped to \[1, B3_MAX_WORKERS\]. Applied to the live world at once and reused whenever the player rebuilds its world on Restart or a backward seek. Replaying at a different count than recorded re-partitions the constraint graph, so the StateHash check becomes a cross-thread determinism test.
Binds b3RecPlayer_SetWorkerCount.
Arguments
| :: Ptr RecPlayer |
|
| -> CSize |
|
| -> Int |
|
| -> IO () |
Tune the keyframe ring used to speed up backward seeking. A keyframe is a periodic snapshot the player restores from instead of replaying from the start, trading memory for seek speed.
Binds b3RecPlayer_SetKeyframePolicy.
getKeyframeBudget :: Ptr RecPlayer -> IO CSize Source #
Returns: the keyframe memory budget in bytes
Binds b3RecPlayer_GetKeyframeBudget.
getKeyframeMinInterval :: Ptr RecPlayer -> IO Int Source #
Returns: the finest keyframe spacing in frames
Binds b3RecPlayer_GetKeyframeMinInterval.
getKeyframeInterval :: Ptr RecPlayer -> IO Int Source #
Returns: the current keyframe spacing in frames; starts at the min interval and doubles as the ring evicts to stay under budget, so it reflects the effective backward-seek granularity now
Binds b3RecPlayer_GetKeyframeInterval.
getKeyframeBytes :: Ptr RecPlayer -> IO CSize Source #
Returns: the memory currently held by keyframe snapshots, in bytes
Binds b3RecPlayer_GetKeyframeBytes.
getBodyCount :: Ptr RecPlayer -> IO Int Source #
Returns: the number of bodies tracked in creation order (including holes for destroyed bodies)
Binds b3RecPlayer_GetBodyCount.
Resolve a creation ordinal to the live body id at the current frame.
Returns: the body id, or a null id if that ordinal is out of range or its body is destroyed
Binds b3RecPlayer_GetBodyId.
setDebugShapeCallbacks Source #
Arguments
| :: Ptr RecPlayer |
|
| -> FunPtr CreateDebugShapeCallback |
|
| -> FunPtr DestroyDebugShapeCallback |
|
| -> Ptr () |
|
| -> IO () |
Wire host debug-shape callbacks into the player's replay world so a renderer can build per-shape draw resources (the 3D sample needs this or the replay world draws nothing). Rebuilds the current world under the new callbacks and rewinds to frame 0, so call it once right after b3RecPlayer_Create and re-read the world id afterward. The callbacks persist across Restart and backward seeks, which recreate the world internally.
Binds b3RecPlayer_SetDebugShapeCallbacks.
Arguments
| :: Ptr RecPlayer |
|
| -> Ptr DebugDraw |
|
| -> Int |
|
| -> Int |
|
| -> IO () |
Draw the spatial queries recorded during the most recently replayed frame, layered on top of the world. Call after b3World_Draw. NULL draw function pointers are skipped.
Binds b3RecPlayer_DrawFrameQueries.
getFrameQueryCount :: Ptr RecPlayer -> IO Int Source #
Returns: the number of spatial queries recorded for the most recently replayed frame
Binds b3RecPlayer_GetFrameQueryCount.
Get a recorded query from the most recently replayed frame by index.
Binds b3RecPlayer_GetFrameQuery.
Get one result of a recorded query from the most recently replayed frame.
Binds b3RecPlayer_GetFrameQueryHit.