Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
SpineRuntime21.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
25
26#include "./SpineRuntime.hpp"
27
28#include <spine/spine.h>
29#include <spine/extension.h>
30
31#include <cstring>
32#include <vector>
33
34#if ES_SPINE_VERSION != 21
35#error "SpineRuntime21.cpp is the spine-c 2.1 backend; build it with ES_SPINE_VERSION=21."
36#endif
37
38// =============================================================================
39// spine-c Required Callbacks
40// =============================================================================
41//
42// As in the 3.8+ backend: the SDK owns atlas pages and registers their texture ids,
43// and the module never touches a filesystem.
44
45void _spAtlasPage_createTexture(spAtlasPage* self, const char* path) {
46 (void)self;
47 (void)path;
48}
49
50void _spAtlasPage_disposeTexture(spAtlasPage* self) {
51 (void)self;
52}
53
54char* _spUtil_readFile(const char* path, int* length) {
55 (void)path;
56 *length = 0;
57 return nullptr;
58}
59
60namespace es::ES_SPINE_NS {
61
62struct Skeleton {
63 spAtlas* atlas = nullptr;
64 spSkeletonData* data = nullptr;
65 spAnimationStateData* stateData = nullptr;
66
67 Skeleton() = default;
68 Skeleton(const Skeleton&) = delete;
69 Skeleton& operator=(const Skeleton&) = delete;
70
72 if (stateData) spAnimationStateData_dispose(stateData);
73 if (data) spSkeletonData_dispose(data);
74 if (atlas) spAtlas_dispose(atlas);
75 }
76};
77
78struct Instance {
79 spSkeleton* skeleton = nullptr;
80 spAnimationState* state = nullptr;
81
82 Instance() = default;
83 Instance(const Instance&) = delete;
84 Instance& operator=(const Instance&) = delete;
85
87 if (state) spAnimationState_dispose(state);
88 if (skeleton) spSkeleton_dispose(skeleton);
89 }
90};
91
92void destroy(Skeleton* skeleton) { delete skeleton; }
93void destroy(Instance* instance) { delete instance; }
94
95namespace {
96
97std::vector<float> g_worldVertices;
99std::vector<uint16_t> g_indices;
100
101EventSink g_eventSink = nullptr;
102
103const uint16_t QUAD_INDICES[6] = {0, 1, 2, 2, 3, 0};
104
105spAtlasPage* pageAt(const Skeleton* skeleton, int index) {
106 if (!skeleton || index < 0) return nullptr;
107 spAtlasPage* page = skeleton->atlas->pages;
108 for (int i = 0; i < index && page; ++i) page = page->next;
109 return page;
110}
111
113uint32_t textureOf(const void* rendererObject) {
114 auto* region = reinterpret_cast<const spAtlasRegion*>(rendererObject);
115 if (!region || !region->page) return 0;
116 return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(region->page->rendererObject));
117}
118
119void widenIndices(const int* triangles, int count) {
120 g_indices.resize(static_cast<size_t>(count));
121 for (int i = 0; i < count; ++i) {
122 g_indices[static_cast<size_t>(i)] = static_cast<uint16_t>(triangles[i]);
123 }
124}
125
127struct Posed {
128 const float* positions = nullptr;
129 const float* uvs = nullptr;
130 const uint16_t* indices = nullptr;
131 int vertexCount = 0;
132 int indexCount = 0;
133 uint32_t texture = 0;
134 float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
135};
136
142bool pose(spSlot* slot, Posed& out) {
143 spAttachment* attachment = slot->attachment;
144 if (!attachment) return false;
145
146 switch (attachment->type) {
147 case SP_ATTACHMENT_REGION: {
148 auto* region = reinterpret_cast<spRegionAttachment*>(attachment);
149 out.texture = textureOf(region->rendererObject);
150 if (!out.texture) return false;
151
152 g_worldVertices.resize(8);
153 spRegionAttachment_computeWorldVertices(region, slot->bone, g_worldVertices.data());
154 out.positions = g_worldVertices.data();
155 out.uvs = region->uvs;
156 out.indices = QUAD_INDICES;
157 out.vertexCount = 4;
158 out.indexCount = 6;
159 out.color[0] = region->r;
160 out.color[1] = region->g;
161 out.color[2] = region->b;
162 out.color[3] = region->a;
163 return true;
164 }
165 case SP_ATTACHMENT_MESH: {
166 auto* mesh = reinterpret_cast<spMeshAttachment*>(attachment);
167 out.texture = textureOf(mesh->rendererObject);
168 if (!out.texture) return false;
169
170 // verticesCount counts floats, not vertices.
171 g_worldVertices.resize(static_cast<size_t>(mesh->verticesCount));
172 spMeshAttachment_computeWorldVertices(mesh, slot, g_worldVertices.data());
173 widenIndices(mesh->triangles, mesh->trianglesCount);
174 out.positions = g_worldVertices.data();
175 out.uvs = mesh->uvs;
176 out.indices = g_indices.data();
177 out.vertexCount = mesh->verticesCount / 2;
178 out.indexCount = mesh->trianglesCount;
179 out.color[0] = mesh->r;
180 out.color[1] = mesh->g;
181 out.color[2] = mesh->b;
182 out.color[3] = mesh->a;
183 return true;
184 }
185 case SP_ATTACHMENT_SKINNED_MESH: {
186 // 3.x folded weighted meshes back into the mesh attachment; in 2.1 they
187 // are a separate type, sized by their UVs rather than by source vertices.
188 auto* mesh = reinterpret_cast<spSkinnedMeshAttachment*>(attachment);
189 out.texture = textureOf(mesh->rendererObject);
190 if (!out.texture) return false;
191
192 g_worldVertices.resize(static_cast<size_t>(mesh->uvsCount));
193 spSkinnedMeshAttachment_computeWorldVertices(mesh, slot, g_worldVertices.data());
194 widenIndices(mesh->triangles, mesh->trianglesCount);
195 out.positions = g_worldVertices.data();
196 out.uvs = mesh->uvs;
197 out.indices = g_indices.data();
198 out.vertexCount = mesh->uvsCount / 2;
199 out.indexCount = mesh->trianglesCount;
200 out.color[0] = mesh->r;
201 out.color[1] = mesh->g;
202 out.color[2] = mesh->b;
203 out.color[3] = mesh->a;
204 return true;
205 }
206 default:
207 return false; // bounding boxes draw nothing
208 }
209}
210
211EventKind kindOf(spEventType type) {
212 switch (type) {
213 case SP_ANIMATION_START: return EventKind::Start;
214 case SP_ANIMATION_END: return EventKind::End;
215 case SP_ANIMATION_COMPLETE: return EventKind::Complete;
216 default: return EventKind::Event;
217 }
218}
219
223void eventListener(spAnimationState* state, int trackIndex, spEventType type,
224 spEvent* event, int loopCount) {
225 (void)loopCount;
226 if (!g_eventSink) return;
227
228 Event out;
229 out.source = state;
230 out.kind = kindOf(type);
231 out.track = trackIndex;
232
233 spTrackEntry* entry = spAnimationState_getCurrent(state, trackIndex);
234 if (entry && entry->animation) out.animation = entry->animation->name;
235
236 if (type == SP_ANIMATION_EVENT && event) {
237 out.floatValue = event->floatValue;
238 out.intValue = event->intValue;
239 out.name = event->data->name;
240 out.stringValue = event->stringValue;
241 }
242 g_eventSink(out);
243}
244
245} // namespace
246
247// =============================================================================
248// Resources
249// =============================================================================
250
251Skeleton* loadSkeleton(const void* skeletonData, int length,
252 const char* atlasText, int atlasLength,
253 bool binary, std::string& error) {
254 if (binary) {
255 // Spine 2.1 could export .skel, but its C runtime shipped no reader for it —
256 // so the fix is an export setting, and saying which one is the whole job here.
257 error = "Spine 2.1 binary skeletons are not supported: re-export from Spine "
258 "with the skeleton data format set to JSON.";
259 return nullptr;
260 }
261
262 auto skeleton = std::make_unique<Skeleton>();
263
264 skeleton->atlas = spAtlas_create(atlasText, atlasLength, "", nullptr);
265 if (!skeleton->atlas || !skeleton->atlas->pages) {
266 error = "Failed to create atlas (invalid atlas text or no pages)";
267 return nullptr;
268 }
269
270 spSkeletonJson* reader = spSkeletonJson_create(skeleton->atlas);
271 if (!reader) {
272 error = "Failed to create skeleton json reader";
273 return nullptr;
274 }
275 reader->scale = 1.0f;
276 skeleton->data = spSkeletonJson_readSkeletonData(
277 reader, static_cast<const char*>(skeletonData));
278 if (!skeleton->data && reader->error) error = reader->error;
279 spSkeletonJson_dispose(reader);
280 (void)length; // the JSON reader takes a NUL-terminated string
281
282 if (!skeleton->data) return nullptr;
283
284 skeleton->stateData = spAnimationStateData_create(skeleton->data);
285 skeleton->stateData->defaultMix = 0.2f;
286 return skeleton.release();
287}
288
289int atlasPageCount(const Skeleton* skeleton) {
290 if (!skeleton) return 0;
291 int count = 0;
292 for (spAtlasPage* page = skeleton->atlas->pages; page; page = page->next) ++count;
293 return count;
294}
295
296const char* atlasPageName(const Skeleton* skeleton, int page) {
297 spAtlasPage* p = pageAt(skeleton, page);
298 return p ? p->name : nullptr;
299}
300
301void setAtlasPageTexture(Skeleton* skeleton, int page, uint32_t texture, int width, int height) {
302 spAtlasPage* p = pageAt(skeleton, page);
303 if (!p) return;
304
305 // Attachments reach the id through their region's page, so setting it here is
306 // enough — 4.0's second copy on the region did not exist yet.
307 p->rendererObject = reinterpret_cast<void*>(static_cast<uintptr_t>(texture));
308 p->width = width;
309 p->height = height;
310}
311
312void setDefaultMix(Skeleton* skeleton, float seconds) {
313 if (skeleton && skeleton->stateData) skeleton->stateData->defaultMix = seconds;
314}
315
316void setMixDuration(Skeleton* skeleton, const char* from, const char* to, float seconds) {
317 if (!skeleton || !skeleton->stateData) return;
318 spAnimation* a = spSkeletonData_findAnimation(skeleton->data, from);
319 spAnimation* b = spSkeletonData_findAnimation(skeleton->data, to);
320 if (a && b) spAnimationStateData_setMix(skeleton->stateData, a, b, seconds);
321}
322
323// =============================================================================
324// Instances
325// =============================================================================
326
328 if (!skeleton) return nullptr;
329
330 auto instance = std::make_unique<Instance>();
331 instance->skeleton = spSkeleton_create(skeleton->data);
332 instance->state = spAnimationState_create(skeleton->stateData);
333 if (!instance->skeleton || !instance->state) return nullptr;
334
335 spSkeleton_setToSetupPose(instance->skeleton);
336 spSkeleton_updateWorldTransform(instance->skeleton);
337 return instance.release();
338}
339
340void advanceAndApply(Instance* instance, float dt) {
341 if (!instance) return;
342 spAnimationState_update(instance->state, dt);
343 spAnimationState_apply(instance->state, instance->skeleton);
344}
345
346void materializeWorldPose(Instance* instance, float dt) {
347 if (!instance) return;
348 (void)dt;
349 spSkeleton_updateWorldTransform(instance->skeleton);
350}
351
352void update(Instance* instance, float dt) {
353 advanceAndApply(instance, dt);
354 materializeWorldPose(instance, dt);
355}
356
357float animationDuration(const Skeleton* skeleton, const char* animation) {
358 if (!skeleton || !skeleton->data) return -1.0f;
359 spAnimation* found = spSkeletonData_findAnimation(skeleton->data, animation);
360 return found ? found->duration : -1.0f;
361}
362
364 // 2.1 has no constraint that carries state across a pose.
365 return false;
366}
367
368void setToSetupPose(Instance* instance) {
369 if (!instance) return;
370 spAnimationState_clearTracks(instance->state);
371 spSkeleton_setToSetupPose(instance->skeleton);
372}
373
374bool playAnimation(Instance* instance, const char* animation, bool loop, int track) {
375 if (!instance) return false;
376 if (!spSkeletonData_findAnimation(instance->skeleton->data, animation)) return false;
377 return spAnimationState_setAnimationByName(instance->state, track, animation, loop) != nullptr;
378}
379
380bool addAnimation(Instance* instance, const char* animation, bool loop, float delay, int track) {
381 if (!instance) return false;
382 if (!spSkeletonData_findAnimation(instance->skeleton->data, animation)) return false;
383 return spAnimationState_addAnimationByName(instance->state, track, animation, loop, delay) != nullptr;
384}
385
386void setSkin(Instance* instance, const char* skin) {
387 if (!instance) return;
388 if (!skin || skin[0] == '\0') {
389 spSkeleton_setSkin(instance->skeleton, nullptr);
390 } else {
391 spSkeleton_setSkinByName(instance->skeleton, skin);
392 }
393 spSkeleton_setSlotsToSetupPose(instance->skeleton);
394}
395
396void setTrackAlpha(Instance* instance, int track, float alpha) {
397 if (!instance) return;
398 spTrackEntry* entry = spAnimationState_getCurrent(instance->state, track);
399 // `mix` is what 2.1 applies the track with; the per-track alpha of later
400 // releases is the same knob under a name it had not been given yet.
401 if (entry) entry->mix = alpha;
402}
403
405 g_eventSink = sink;
406}
407
408const void* eventSource(Instance* instance) {
409 return instance ? instance->state : nullptr;
410}
411
412void enableEvents(Instance* instance) {
413 if (instance) instance->state->listener = eventListener;
414}
415
416// =============================================================================
417// Queries
418// =============================================================================
419
420int animationCount(const Instance* instance) {
421 return instance ? instance->skeleton->data->animationsCount : 0;
422}
423
424const char* animationName(const Instance* instance, int index) {
425 if (!instance) return nullptr;
426 spSkeletonData* data = instance->skeleton->data;
427 if (index < 0 || index >= data->animationsCount) return nullptr;
428 return data->animations[index]->name;
429}
430
431int skinCount(const Instance* instance) {
432 return instance ? instance->skeleton->data->skinsCount : 0;
433}
434
435const char* skinName(const Instance* instance, int index) {
436 if (!instance) return nullptr;
437 spSkeletonData* data = instance->skeleton->data;
438 if (index < 0 || index >= data->skinsCount) return nullptr;
439 return data->skins[index]->name;
440}
441
442bool bonePosition(const Instance* instance, const char* bone, float* x, float* y) {
443 if (!instance) return false;
444 spBone* b = spSkeleton_findBone(instance->skeleton, bone);
445 if (!b) return false;
446 *x = b->worldX;
447 *y = b->worldY;
448 return true;
449}
450
451bool boneRotation(const Instance* instance, const char* bone, float* degrees) {
452 if (!instance) return false;
453 spBone* b = spSkeleton_findBone(instance->skeleton, bone);
454 if (!b) return false;
455 // One world rotation before 4.0 split it per axis; report it for both.
456 *degrees = b->worldRotation;
457 return true;
458}
459
460int boneCount(const Instance* instance) {
461 return instance ? instance->skeleton->bonesCount : 0;
462}
463
464const char* boneName(const Instance* instance, int index) {
465 if (!instance || index < 0 || index >= instance->skeleton->bonesCount) return nullptr;
466 return instance->skeleton->bones[index]->data->name;
467}
468
469int boneParent(const Instance* instance, int index) {
470 if (!instance || index < 0 || index >= instance->skeleton->bonesCount) return -1;
471 const spBone* parent = instance->skeleton->bones[index]->parent;
472 if (!parent) return -1;
473 // 2.1 bones carry no index of their own: the parent is found by where it sits.
474 for (int i = 0; i < index; ++i) {
475 if (instance->skeleton->bones[i] == parent) return i;
476 }
477 return -1;
478}
479
480bool bonePose(const Instance* instance, int index, float* x, float* y, float* degrees, float* length) {
481 if (!instance || index < 0 || index >= instance->skeleton->bonesCount) return false;
482 spBone* b = instance->skeleton->bones[index];
483 *x = b->worldX;
484 *y = b->worldY;
485 *degrees = b->worldRotation;
486 *length = b->data->length;
487 return true;
488}
489
490void bounds(const Instance* instance, float* x, float* y, float* width, float* height) {
491 *x = *y = *width = *height = 0.0f;
492 if (!instance) return;
493
494 spSkeleton* skeleton = instance->skeleton;
495 float minX = 1e30f, minY = 1e30f, maxX = -1e30f, maxY = -1e30f;
496 bool any = false;
497
498 for (int i = 0; i < skeleton->slotsCount; ++i) {
499 Posed posed;
500 if (!pose(skeleton->drawOrder[i], posed)) continue;
501 for (int v = 0; v < posed.vertexCount; ++v) {
502 const float vx = posed.positions[v * 2];
503 const float vy = posed.positions[v * 2 + 1];
504 if (vx < minX) minX = vx;
505 if (vx > maxX) maxX = vx;
506 if (vy < minY) minY = vy;
507 if (vy > maxY) maxY = vy;
508 any = true;
509 }
510 }
511
512 if (!any) return;
513 *x = minX;
514 *y = minY;
515 *width = maxX - minX;
516 *height = maxY - minY;
517}
518
519int constraintCount(const Instance* instance, ConstraintKind kind) {
520 // Transform and path constraints arrived in 3.x; 2.1 skeletons have neither.
521 if (!instance || kind != ConstraintKind::Ik) return 0;
522 return instance->skeleton->ikConstraintsCount;
523}
524
525const char* constraintName(const Instance* instance, ConstraintKind kind, int index) {
526 if (!instance || kind != ConstraintKind::Ik) return nullptr;
527 if (index < 0 || index >= instance->skeleton->ikConstraintsCount) return nullptr;
528 return instance->skeleton->ikConstraints[index]->data->name;
529}
530
531bool transformMix(const Instance*, const char*, TransformMix*) { return false; }
532bool setTransformMix(Instance*, const char*, const TransformMix&) { return false; }
533bool pathMix(const Instance*, const char*, PathMix*) { return false; }
534bool setPathMix(Instance*, const char*, const PathMix&) { return false; }
535
536// =============================================================================
537// Posing
538// =============================================================================
539
540bool setAttachment(Instance* instance, const char* slot, const char* attachment) {
541 if (!instance) return false;
542 const char* name = (attachment && attachment[0] != '\0') ? attachment : nullptr;
543 return spSkeleton_setAttachment(instance->skeleton, slot, name) != 0;
544}
545
546bool setIkTarget(Instance* instance, const char* constraint, float x, float y, float mix) {
547 if (!instance) return false;
548 spIkConstraint* c = spSkeleton_findIkConstraint(instance->skeleton, constraint);
549 if (!c) return false;
550 c->target->x = x;
551 c->target->y = y;
552 c->mix = mix;
553 return true;
554}
555
556bool setSlotColor(Instance* instance, const char* slot, float r, float g, float b, float a) {
557 if (!instance) return false;
558 spSlot* s = spSkeleton_findSlot(instance->skeleton, slot);
559 if (!s) return false;
560 s->r = r;
561 s->g = g;
562 s->b = b;
563 s->a = a;
564 return true;
565}
566
567bool setSkeletonColor(Instance* instance, float r, float g, float b, float a) {
568 if (!instance) return false;
569 instance->skeleton->r = r;
570 instance->skeleton->g = g;
571 instance->skeleton->b = b;
572 instance->skeleton->a = a;
573 return true;
574}
575
576// =============================================================================
577// Geometry
578// =============================================================================
579
580void render(Instance* instance, TriangleSink& sink, bool clipping) {
581 // Clipping attachments are a 3.5 feature; a 2.1 skeleton has no clip region to
582 // apply, so the toggle has nothing to switch off.
583 (void)clipping;
584 if (!instance) return;
585
586 spSkeleton* skeleton = instance->skeleton;
587
588 for (int i = 0; i < skeleton->slotsCount; ++i) {
589 spSlot* slot = skeleton->drawOrder[i];
590 if (!slot) continue;
591
592 Posed posed;
593 if (!pose(slot, posed)) continue;
594
595 // 2.1 slots are normal or additive — multiply and screen came later, and no
596 // atlas of that era declares premultiplied alpha.
597 const int blendMode = slot->data->additiveBlending ? 1 : 0;
598
599 const float rgba[4] = {
600 skeleton->r * slot->r * posed.color[0],
601 skeleton->g * slot->g * posed.color[1],
602 skeleton->b * slot->b * posed.color[2],
603 skeleton->a * slot->a * posed.color[3],
604 };
605
606 sink.emit(posed.positions, posed.uvs, posed.vertexCount,
607 posed.indices, posed.indexCount, posed.texture, blendMode, rgba);
608 }
609}
610
615 return false;
616}
617
618bool poseStage(Instance*, float, int, PoseCounts*) {
619 return false;
620}
621
623 return false;
624}
625
627 return false;
628}
629
631 return false;
632}
633
634bool skeletonBounds(const Skeleton*, float*, float*, float*, float*) {
635 return false;
636}
637
638int version() {
639 return ES_SPINE_VERSION;
640}
641
642} // namespace es::ES_SPINE_NS
char * _spUtil_readFile(const char *path, int *length)
void _spAtlasPage_createTexture(spAtlasPage *self, const char *path)
void _spAtlasPage_disposeTexture(spAtlasPage *self)
What a vendored Spine runtime owes the module, and nothing more.
bool renderCounted(Instance *instance, TriangleSink &sink, bool clipping, ProbeCounts *counts)
int atlasPageCount(const Skeleton *skeleton)
void(*)(const Event &) EventSink
The module is a singleton, so its collector is process-wide rather than per instance.
bool bonePose(const Instance *instance, int index, float *x, float *y, float *degrees, float *length)
void advanceAndApply(Instance *instance, float dt)
bool playAnimation(Instance *instance, const char *animation, bool loop, int track)
const void * eventSource(Instance *instance)
bool pathMix(const Instance *instance, const char *name, PathMix *out)
bool clipStorage(ClipStorage *out)
int boneParent(const Instance *instance, int index)
void update(Instance *instance, float dt)
const char * skinName(const Instance *instance, int index)
bool boneRotation(const Instance *instance, const char *bone, float *degrees)
void enableEvents(Instance *instance)
void setDefaultMix(Skeleton *skeleton, float seconds)
int boneCount(const Instance *instance)
bool transformMix(const Instance *instance, const char *name, TransformMix *out)
float animationDuration(const Skeleton *skeleton, const char *animation)
bool setSkeletonColor(Instance *instance, float r, float g, float b, float a)
Skeleton * loadSkeleton(const void *skeletonData, int length, const char *atlasText, int atlasLength, bool binary, std::string &error)
void setTrackAlpha(Instance *instance, int track, float alpha)
es::skeletal::TriangleSink TriangleSink
const char * boneName(const Instance *instance, int index)
const char * constraintName(const Instance *instance, ConstraintKind kind, int index)
void setEventSink(EventSink sink)
const char * atlasPageName(const Skeleton *skeleton, int page)
bool skeletonBounds(const Skeleton *skeleton, float *x, float *y, float *width, float *height)
void setAtlasPageTexture(Skeleton *skeleton, int page, uint32_t texture, int width, int height)
bool poseStage(Instance *instance, float dt, int stage, PoseCounts *counts)
void bounds(const Instance *instance, float *x, float *y, float *width, float *height)
bool setPathMix(Instance *instance, const char *name, const PathMix &mix)
int skinCount(const Instance *instance)
const char * animationName(const Instance *instance, int index)
void destroy(Skeleton *skeleton)
bool addAnimation(Instance *instance, const char *animation, bool loop, float delay, int track)
bool clipStartStage(Instance *instance, int stage, ClipStartCounts *counts)
bool setAttachment(Instance *instance, const char *slot, const char *attachment)
bool bonePosition(const Instance *instance, const char *bone, float *x, float *y)
bool setSlotColor(Instance *instance, const char *slot, float r, float g, float b, float a)
bool setTransformMix(Instance *instance, const char *name, const TransformMix &mix)
void setSkin(Instance *instance, const char *skin)
void render(Instance *instance, TriangleSink &sink, bool clipping)
int constraintCount(const Instance *instance, ConstraintKind kind)
Instance * createInstance(Skeleton *skeleton)
void setToSetupPose(Instance *instance)
void setMixDuration(Skeleton *skeleton, const char *from, const char *to, float seconds)
bool setIkTarget(Instance *instance, const char *constraint, float x, float y, float mix)
int animationCount(const Instance *instance)
void materializeWorldPose(Instance *instance, float dt)
bool renderStage(Instance *instance, TriangleSink &sink, bool clipping, int stage, ProbeCounts *counts)
bool requiresContinuousWorldPose(const Skeleton *skeleton)
Instance & operator=(const Instance &)=delete
spAnimationState * state
Instance(const Instance &)=delete
Skeleton & operator=(const Skeleton &)=delete
spSkeletonData * data
spAnimationStateData * stateData
Skeleton(const Skeleton &)=delete