50 std::string_view debugName,
51 std::function<
void(
StepInfo const&)> callback,
55 std::string_view debugName,
56 std::function<
void(
StepInfo const&)> callback,
70 virtual void Pause(
bool shouldPause) = 0;
72 [[nodiscard]]
virtual bool IsPaused()
const = 0;
Represents a simulated body (actor) in a scene.
Manages a simulation scene that steps asynchronously using the SuperDex Physics worker pool.
virtual ~AsyncScene()=default
Don't delete the AsyncScene pointer. Call Context::DestroyAsyncScene.
virtual bool IsPaused() const =0
Check if the simulation is currently paused.
virtual void Pause(bool shouldPause)=0
Pause or unpause the simulation.
virtual CallbackHandle RegisterPreStepCallback(std::string_view debugName, std::function< void(StepInfo const &)> callback, int priority=Scene::kDefaultCallbackPriority)=0
Register a callback to execute before each simulation step.
virtual void RequestStepThenPause()=0
Advance the simulation by exactly one step, then pause.
virtual Context * GetContext()=0
Get the Context that owns this AsyncScene.
virtual void QueueActorCommand(ActorHandle actor, std::function< void(Actor *)> callback)=0
Queue a command to operate on a specific actor on the simulation thread.
virtual void CancelActorQuery(ActorHandle actor, QueryHandle handle)=0
Cancel a query previously registered with an actor.
virtual CallbackHandle RegisterPostStepCallback(std::string_view debugName, std::function< void(StepInfo const &)> callback, int priority=Scene::kDefaultCallbackPriority)=0
Register a callback to execute after each simulation step.
virtual void CancelCallback(CallbackHandle handle)=0
Cancel a previously registered callback.
virtual void SetAsyncStepParams(AsyncStepParams const ¶ms, Error &error)=0
Set the parameters controlling async stepping behavior.
virtual void QueueCommand(std::function< void(Scene *)> callback)=0
Queue a command to execute on the simulation thread before the next step.
virtual AsyncStepParams GetAsyncStepParams() const =0
Get the parameters controlling async stepping behavior.
virtual void WaitForQueuedCommands()=0
Block the calling thread until all previously queued commands have executed.
virtual QueryHandle RegisterActorQuery(ActorHandle actor, QueryType type, bool forceCompute=false)=0
Register a query with an actor.
Main entry point for SuperDex Physics simulation.
Represents a simulation scene.
static constexpr int kDefaultCallbackPriority
Default priority for callback ordering.
QueryType
Type of query data to compute for an actor or constraint.
Unique identifier for an Actor within a Scene.
Parameters controlling the stepping behavior of an AsyncScene.
Unique identifier for a callback registration within a Scene.
Unique identifier for a query within a Scene.
Information passed to per-step callbacks.