Skip to main content

Crate ssplayer_wgpu

Crate ssplayer_wgpu 

Source
Expand description

ssplayer-wgpu — a wgpu-based player for SpriteStudio animations.

The player borrows the host’s wgpu device, queue and render target rather than owning them, so it draws into any wgpu host — a standalone viewer, a browser canvas, or an engine like Bevy.

Three types, split by how long their resources stay useful:

  • SSRenderer — one per device: pipelines, bind group layouts, the sampler and the atlas textures. The host owns it and lends it.
  • SSScene — one per render target: the projection and the frame’s geometry.
  • SSPlayer — one per character: the playback tree. Holds no GPU resource.

Re-exports§

pub use fit::Align;
pub use fit::Fit;
pub use fit::Placed;
pub use fit::Placement;
pub use fit::Rect;

Modules§

ffi
The “ffi” face: the C ABI over the Rust API, for C/C++ hosts on DX12 / Vulkan / Metal.
fit
fit / align — placing an animation inside a box the host laid out.
host
A self-contained native host: owns a wgpu stack built from a raw window handle and drives any number of SSPlayers with it.

Structs§

AtlasKeys
Which renderer key each of one pack’s cellmaps resolves to.
AudioEvent
An audio trigger. The player never produces sound: this says what to play and how many times, and the host feeds its own audio stack.
BatchInfo
The fields of one DrawBatch the renderer needs, extracted by the caller so the operation layer keeps ownership of batch iteration.
CrowdMember
One of the copies SSPlayer::set_crowd draws: where it stands, and how it is faded and tinted, each on top of the player’s own.
EmbeddedImage
One atlas an embedded .ssab carries, still in the form the exporter wrote it: encoded image bytes (PNG), not pixels.
EmbeddedTexture
One atlas image decoded out of an embedded .ssab.
FrameChunk
One frame of one render target: the arena, primitives, mesh stream and draw calls every player sharing the target appends to, in its order.
FrameView
Everything crate::SSScene needs to draw one frame, as borrows into runtime-owned data.
MaskWriter
One planned stencil writer for the current frame.
MaskWriters
One frame’s planned writers, held inline: what plan_writers hands back.
MissingAsset
Something a load needed and did not get.
NodeSlot
Where one node’s placement and coverage block sit in the frame arena.
PartMaskFlags
Static, per-part mask flags read once from ssab PartData.
SSPack
A loaded .ssab, shareable between players.
SSPlayer
The SpriteStudio player. One instance owns one animation-instance tree.
SSRenderer
Everything whose useful lifetime is the device, not one player and not one render target.
SSScene
The per-target, per-frame half — what one render target’s worth of geometry looks like this frame.
SceneConfig
Construction config for SSScene, matched to the host’s render target.
SceneStats
What one frame of a crate::SSScene cost.
ScopedWriter
A writer placed on its player’s tree sequence: the whole instance tree numbered in drawing order, each sub-animation in its instance part’s place.
SignalEvent
A “Signal”: a named command plus its parameters.
SignalParam
One param_id → value pair on a signal.
SsContextWeb
The page’s WebGPU context: one adapter, one device, one SSRenderer, shared by every canvas and every player on the page.
SsPlayerWeb
One character. Holds the playback tree and its placement in the scene — and no GPU resource at all, which is what makes it cheap to have many.
SsSurfaceWeb
One canvas and the scene drawn into it. Holds any number of players, composited in ascending order in a single render pass.
TextureRef
One atlas a pack asks for, described the way the .ssab itself describes it.
UserDataEvent
A “User Data” marker: up to four optional values, in whatever combination the animator filled in. A field is None when it was left unset — which is not the same as zero, and is why these are options rather than defaults.

Enums§

AlphaMode
How a texture’s colour channels relate to its alpha.
BlendOp
How an override’s colour combines with what is underneath — the same four operations the authored PartColor offers.
GeomKind
Geometry a part contributes as a mask writer. Text/Nines are not yet rendered, so they cannot write coverage yet.
MaskBackend
How a scene rasterises mask coverage.
MaskOp
Stencil write operation, resolved by the caller from a writer’s op and whether it is being added or removed from coverage. Increment pairs with decrement (its inverse); invert is its own inverse.
MissingKind
What kind of thing SSPlayer::load could not get.
OverridePriority
How long an override outlives the keyframes it beats.
PlaybackDirection
Which way the playhead walks the animation.
PlaybackStyle
What happens when the playhead reaches the far end of the range.
Retention
Whether SSRenderer::upload_texture keeps a copy of the pixels for device loss recovery.
SSRuntimeError
Everything that can go wrong loading or playing back an animation.
SignalValue
One value carried by a signal parameter.
SsEvent
Something that happened on a frame the last update crossed.
StencilTest
Stencil test mode baked into a content pipeline. Selected per masked part from the target’s visible_inside_mask polarity.
TrackBlend
Re-exported from the runtime: how a track folds onto the tracks below it. How a track folds onto the pose the tracks below it produced.
TrackSync
Re-exported from the runtime: where the animations laid on a track start. How the animation laid on a track keeps time with track 0. Sync means the normalised phase: how far through its section an animation stands, from 0.0 at the section start towards 1.0 at its end, so animations of different lengths line up by proportion rather than by frame.

Constants§

IDENTITY_TRANSFORM
Column-major 4x4 identity. Used as the root transform (children compose their parent instance part’s world matrix onto this).
MAX_CROWD_MEMBERS
The most members SSPlayer::set_crowd draws; those past it are left out.
SDK_VERSION
The SpriteStudio-SDK version whose runtime this build links, written as its release tag (v7.0.0). scripts/build.sh names it from the submodule’s version; a plain cargo build says local.
VERSION
This player’s version, ssplayer-wgpu’s own.

Traits§

AssetLoader
The three things the loading walk cannot do for itself: reach a file, decode an image, and know what the renderer already holds.

Functions§

plan_writers
Plan the frame’s stencil writers by walking draw_batches, mirroring the WebGL MaskPlanner.plan. mask_flags is indexed by part index (static ssab data). Returns writers in ascending rank order, capped at MAX_MASK_WRITERS.