43#define ES_SPINE_NS spine
46namespace es::ES_SPINE_NS {
64using SkeletonPtr = std::unique_ptr<Skeleton, SkeletonDeleter>;
65using InstancePtr = std::unique_ptr<Instance, InstanceDeleter>;
155 return slotBlend == 0 || slotBlend == 1;
166 if (!pagePremultiplied)
return;
175Skeleton* loadSkeleton(
const void* skeletonData,
int length,
176 const char* atlasText,
int atlasLength,
177 bool binary, std::string& error);
179int atlasPageCount(
const Skeleton* skeleton);
180const char* atlasPageName(
const Skeleton* skeleton,
int page);
181void setAtlasPageTexture(Skeleton* skeleton,
int page, uint32_t texture,
int width,
int height);
183void setDefaultMix(Skeleton* skeleton,
float seconds);
184void setMixDuration(Skeleton* skeleton,
const char* from,
const char* to,
float seconds);
188Instance* createInstance(Skeleton* skeleton);
194void advanceAndApply(Instance* instance,
float dt);
202void materializeWorldPose(Instance* instance,
float dt);
205void update(Instance* instance,
float dt);
213bool requiresContinuousWorldPose(
const Skeleton* skeleton);
218float animationDuration(
const Skeleton* skeleton,
const char* animation);
227void setToSetupPose(Instance* instance);
229bool playAnimation(Instance* instance,
const char* animation,
bool loop,
int track);
230bool addAnimation(Instance* instance,
const char* animation,
bool loop,
float delay,
int track);
232void setSkin(Instance* instance,
const char* skin);
233void setTrackAlpha(Instance* instance,
int track,
float alpha);
235void setEventSink(EventSink sink);
236void enableEvents(Instance* instance);
240int animationCount(
const Instance* instance);
241const char* animationName(
const Instance* instance,
int index);
242int skinCount(
const Instance* instance);
243const char* skinName(
const Instance* instance,
int index);
245bool bonePosition(
const Instance* instance,
const char* bone,
float* x,
float* y);
246bool boneRotation(
const Instance* instance,
const char* bone,
float* degrees);
253int boneCount(
const Instance* instance);
254const char* boneName(
const Instance* instance,
int index);
255int boneParent(
const Instance* instance,
int index);
261bool bonePose(
const Instance* instance,
int index,
float* x,
float* y,
float* degrees,
float* length);
262void bounds(
const Instance* instance,
float* x,
float* y,
float* width,
float* height);
270bool skeletonBounds(
const Skeleton* skeleton,
float* x,
float* y,
float* width,
float* height);
272int constraintCount(
const Instance* instance, ConstraintKind kind);
273const char* constraintName(
const Instance* instance, ConstraintKind kind,
int index);
274bool transformMix(
const Instance* instance,
const char* name, TransformMix* out);
275bool setTransformMix(Instance* instance,
const char* name,
const TransformMix& mix);
276bool pathMix(
const Instance* instance,
const char* name, PathMix* out);
277bool setPathMix(Instance* instance,
const char* name,
const PathMix& mix);
281bool setAttachment(Instance* instance,
const char* slot,
const char* attachment);
282bool setIkTarget(Instance* instance,
const char* constraint,
float x,
float y,
float mix);
283bool setSlotColor(Instance* instance,
const char* slot,
float r,
float g,
float b,
float a);
284bool setSkeletonColor(Instance* instance,
float r,
float g,
float b,
float a);
289void render(Instance* instance, TriangleSink& sink,
bool clipping);
What every 2D skeletal-animation side module needs, none of which is about any particular one.
bool renderCounted(Instance *instance, TriangleSink &sink, bool clipping, ProbeCounts *counts)
void(*)(const Event &) EventSink
The module is a singleton, so its collector is process-wide rather than per instance.
const void * eventSource(Instance *instance)
void premultiplyTint(float rgba[4], bool pagePremultiplied)
bool clipStorage(ClipStorage *out)
@ CLIP_START_RESET
The scratch sized for the polygon.
@ CLIP_START_PUBLISH
…and this module's bounds and edges captured.
@ CLIP_START_WORLD
…and its world vertices computed.
@ CLIP_START_WINDING
…made clockwise.
@ CLIP_START_TRIANGULATE
…triangulated.
@ CLIP_START_DECOMPOSE
…decomposed into convex pieces.
@ CLIP_START_PIECES
…each piece wound and closed. spine ends here.
int blendForPage(int slotBlend, bool pagePremultiplied)
The blend code to emit for a slot's mode on a page of the given kind (see above).
bool blendHasPremultipliedTwin(int slotBlend)
es::skeletal::TriangleSink TriangleSink
bool poseStage(Instance *instance, float dt, int stage, PoseCounts *counts)
@ POSE_SETUP
The instance lookup; nothing advances.
@ POSE_WORLD
…and resolve world transforms and constraints — a whole pose.
@ POSE_APPLY
…and evaluate their timelines onto the bones.
@ POSE_ADVANCE
Advance the tracks: time, mixing, queued entries.
std::unique_ptr< Skeleton, SkeletonDeleter > SkeletonPtr
void destroy(Skeleton *skeleton)
@ STAGE_EMIT
…and hand them to the sink. The full extraction.
@ STAGE_VERTICES
…and compute world vertices and tint.
@ STAGE_TRAVERSE
Walk the draw order, resolving what each slot holds.
@ STAGE_CLIP
…and cut the triangles against those pieces.
@ STAGE_SETUP
The instance and the clipper; the loop does not run.
bool clipStartStage(Instance *instance, int stage, ClipStartCounts *counts)
std::unique_ptr< Instance, InstanceDeleter > InstancePtr
bool renderStage(Instance *instance, TriangleSink &sink, bool clipping, int stage, ProbeCounts *counts)
Where a runtime pours the triangles it posed.
std::uint32_t effectiveEdges
std::uint32_t triangulationTriangles
std::uint32_t triangulatorScratch
std::uint32_t rawVertices
const char * animation
Borrowed from the runtime's own data — valid until the skeleton unloads.
void operator()(Instance *p) const
std::uint32_t pathConstraints
std::uint32_t entries
Track entries applied, mixingFrom chains included.
std::uint32_t transformConstraints
std::uint32_t physicsConstraints
std::uint32_t ikConstraints
std::uint32_t indicesEmitted
std::uint32_t clippedEmits
std::uint32_t clipPolygons
std::uint32_t clipInputTriangles
std::uint32_t regionAttachments
std::uint32_t clipCandidateTriangles
std::uint32_t verticesGenerated
std::uint32_t clipOutputVertices
std::uint32_t clipRejectedTriangles
std::uint32_t meshAttachments
std::uint32_t clipPolygonVertices
std::uint32_t clipPolygonEdges
std::uint32_t clipBypassedTriangles
std::uint32_t clipConvexBypasses
std::uint32_t clipInsideAccepts
std::uint32_t clipDecompositions
std::uint32_t verticesEmitted
std::uint32_t clipEdgeWork
std::uint32_t clipOutputTriangles
std::uint32_t clipBoundsRejects
std::uint32_t clipInputVertices
Owning handles, so every error path that bails mid-construct still frees.
void operator()(Skeleton *p) const