载入中...
搜索中...
未找到
Animation.cpp
浏览该文件的文档.
11#include "animation/AnimGraph.h"
12#include "animation/AnimPose.h"
17#include "animation/AnimSkin.h"
19#include "animation/AnimTrail.h"
30#include "animation/Tween.h"
31#include "animation/SpineAnim.h"
38
39#include "common/Exception.h"
40#include "common/Profile.h"
41#include "graphics/Graphics.h"
42#include "graphics/Texture.h"
43#include "graphics/Mesh.h"
44#include "image/Image.h"
45#include "image/ImageData.h"
46#include "data/DataModule.h"
47#include "data/JsonDocument.h"
49#include "filesystem/FileData.h"
50#include <Poco/JSON/Array.h>
51#include <Poco/JSON/Object.h>
52
53#include <algorithm>
54#include <cmath>
55#include <memory>
56#include <simplesquirrel/simplesquirrel.hpp>
57
58namespace eve::animation {
59
60namespace {
61
62void copyFloatArray(ssq::Array arr, std::vector<float> &out) {
63 const size_t n = arr.size();
64 out.resize(n);
65 for (size_t i = 0; i < n; ++i) out[i] = arr.get<float>(i);
66}
67
68void bindPositionsFromArray(AnimLattice *self, ssq::Array arr) {
69 std::vector<float> pos;
70 copyFloatArray(arr, pos);
71 if (pos.size() % 3u != 0) {
72 throw Exception("AnimLattice.bindPositionsFromArray: array size must be a multiple of 3");
73 }
74 self->bindPositions(pos.data(), static_cast<int>(pos.size() / 3u));
75}
76
77bool updateDeformedPositionsFromArray(AnimLattice *self, ssq::Array arr) {
78 std::vector<float> pos;
79 copyFloatArray(arr, pos);
80 return self->updateDeformedPositions(pos);
81}
82
83bool updateDeformedNormalsFromArray(AnimLattice *self, ssq::Array posArr, ssq::Array nrmArr) {
84 std::vector<float> pos;
85 std::vector<float> nrm;
86 copyFloatArray(posArr, pos);
87 copyFloatArray(nrmArr, nrm);
88 return self->updateDeformedNormals(pos, nrm);
89}
90
91} // namespace
92
94
95// Defaulted out of line: `SpriteSheet.h` is included above, so the destructor of
96// `unique_ptr<SpriteSheet>` (needed for this constructor's exception specification)
97// sees a complete type; Animation.h only forward-declares `SpriteSheet`.
98Animation::Animation() = default;
99
101 // Owned players may outlive the module if script GC still holds them; detach.
102 for (Tween *t : tweens_) {
103 if (t) t->setOwner(nullptr);
104 }
105 tweens_.clear();
106 for (SpriteAnim *a : spriteAnims_) {
107 if (a) a->setOwner(nullptr);
108 }
109 spriteAnims_.clear();
110 for (SpineAnim *a : spineAnims_) {
111 if (a) a->setOwner(nullptr);
112 }
113 spineAnims_.clear();
114}
115
117 auto *t = new Tween(duration);
118 registerTween(t);
119 return t;
120}
121
123
125 const std::string &pattern, int first,
126 int last, int columns) {
127 if (!gfx) throw Exception("Animation.newSpriteSheetFromSequence: gfx is null");
128 const size_t marker = pattern.find("{n}");
129 if (marker == std::string::npos)
130 throw Exception("Animation.newSpriteSheetFromSequence: pattern must contain '{n}'");
131 if (first < 0 || last < first)
132 throw Exception("Animation.newSpriteSheetFromSequence: expected 0 <= first <= last");
133
134 const int count = last - first + 1;
135 if (columns <= 0) columns = static_cast<int>(std::ceil(std::sqrt(float(count))));
136 if (columns <= 0)
137 throw Exception("Animation.newSpriteSheetFromSequence: columns must be > 0");
138 const std::string cacheKey = pattern + "#" + std::to_string(first) + ":" +
139 std::to_string(last) + ":" + std::to_string(columns);
140 auto cached = spriteSequenceCache_.find(cacheKey);
141 if (cached != spriteSequenceCache_.end()) return cached->second->clone();
142 const int rows = (count + columns - 1) / columns;
143
144 image::Image *images = image::Image::create();
145 std::vector<image::ImageData *> frames;
146 struct Bounds { int x = 0, y = 0, w = 1, h = 1; };
147 std::vector<Bounds> bounds;
148 frames.reserve(static_cast<size_t>(count));
149 int frameW = 0, frameH = 0;
150 int packedW = 1, packedH = 1;
151 for (int n = first; n <= last; ++n) {
152 std::string path = pattern;
153 path.replace(marker, 3, std::to_string(n));
155 if (!frame) throw Exception("Animation.newSpriteSheetFromSequence: failed '%s'", path.c_str());
156 if (frame->getFormat() != "RGBA8")
157 throw Exception("Animation.newSpriteSheetFromSequence: '%s' must be RGBA8", path.c_str());
158 if (frames.empty()) {
159 frameW = frame->getWidth();
160 frameH = frame->getHeight();
161 } else if (frame->getWidth() != frameW || frame->getHeight() != frameH) {
162 throw Exception("Animation.newSpriteSheetFromSequence: frame size mismatch at '%s'",
163 path.c_str());
164 }
165 frames.push_back(frame);
166 int minX = frameW, minY = frameH, maxX = -1, maxY = -1;
167 for (int py = 0; py < frameH; ++py) {
168 for (int px = 0; px < frameW; ++px) {
169 if (frame->getPixel(px, py).a <= 1.f / 255.f) continue;
170 minX = std::min(minX, px); minY = std::min(minY, py);
171 maxX = std::max(maxX, px); maxY = std::max(maxY, py);
172 }
173 }
174 Bounds b;
175 if (maxX >= minX && maxY >= minY)
176 b = {minX, minY, maxX - minX + 1, maxY - minY + 1};
177 bounds.push_back(b);
178 packedW = std::max(packedW, b.w);
179 packedH = std::max(packedH, b.h);
180 }
181
182 constexpr int padding = 1;
183 const int cellW = packedW + padding * 2;
184 const int cellH = packedH + padding * 2;
185 std::unique_ptr<image::ImageData> atlas(
186 images->newImageData(columns * cellW, rows * cellH, "RGBA8"));
187 auto *sheet = new SpriteSheet();
188 try {
189 for (int i = 0; i < count; ++i) {
190 const int cellX = (i % columns) * cellW;
191 const int cellY = (i / columns) * cellH;
192 const int x = cellX + padding;
193 const int y = cellY + padding;
194 image::ImageData *frame = frames[static_cast<size_t>(i)];
195 const Bounds &b = bounds[size_t(i)];
196 atlas->paste(frame, x, y, b.x, b.y, b.w, b.h);
197 atlas->paste(frame, x, cellY, b.x, b.y, b.w, 1);
198 atlas->paste(frame, x, y + b.h, b.x, b.y + b.h - 1, b.w, 1);
199 atlas->paste(frame, cellX, y, b.x, b.y, 1, b.h);
200 atlas->paste(frame, x + b.w, y, b.x + b.w - 1, b.y, 1, b.h);
201 atlas->paste(frame, cellX, cellY, b.x, b.y, 1, 1);
202 atlas->paste(frame, x + b.w, cellY, b.x + b.w - 1, b.y, 1, 1);
203 atlas->paste(frame, cellX, y + b.h, b.x, b.y + b.h - 1, 1, 1);
204 atlas->paste(frame, x + b.w, y + b.h, b.x + b.w - 1, b.y + b.h - 1, 1, 1);
205 sheet->addFrameTrimmed(std::to_string(first + i), x, y, b.w, b.h,
206 frameW, frameH, b.x, b.y);
207 }
208 sheet->setTexture(gfx->newTextureFromImageData(atlas.get()));
209 spriteSequenceCache_[cacheKey].reset(sheet->clone());
210 } catch (...) {
211 delete sheet;
212 throw;
213 }
214 return sheet;
215}
216
217int Animation::getSpriteSequenceCacheCount() const { return int(spriteSequenceCache_.size()); }
219 int bytes = 0;
220 for (const auto &entry : spriteSequenceCache_) {
221 auto *texture = entry.second->getTexture();
222 if (texture) bytes += texture->getWidth() * texture->getHeight() * 4;
223 }
224 return bytes;
225}
226void Animation::clearSpriteSequenceCache() { spriteSequenceCache_.clear(); }
227
229 const std::string &texturePath,
230 const std::string &jsonPath) {
231 if (!gfx) throw Exception("Animation.newSpriteSheetFromAtlasJson: gfx is null");
232 auto *fs = ModuleManager::getInstance<filesystem::Filesystem>("Filesystem");
233 if (!fs) fs = filesystem::Filesystem::create();
234 std::unique_ptr<filesystem::FileData> file(fs->read(jsonPath));
235 std::string text(static_cast<const char *>(file->getData()), size_t(file->getSize()));
236 auto *dm = data::DataModule::create();
237 std::string error;
238 std::unique_ptr<data::JsonDocument> doc(dm->decodeJson(text, &error));
239 if (!doc || !doc->isObject()) throw Exception("Atlas JSON: %s", error.c_str());
240 auto root = doc->object();
241 if (!root->has("frames")) throw Exception("Atlas JSON: missing frames");
242 auto frames = root->getObject("frames");
243 if (!frames) throw Exception("Atlas JSON: frames must be an object");
244 auto *sheet = new SpriteSheet();
245 try {
246 for (const auto &name : frames->getNames()) {
247 auto item = frames->getObject(name);
248 if (item->optValue<bool>("rotated", false))
249 throw Exception("Atlas JSON: rotated frames are not supported");
250 auto rect = item->getObject("frame");
251 auto src = item->getObject("spriteSourceSize");
252 auto size = item->getObject("sourceSize");
253 const int w = rect->getValue<int>("w"), h = rect->getValue<int>("h");
254 sheet->addFrameTrimmed(name, rect->getValue<int>("x"), rect->getValue<int>("y"), w, h,
255 size ? size->getValue<int>("w") : w,
256 size ? size->getValue<int>("h") : h,
257 src ? src->getValue<int>("x") : 0,
258 src ? src->getValue<int>("y") : 0);
259 }
260 sheet->setTexture(gfx->newTextureFromFile(texturePath));
261 } catch (...) { delete sheet; throw; }
262 return sheet;
263}
264
265SpriteClip *Animation::newSpriteClip(const std::string &name) { return new SpriteClip(name); }
266
268 auto *a = new SpriteAnim();
269 registerSpriteAnim(a);
270 return a;
271}
272
274
276
280
282 auto *a = new SpineAnim(skeleton);
283 registerSpineAnim(a);
284 return a;
285}
286
288 auto *atlas = new SpineAtlas();
289 std::string err;
290 if (!atlas->loadFromFile(path, &err)) {
291 delete atlas;
292 return nullptr;
293 }
294 return atlas;
295}
296
298 auto *atlas = new SpineAtlas();
299 std::string err;
300 if (!atlas->loadFromText(text, &err)) {
301 delete atlas;
302 return nullptr;
303 }
304 return atlas;
305}
306
308 auto *data = new SpineSkeletonData();
309 std::string err;
310 if (!data->loadFromFile(path, &err)) {
311 delete data;
312 return nullptr;
313 }
314 return data;
315}
316
318 auto *data = new SpineSkeletonData();
319 std::string err;
320 if (!data->loadFromJson(json, &err)) {
321 delete data;
322 return nullptr;
323 }
324 return data;
325}
326
328
329AnimClip *Animation::newClip(const std::string &name) { return new AnimClip(name); }
330
331AnimPose *Animation::newPose(int boneCount) { return new AnimPose(boneCount); }
339
340int Animation::setupHairChain(DynamicBoneSolver *solver, const std::string &rootBone,
341 const std::string &tipBone, float stiffness, float damping,
342 float inertia, float endLength, bool selfCollision) {
343 if (!solver) return -1;
345 desc.rootBone = rootBone;
346 desc.tipBone = tipBone;
347 desc.stiffness = stiffness;
348 desc.damping = damping;
349 desc.inertia = inertia;
350 desc.endLength = endLength;
351 desc.selfCollision = selfCollision;
352 auto result = hair::addChain(*solver, desc);
353 return result ? result.value() : -1;
354}
355
356int Animation::setupHairHeadCollider(DynamicBoneSolver *solver, const std::string &boneName,
357 float radius) {
358 if (!solver) return -1;
359 auto result = hair::addHeadCollider(*solver, boneName, radius);
360 return result ? result.value() : -1;
361}
364
365AnimPlayer *Animation::newPlayer(AnimSkeleton *skeleton) { return new AnimPlayer(skeleton); }
366AnimGraph *Animation::newGraph(AnimSkeleton *skeleton) { return new AnimGraph(skeleton); }
367
369
371
375
377 return new MotionDatabase(skeleton);
378}
379
381 return new MotionMatcher(skeleton, database);
382}
383
384ControlAnim *Animation::newControlAnim(float frequencyHz, float dampingZeta, float response) {
385 return new ControlAnim(frequencyHz, dampingZeta, response);
386}
387
389
393
395 AnimSkeleton *sk = nullptr;
396 AnimClip *clip = nullptr;
398 delete clip;
399 return sk;
400}
401
403 AnimSkeleton *sk = nullptr;
404 AnimClip *clip = nullptr;
406 delete sk;
408 return clip;
409}
410
411AnimLattice *Animation::newLattice(int divX, int divY, int divZ) {
412 return new AnimLattice(divX, divY, divZ);
413}
414
416
418 return MotionBuilder(motions_, from, to, duration);
419}
420
424
428
430
434
438
442
446
450
454
458
462
463
464
465void Animation::registerTween(Tween *t) {
466 if (!t) return;
467 t->setOwner(this);
468 if (std::find(tweens_.begin(), tweens_.end(), t) == tweens_.end()) tweens_.push_back(t);
469}
470
471void Animation::unregisterTween(Tween *t) {
472 if (!t) return;
473 auto it = std::find(tweens_.begin(), tweens_.end(), t);
474 if (it != tweens_.end()) tweens_.erase(it);
475 if (t->owner() == this) t->setOwner(nullptr);
476}
477
478void Animation::registerSpriteAnim(SpriteAnim *a) {
479 if (!a) return;
480 a->setOwner(this);
481 if (std::find(spriteAnims_.begin(), spriteAnims_.end(), a) == spriteAnims_.end())
482 spriteAnims_.push_back(a);
483}
484
485void Animation::unregisterSpriteAnim(SpriteAnim *a) {
486 if (!a) return;
487 auto it = std::find(spriteAnims_.begin(), spriteAnims_.end(), a);
488 if (it != spriteAnims_.end()) spriteAnims_.erase(it);
489 if (a->owner() == this) a->setOwner(nullptr);
490}
491
492void Animation::registerSpineAnim(SpineAnim *a) {
493 if (!a) return;
494 a->setOwner(this);
495 if (std::find(spineAnims_.begin(), spineAnims_.end(), a) == spineAnims_.end())
496 spineAnims_.push_back(a);
497}
498
499void Animation::unregisterSpineAnim(SpineAnim *a) {
500 if (!a) return;
501 auto it = std::find(spineAnims_.begin(), spineAnims_.end(), a);
502 if (it != spineAnims_.end()) spineAnims_.erase(it);
503 if (a->owner() == this) a->setOwner(nullptr);
504}
505
507 if (step.delta.nanoseconds() < 0)
509 "animation simulation delta must be non-negative"));
510 if (hasLastTick_ && step.tick <= lastTick_)
512 eve::DiagnosticCode::Conflict, "animation simulation tick must advance monotonically"));
513
514 const float dt = static_cast<float>(step.delta.seconds());
515 if (!std::isfinite(dt))
517 "animation simulation delta is outside float range"));
518
519 // Preflight every live child before mutating any of them. A child may also
520 // be driven directly by a caller, so the host must preserve all-or-none
521 // behavior when one child has already consumed this tick.
522 for (Tween *t : tweens_) {
523 if (t && t->isActive() && t->hasCurrentTick() && step.tick <= t->currentTick())
525 eve::DiagnosticCode::Conflict, "animation Tween child already consumed this tick"));
526 }
527 for (SpriteAnim *a : spriteAnims_) {
528 if (a && a->isPlaying() && a->hasCurrentTick() && step.tick <= a->currentTick())
530 eve::DiagnosticCode::Conflict, "animation SpriteAnim child already consumed this tick"));
531 }
532 for (SpineAnim *a : spineAnims_) {
533 if (a && a->isPlaying() && a->hasCurrentTick() && step.tick <= a->currentTick())
535 eve::DiagnosticCode::Conflict, "animation SpineAnim child already consumed this tick"));
536 }
537 if (motions_.hasCurrentTick() && step.tick <= motions_.currentTick())
539 eve::DiagnosticCode::Conflict, "animation MotionRuntime already consumed this tick"));
540
541 // Copy pointer lists: destructors during update must not invalidate iteration.
542 std::vector<Tween *> tweenSnap = tweens_;
543 for (Tween *t : tweenSnap) {
544 if (!t) continue;
545 if (t->isActive()) {
546 auto result = t->advance(step);
547 if (!result) return eve::Result<void>::failure(result.status());
548 }
549 }
550 std::vector<SpriteAnim *> spriteSnap = spriteAnims_;
551 for (SpriteAnim *a : spriteSnap) {
552 if (a && a->isPlaying()) {
553 auto result = a->advance(step);
554 if (!result) return eve::Result<void>::failure(result.status());
555 }
556 }
557 std::vector<SpineAnim *> spineSnap = spineAnims_;
558 for (SpineAnim *a : spineSnap) {
559 if (a && a->isPlaying()) {
560 auto result = a->advance(step);
561 if (!result) return eve::Result<void>::failure(result.status());
562 }
563 }
564
565 {
566 auto result = motions_.advance(step);
567 if (!result) return eve::Result<void>::failure(result.status());
568 }
569
570 lastTick_ = step.tick;
571 hasLastTick_ = true;
573}
574
575void Animation::update(float dt) {
576 EV_PROFILE_MODULE("animation", "Animation::update");
578 if (!duration) {
579 duration.ignore("legacy animation update received an invalid duration");
580 return;
581 }
582 auto nextTick = hasLastTick_ ? lastTick_.incremented() : std::optional<eve::SimulationTick>(eve::SimulationTick(1));
583 if (!nextTick) {
585 eve::Diagnostic::error(eve::DiagnosticCode::InvariantViolation, "animation simulation tick overflow"))
586 .ignore("legacy animation update tick overflow");
587 return;
588 }
589 advance({*nextTick, std::move(duration).takeValue()}).ignore("legacy animation update facade");
590}
591
593 int n = motions_.activeCount();
594 for (const Tween *t : tweens_) {
595 if (t && t->isActive()) ++n;
596 }
597 for (const SpriteAnim *a : spriteAnims_) {
598 if (a && a->isPlaying()) ++n;
599 }
600 for (const SpineAnim *a : spineAnims_) {
601 if (a && a->isPlaying()) ++n;
602 }
603 return n;
604}
605
607 auto it = tweens_.begin();
608 while (it != tweens_.end()) {
609 Tween *t = *it;
610 if (!t || t->isFinished() || t->isStopped()) {
611 if (t && t->owner() == this) t->setOwner(nullptr);
612 it = tweens_.erase(it);
613 } else {
614 ++it;
615 }
616 }
617}
618
620 for (Tween *t : tweens_) {
621 if (t && t->owner() == this) t->setOwner(nullptr);
622 }
623 tweens_.clear();
624}
625
626void Animation::expose(ssq::Table &table) {
627 auto cls = table.addClass(name, Animation::create, false);
628 expose(cls);
630
631 auto tw = table.addClass<Tween>(
632 "Tween", std::function<Tween *()>([]() -> Tween * { return nullptr; }), true);
633 tw.addFunc("setFrom", &Tween::setFrom);
634 tw.addFunc("setTo", &Tween::setTo);
635 tw.addFunc("setDelta", &Tween::setDelta);
636 tw.addFunc("setFromAngle", &Tween::setFromAngle);
637 tw.addFunc("setToAngle", &Tween::setToAngle);
638 tw.addFunc("setDeltaAngle", &Tween::setDeltaAngle);
639 tw.addFunc("has", &Tween::has);
640 tw.addFunc("get", &Tween::get);
641 tw.addFunc("getFrom", &Tween::getFrom);
642 tw.addFunc("getTo", &Tween::getTo);
643 tw.addFunc("getDelta", &Tween::getDelta);
644 tw.addFunc("setDuration", &Tween::setDuration);
645 tw.addFunc("getDuration", &Tween::getDuration);
646 tw.addFunc("setDelay", &Tween::setDelay);
647 tw.addFunc("getDelay", &Tween::getDelay);
648 tw.addFunc("setEase", &Tween::setEase);
649 tw.addFunc("getEase", &Tween::getEase);
650 tw.addFunc("setRepeat", &Tween::setRepeat);
651 tw.addFunc("getRepeat", &Tween::getRepeat);
652 tw.addFunc("setYoyo", &Tween::setYoyo);
653 tw.addFunc("getYoyo", &Tween::getYoyo);
654 tw.addFunc("start", &Tween::start);
655 tw.addFunc("pause", &Tween::pause);
656 tw.addFunc("resume", &Tween::resume);
657 tw.addFunc("stop", &Tween::stop);
658 tw.addFunc("reset", &Tween::reset);
659 tw.addFunc("isRunning", &Tween::isRunning);
660 tw.addFunc("isPaused", &Tween::isPaused);
661 tw.addFunc("isFinished", &Tween::isFinished);
662 tw.addFunc("isStopped", &Tween::isStopped);
663 tw.addFunc("isDelayed", &Tween::isDelayed);
664 tw.addFunc("isActive", &Tween::isActive);
665 tw.addFunc("getElapsed", &Tween::getElapsed);
666 tw.addFunc("getProgress", &Tween::getProgress);
667 tw.addFunc("getEasedProgress", &Tween::getEasedProgress);
668 tw.addFunc("update", &Tween::update);
669 tw.addFunc("evaluate", &Tween::evaluate);
670 tw.addFunc("getPropertyCount", &Tween::getPropertyCount);
671 tw.addFunc("getPropertyName", &Tween::getPropertyName);
672
673 auto sk = table.addClass<AnimSkeleton>(
674 "AnimSkeleton", std::function<AnimSkeleton *()>([]() -> AnimSkeleton * { return nullptr; }),
675 true);
676 sk.addFunc("addBone", &AnimSkeleton::addBone);
677 sk.addFunc("getBoneCount", &AnimSkeleton::getBoneCount);
678 sk.addFunc("getBoneName", &AnimSkeleton::getBoneName);
679 sk.addFunc("findBone", &AnimSkeleton::findBone);
680 sk.addFunc("getParent", &AnimSkeleton::getParent);
681 sk.addFunc("setBindPosition", &AnimSkeleton::setBindPosition);
682 sk.addFunc("setBindRotation", &AnimSkeleton::setBindRotation);
683 sk.addFunc("setBindScale", &AnimSkeleton::setBindScale);
684 sk.addFunc("setBoneLodLimit", &AnimSkeleton::setBoneLodLimit);
685 sk.addFunc("getBoneLodLimit", &AnimSkeleton::getBoneLodLimit);
686 sk.addFunc("getBindPositionX", &AnimSkeleton::getBindPositionX);
687 sk.addFunc("getBindPositionY", &AnimSkeleton::getBindPositionY);
688 sk.addFunc("getBindPositionZ", &AnimSkeleton::getBindPositionZ);
689 sk.addFunc("getBindRotationX", &AnimSkeleton::getBindRotationX);
690 sk.addFunc("getBindRotationY", &AnimSkeleton::getBindRotationY);
691 sk.addFunc("getBindRotationZ", &AnimSkeleton::getBindRotationZ);
692 sk.addFunc("getBindRotationW", &AnimSkeleton::getBindRotationW);
693 sk.addFunc("getBindScaleX", &AnimSkeleton::getBindScaleX);
694 sk.addFunc("getBindScaleY", &AnimSkeleton::getBindScaleY);
695 sk.addFunc("getBindScaleZ", &AnimSkeleton::getBindScaleZ);
696 sk.addFunc("applyBindPose", &AnimSkeleton::applyBindPose);
697
699
700 auto pose = table.addClass<AnimPose>(
701 "AnimPose", std::function<AnimPose *()>([]() -> AnimPose * { return nullptr; }), true);
702 pose.addFunc("resize", &AnimPose::resize);
703 pose.addFunc("getBoneCount", &AnimPose::getBoneCount);
704 pose.addFunc("copyFrom", &AnimPose::copyFrom);
705 pose.addFunc("blendFrom", &AnimPose::blendFrom);
706 pose.addFunc("setLocalPosition", &AnimPose::setLocalPosition);
707 pose.addFunc("setLocalRotation", &AnimPose::setLocalRotation);
708 pose.addFunc("setLocalScale", &AnimPose::setLocalScale);
709 pose.addFunc("getLocalPositionX", &AnimPose::getLocalPositionX);
710 pose.addFunc("getLocalPositionY", &AnimPose::getLocalPositionY);
711 pose.addFunc("getLocalPositionZ", &AnimPose::getLocalPositionZ);
712 pose.addFunc("getLocalRotationX", &AnimPose::getLocalRotationX);
713 pose.addFunc("getLocalRotationY", &AnimPose::getLocalRotationY);
714 pose.addFunc("getLocalRotationZ", &AnimPose::getLocalRotationZ);
715 pose.addFunc("getLocalRotationW", &AnimPose::getLocalRotationW);
716 pose.addFunc("getLocalScaleX", &AnimPose::getLocalScaleX);
717 pose.addFunc("getLocalScaleY", &AnimPose::getLocalScaleY);
718 pose.addFunc("getLocalScaleZ", &AnimPose::getLocalScaleZ);
719 pose.addFunc("computeWorld", &AnimPose::computeWorld);
720 pose.addFunc("aimBone", &AnimPose::aimBone);
721 pose.addFunc("solveTwoBoneIK", &AnimPose::solveTwoBoneIK);
722 pose.addFunc("getWorldPositionX", &AnimPose::getWorldPositionX);
723 pose.addFunc("getWorldPositionY", &AnimPose::getWorldPositionY);
724 pose.addFunc("getWorldPositionZ", &AnimPose::getWorldPositionZ);
725 pose.addFunc("getWorldRotationX", &AnimPose::getWorldRotationX);
726 pose.addFunc("getWorldRotationY", &AnimPose::getWorldRotationY);
727 pose.addFunc("getWorldRotationZ", &AnimPose::getWorldRotationZ);
728 pose.addFunc("getWorldRotationW", &AnimPose::getWorldRotationW);
729 pose.addFunc("getWorldMatrixElement", &AnimPose::getWorldMatrixElement);
730
731 auto batch = table.addClass<AnimBatch>(
732 "AnimBatch", std::function<AnimBatch *()>([]() -> AnimBatch * { return nullptr; }), true);
733 batch.addFunc("add", &AnimBatch::add);
734 batch.addFunc("clear", &AnimBatch::clear);
735 batch.addFunc("getCount", &AnimBatch::getCount);
736 batch.addFunc("evaluate", &AnimBatch::evaluate);
737 batch.addFunc("getLastWorkerCount", &AnimBatch::getLastWorkerCount);
738
739 auto constraints = table.addClass<AnimConstraintStack>(
740 "AnimConstraintStack", std::function<AnimConstraintStack *()>([]() -> AnimConstraintStack * { return nullptr; }),
741 true);
742 constraints.addFunc("clear", &AnimConstraintStack::clear);
743 constraints.addFunc("getCount", &AnimConstraintStack::getCount);
744 constraints.addFunc("setSkeleton", &AnimConstraintStack::setSkeleton);
745 constraints.addFunc("getSkeleton", &AnimConstraintStack::getSkeleton);
746 constraints.addFunc("addAim", &AnimConstraintStack::addAim);
747 constraints.addFunc("addTwoBoneIK", &AnimConstraintStack::addTwoBoneIK);
748 constraints.addFunc("addFootIK", &AnimConstraintStack::addFootIK);
749 constraints.addFunc("apply", &AnimConstraintStack::apply);
750
751 auto sync = table.addClass<AnimSyncGroup>(
752 "AnimSyncGroup", std::function<AnimSyncGroup *()>([]() -> AnimSyncGroup * { return nullptr; }), true);
753 sync.addFunc("addPlayer", &AnimSyncGroup::addPlayer);
754 sync.addFunc("clear", &AnimSyncGroup::clear);
755 sync.addFunc("getCount", &AnimSyncGroup::getCount);
756 sync.addFunc("setLeader", &AnimSyncGroup::setLeader);
757 sync.addFunc("getLeader", &AnimSyncGroup::getLeader);
758 sync.addFunc("update", &AnimSyncGroup::update);
759 sync.addFunc("getPhase", &AnimSyncGroup::getPhase);
760 sync.addFunc("getUsedMarkerSync", &AnimSyncGroup::getUsedMarkerSync);
761
762 auto skin = table.addClass<AnimSkin>(
763 "AnimSkin", std::function<AnimSkin *()>([]() -> AnimSkin * { return nullptr; }), true);
764 skin.addFunc("getVertexCount", &AnimSkin::getVertexCount);
765 skin.addFunc("getBoneCount", &AnimSkin::getBoneCount);
766 skin.addFunc("getInfluenceCount", &AnimSkin::getInfluenceCount);
767 skin.addFunc("getSkeletonBone", &AnimSkin::getSkeletonBone);
768 skin.addFunc("getSkinBoneName", &AnimSkin::getSkinBoneName);
769 skin.addFunc("getInverseBindElement", &AnimSkin::getInverseBindElement);
770 skin.addFunc("updateMatrixPalette", &AnimSkin::updateMatrixPalette);
771 skin.addFunc("getMatrixPaletteElement", &AnimSkin::getMatrixPaletteElement);
772 skin.addFunc("bindGpuMesh", &AnimSkin::bindGpuMesh);
773 skin.addFunc("updateGpuMesh", &AnimSkin::updateGpuMesh);
774 skin.addFunc("getBindPositionX", &AnimSkin::getBindPositionX);
775 skin.addFunc("getBindPositionY", &AnimSkin::getBindPositionY);
776 skin.addFunc("getBindPositionZ", &AnimSkin::getBindPositionZ);
777 skin.addFunc("getVertexBone", &AnimSkin::getVertexBone);
778 skin.addFunc("getVertexSkinJoint", &AnimSkin::getVertexSkinJoint);
779 skin.addFunc("getVertexWeight", &AnimSkin::getVertexWeight);
780 skin.addFunc("updateSkinnedPositions", &AnimSkin::updateSkinnedPositions);
781 skin.addFunc("hasSkinnedPositions", &AnimSkin::hasSkinnedPositions);
782 skin.addFunc("getSkinnedPositionX", &AnimSkin::getSkinnedPositionX);
783 skin.addFunc("getSkinnedPositionY", &AnimSkin::getSkinnedPositionY);
784 skin.addFunc("getSkinnedPositionZ", &AnimSkin::getSkinnedPositionZ);
785 skin.addFunc("getSkinnedPositions", &AnimSkin::getSkinnedPositions);
786 skin.addFunc("updateSkinnedNormals", &AnimSkin::updateSkinnedNormals);
787 skin.addFunc("hasSkinnedNormals", &AnimSkin::hasSkinnedNormals);
788 skin.addFunc("getSkinnedNormals", &AnimSkin::getSkinnedNormals);
789 skin.addFunc("applyToMesh",
790 std::function<bool(AnimSkin *, graphics::Graphics *,
791 graphics::Mesh *, AnimPose *)>(
793
794 auto lattice = table.addClass<AnimLattice>(
795 "AnimLattice", std::function<AnimLattice *()>([]() -> AnimLattice * { return nullptr; }),
796 true);
797 lattice.addFunc("setDivisions", &AnimLattice::setDivisions);
798 lattice.addFunc("getDivisionsX", &AnimLattice::getDivisionsX);
799 lattice.addFunc("getDivisionsY", &AnimLattice::getDivisionsY);
800 lattice.addFunc("getDivisionsZ", &AnimLattice::getDivisionsZ);
801 lattice.addFunc("setSize", &AnimLattice::setSize);
802 lattice.addFunc("getSizeX", &AnimLattice::getSizeX);
803 lattice.addFunc("getSizeY", &AnimLattice::getSizeY);
804 lattice.addFunc("getSizeZ", &AnimLattice::getSizeZ);
805 lattice.addFunc("setOrigin", &AnimLattice::setOrigin);
806 lattice.addFunc("getOriginX", &AnimLattice::getOriginX);
807 lattice.addFunc("getOriginY", &AnimLattice::getOriginY);
808 lattice.addFunc("getOriginZ", &AnimLattice::getOriginZ);
809 lattice.addFunc("setClamp", &AnimLattice::setClamp);
810 lattice.addFunc("getClamp", &AnimLattice::getClamp);
811 lattice.addFunc("getPointCount", &AnimLattice::getPointCount);
812 lattice.addFunc("setPointScale", &AnimLattice::setPointScale);
813 lattice.addFunc("setPointOffset", &AnimLattice::setPointOffset);
814 lattice.addFunc("setScale", &AnimLattice::setScale);
815 lattice.addFunc("reset", &AnimLattice::reset);
816 lattice.addFunc("getPointScaleX", &AnimLattice::getPointScaleX);
817 lattice.addFunc("getPointScaleY", &AnimLattice::getPointScaleY);
818 lattice.addFunc("getPointScaleZ", &AnimLattice::getPointScaleZ);
819 lattice.addFunc("getPointOffsetX", &AnimLattice::getPointOffsetX);
820 lattice.addFunc("getPointOffsetY", &AnimLattice::getPointOffsetY);
821 lattice.addFunc("getPointOffsetZ", &AnimLattice::getPointOffsetZ);
822 lattice.addFunc("bindModel", &AnimLattice::bindModel);
823 lattice.addFunc("bindPositionsFromArray",
824 std::function<void(AnimLattice *, ssq::Array)>(bindPositionsFromArray));
825 lattice.addFunc("clearBind", &AnimLattice::clearBind);
826 lattice.addFunc("getVertexCount", &AnimLattice::getVertexCount);
827 lattice.addFunc("getBindPositionX", &AnimLattice::getBindPositionX);
828 lattice.addFunc("getBindPositionY", &AnimLattice::getBindPositionY);
829 lattice.addFunc("getBindPositionZ", &AnimLattice::getBindPositionZ);
830 lattice.addFunc(
831 "updateDeformedPositions",
832 static_cast<bool (AnimLattice::*)()>(&AnimLattice::updateDeformedPositions));
833 lattice.addFunc(
834 "updateDeformedPositionsFromArray",
835 std::function<bool(AnimLattice *, ssq::Array)>(updateDeformedPositionsFromArray));
836 lattice.addFunc(
837 "updateDeformedNormalsFromArray",
838 std::function<bool(AnimLattice *, ssq::Array, ssq::Array)>(
839 updateDeformedNormalsFromArray));
840 lattice.addFunc("hasDeformedPositions", &AnimLattice::hasDeformedPositions);
841 lattice.addFunc("hasDeformedNormals", &AnimLattice::hasDeformedNormals);
842 lattice.addFunc("getDeformedPositionX", &AnimLattice::getDeformedPositionX);
843 lattice.addFunc("getDeformedPositionY", &AnimLattice::getDeformedPositionY);
844 lattice.addFunc("getDeformedPositionZ", &AnimLattice::getDeformedPositionZ);
845 lattice.addFunc("getDeformedPositions", &AnimLattice::getDeformedPositions);
846 lattice.addFunc("getDeformedNormals", &AnimLattice::getDeformedNormals);
847
850
851 auto graph = table.addClass<AnimGraph>(
852 "AnimGraph", std::function<AnimGraph *()>([]() -> AnimGraph * { return nullptr; }), true);
853 graph.addFunc("addClip", &AnimGraph::addClip);
854 graph.addFunc("addBlend", &AnimGraph::addBlend);
855 graph.addFunc("addAdditive", &AnimGraph::addAdditive);
856 graph.addFunc("addLayer", &AnimGraph::addLayer);
857 graph.addFunc("addOneShot", &AnimGraph::addOneShot);
858 graph.addFunc("addBlendSpace1D", &AnimGraph::addBlendSpace1D);
859 graph.addFunc("addBlendSpace2D", &AnimGraph::addBlendSpace2D);
860 graph.addFunc("addBlendSpace1DPoint", &AnimGraph::addBlendSpace1DPoint);
861 graph.addFunc("addBlendSpace2DPoint", &AnimGraph::addBlendSpace2DPoint);
862 graph.addFunc("setBoneMask", &AnimGraph::setBoneMask);
863 graph.addFunc("clearBoneMask", &AnimGraph::clearBoneMask);
864 graph.addFunc("setRoot", &AnimGraph::setRoot);
865 graph.addFunc("getRoot", &AnimGraph::getRoot);
866 graph.addFunc("getNodeCount", &AnimGraph::getNodeCount);
867 graph.addFunc("setWeight", &AnimGraph::setWeight);
868 graph.addFunc("setPosition1D", &AnimGraph::setPosition1D);
869 graph.addFunc("setPosition2D", &AnimGraph::setPosition2D);
870 graph.addFunc("setSpeed", &AnimGraph::setSpeed);
871 graph.addFunc("trigger", &AnimGraph::trigger);
872 graph.addFunc("isOneShotActive", &AnimGraph::isOneShotActive);
873 graph.addFunc("setAdditiveReference", &AnimGraph::setAdditiveReferenceCompat);
874 graph.addFunc("getAdditiveReference", &AnimGraph::getAdditiveReference);
875 graph.addFunc("getPose", &AnimGraph::getPose);
876 graph.addFunc("update", &AnimGraph::update);
877
878 auto mask = table.addClass<AnimBoneMask>(
879 "AnimBoneMask", std::function<AnimBoneMask*()>([]() -> AnimBoneMask* { return nullptr; }), true);
880 mask.addFunc("setAll", &AnimBoneMask::setAll);
881 mask.addFunc("setBoneWeight", &AnimBoneMask::setBoneWeight);
882 mask.addFunc("setBoneWeightByName", &AnimBoneMask::setBoneWeightByName);
883 mask.addFunc("setBoneAndChildren", &AnimBoneMask::setBoneAndChildren);
884 mask.addFunc("getBoneWeight", &AnimBoneMask::getBoneWeight);
885 mask.addFunc("getBoneCount", &AnimBoneMask::getBoneCount);
886
887 auto mixer = table.addClass<AnimLayerMixer>(
888 "AnimLayerMixer", std::function<AnimLayerMixer*()>([]() -> AnimLayerMixer* { return nullptr; }), true);
889 mixer.addFunc("setBasePlayer", &AnimLayerMixer::setBasePlayer);
890 mixer.addFunc("setBaseGraph", &AnimLayerMixer::setBaseGraph);
891 mixer.addFunc("setBaseStateMachine", &AnimLayerMixer::setBaseStateMachine);
892 mixer.addFunc("getBasePlayer", &AnimLayerMixer::getBasePlayer);
893 mixer.addFunc("addLayer", &AnimLayerMixer::addLayer);
894 mixer.addFunc("addGraphLayer", &AnimLayerMixer::addGraphLayer);
895 mixer.addFunc("addStateMachineLayer", &AnimLayerMixer::addStateMachineLayer);
896 mixer.addFunc("removeLayer", &AnimLayerMixer::removeLayer);
897 mixer.addFunc("setLayerWeight", &AnimLayerMixer::setLayerWeight);
898 mixer.addFunc("setLayerEnabled", &AnimLayerMixer::setLayerEnabled);
899 mixer.addFunc("setLayerAdditiveReference", &AnimLayerMixer::setLayerAdditiveReferenceCompat);
900 mixer.addFunc("getLayerCount", &AnimLayerMixer::getLayerCount);
901 mixer.addFunc("getLayerName", &AnimLayerMixer::getLayerName);
902 mixer.addFunc("getLayerWeight", &AnimLayerMixer::getLayerWeight);
903 mixer.addFunc("getLayerEnabled", &AnimLayerMixer::getLayerEnabled);
904 mixer.addFunc("getLayerMode", &AnimLayerMixer::getLayerMode);
905 mixer.addFunc("getLayerAdditiveReference", &AnimLayerMixer::getLayerAdditiveReference);
906 mixer.addFunc("update", &AnimLayerMixer::update);
907 mixer.addFunc("getPose", &AnimLayerMixer::getPose);
908 mixer.addFunc("getEventCount", &AnimLayerMixer::getEventCount);
909 mixer.addFunc("getEventLayer", &AnimLayerMixer::getEventLayer);
910 mixer.addFunc("getEventName", &AnimLayerMixer::getEventName);
911 mixer.addFunc("getEventPayload", &AnimLayerMixer::getEventPayload);
912 mixer.addFunc("clearEvents", &AnimLayerMixer::clearEvents);
913
914 auto sm = table.addClass<AnimStateMachine>(
915 "AnimStateMachine",
916 std::function<AnimStateMachine *()>([]() -> AnimStateMachine * { return nullptr; }), true);
917 sm.addFunc("addState", &AnimStateMachine::addState);
918 sm.addFunc("setEntry", &AnimStateMachine::setEntry);
919 sm.addFunc("hasState", &AnimStateMachine::hasState);
920 sm.addFunc("getCurrentState", &AnimStateMachine::getCurrentState);
921 sm.addFunc("getStateCount", &AnimStateMachine::getStateCount);
922 sm.addFunc("addTransition", &AnimStateMachine::addTransition);
923 sm.addFunc("addFloatCondition", &AnimStateMachine::addFloatCondition);
924 sm.addFunc("addBoolCondition", &AnimStateMachine::addBoolCondition);
925 sm.addFunc("addTriggerCondition", &AnimStateMachine::addTriggerCondition);
926 sm.addFunc("setExitTime", &AnimStateMachine::setExitTime);
927 sm.addFunc("setHasExitTime", &AnimStateMachine::setHasExitTime);
928 sm.addFunc("setFloat", &AnimStateMachine::setFloat);
929 sm.addFunc("getFloat", &AnimStateMachine::getFloat);
930 sm.addFunc("setBool", &AnimStateMachine::setBool);
931 sm.addFunc("getBool", &AnimStateMachine::getBool);
932 sm.addFunc("setTrigger", &AnimStateMachine::setTrigger);
933 sm.addFunc("resetTrigger", &AnimStateMachine::resetTrigger);
934 sm.addFunc("getPose", &AnimStateMachine::getPose);
935 sm.addFunc("getStateTime", &AnimStateMachine::getStateTime);
936 sm.addFunc("isBlending", &AnimStateMachine::isBlending);
937 sm.addFunc("update", &AnimStateMachine::update);
938
940
941 auto ca = table.addClass<ControlAnim>(
942 "ControlAnim", std::function<ControlAnim *()>([]() -> ControlAnim * { return nullptr; }),
943 true);
944 ca.addFunc("setFrequency", &ControlAnim::setFrequency);
945 ca.addFunc("getFrequency", &ControlAnim::getFrequency);
946 ca.addFunc("setDamping", &ControlAnim::setDamping);
947 ca.addFunc("getDamping", &ControlAnim::getDamping);
948 ca.addFunc("setResponse", &ControlAnim::setResponse);
949 ca.addFunc("getResponse", &ControlAnim::getResponse);
950 ca.addFunc("setIntegrator", &ControlAnim::setIntegrator);
951 ca.addFunc("getIntegrator", &ControlAnim::getIntegrator);
952 ca.addFunc("set", &ControlAnim::set);
953 ca.addFunc("setTarget", &ControlAnim::setTarget);
954 ca.addFunc("setTargetVelocity", &ControlAnim::setTargetVelocity);
955 ca.addFunc("impulse", &ControlAnim::impulse);
956 ca.addFunc("has", &ControlAnim::has);
957 ca.addFunc("get", &ControlAnim::get);
958 ca.addFunc("getVelocity", &ControlAnim::getVelocity);
959 ca.addFunc("getTarget", &ControlAnim::getTarget);
960 ca.addFunc("clear", &ControlAnim::clear);
961 ca.addFunc("remove", &ControlAnim::remove);
962 ca.addFunc("getPropertyCount", &ControlAnim::getPropertyCount);
963 ca.addFunc("getPropertyName", &ControlAnim::getPropertyName);
964 ca.addFunc("update", &ControlAnim::update);
965
966 auto cp = table.addClass<ControlPose>(
967 "ControlPose", std::function<ControlPose *()>([]() -> ControlPose * { return nullptr; }),
968 true);
969 cp.addFunc("setFrequency", &ControlPose::setFrequency);
970 cp.addFunc("getFrequency", &ControlPose::getFrequency);
971 cp.addFunc("setDamping", &ControlPose::setDamping);
972 cp.addFunc("getDamping", &ControlPose::getDamping);
973 cp.addFunc("setResponse", &ControlPose::setResponse);
974 cp.addFunc("getResponse", &ControlPose::getResponse);
975 cp.addFunc("setIntegrator", &ControlPose::setIntegrator);
976 cp.addFunc("getIntegrator", &ControlPose::getIntegrator);
977 cp.addFunc("setBoneWeight", &ControlPose::setBoneWeight);
978 cp.addFunc("getBoneWeight", &ControlPose::getBoneWeight);
979 cp.addFunc("setTargetPose", &ControlPose::setTargetPose);
980 cp.addFunc("snapToTarget", &ControlPose::snapToTarget);
981 cp.addFunc("getPose", &ControlPose::getPose);
982 cp.addFunc("getTargetPose", &ControlPose::getTargetPose);
983 cp.addFunc("update", &ControlPose::update);
984
985 auto solver = table.addClass<DynamicBoneSolver>(
986 "DynamicBoneSolver",
987 std::function<DynamicBoneSolver *()>([]() -> DynamicBoneSolver * { return nullptr; }), true);
988 solver.addFunc("addChain", &DynamicBoneSolver::addChain);
989 solver.addFunc("addChainByName", &DynamicBoneSolver::addChainByName);
990 solver.addFunc("getChainCount", &DynamicBoneSolver::getChainCount);
991 solver.addFunc("clearChains", &DynamicBoneSolver::clearChains);
992 solver.addFunc("setChainEnabled", &DynamicBoneSolver::setChainEnabled);
993 solver.addFunc("isChainEnabled", &DynamicBoneSolver::isChainEnabled);
994 solver.addFunc("setChainFreezeAxis", &DynamicBoneSolver::setChainFreezeAxis);
995 solver.addFunc("setChainSelfCollision", &DynamicBoneSolver::setChainSelfCollision);
996 solver.addFunc("setChainParticleParameters", &DynamicBoneSolver::setChainParticleParameters);
997 solver.addFunc("setChainEndLength", &DynamicBoneSolver::setChainEndLength);
998 solver.addFunc("setChainEndOffset", &DynamicBoneSolver::setChainEndOffset);
999 solver.addFunc("clearChainEnd", &DynamicBoneSolver::clearChainEnd);
1000 solver.addFunc("setGlobalGravity", &DynamicBoneSolver::setGlobalGravity);
1001 solver.addFunc("setExternalForce", &DynamicBoneSolver::setExternalForce);
1002 solver.addFunc("getGlobalGravityX", &DynamicBoneSolver::getGlobalGravityX);
1003 solver.addFunc("getGlobalGravityY", &DynamicBoneSolver::getGlobalGravityY);
1004 solver.addFunc("getGlobalGravityZ", &DynamicBoneSolver::getGlobalGravityZ);
1005 solver.addFunc("setWeight", &DynamicBoneSolver::setWeight);
1006 solver.addFunc("getWeight", &DynamicBoneSolver::getWeight);
1007 solver.addFunc("setUpdateRate", &DynamicBoneSolver::setUpdateRate);
1008 solver.addFunc("getUpdateRate", &DynamicBoneSolver::getUpdateRate);
1009 solver.addFunc("setTeleportThreshold", &DynamicBoneSolver::setTeleportThreshold);
1010 solver.addFunc("getTeleportThreshold", &DynamicBoneSolver::getTeleportThreshold);
1011 solver.addFunc("setObjectMoveResponse", &DynamicBoneSolver::setObjectMoveResponse);
1012 solver.addFunc("getObjectMoveResponse", &DynamicBoneSolver::getObjectMoveResponse);
1013 solver.addFunc("setDistanceReference", &DynamicBoneSolver::setDistanceReference);
1014 solver.addFunc("setDistanceLimit", &DynamicBoneSolver::setDistanceLimit);
1015 solver.addFunc("isChainSleeping", &DynamicBoneSolver::isChainSleeping);
1016 solver.addFunc("addColliderSphere", &DynamicBoneSolver::addColliderSphere);
1017 solver.addFunc("addBoneColliderSphere", &DynamicBoneSolver::addBoneColliderSphere);
1018 solver.addFunc("addColliderCapsule", &DynamicBoneSolver::addColliderCapsule);
1019 solver.addFunc("addBoneColliderCapsule", &DynamicBoneSolver::addBoneColliderCapsule);
1020 solver.addFunc("clearColliders", &DynamicBoneSolver::clearColliders);
1021 solver.addFunc("getColliderCount", &DynamicBoneSolver::getColliderCount);
1022 solver.addFunc("removeCollider", &DynamicBoneSolver::removeCollider);
1023 solver.addFunc("setColliderEnabled", &DynamicBoneSolver::setColliderEnabled);
1024 solver.addFunc("setColliderInside", &DynamicBoneSolver::setColliderInside);
1025 solver.addFunc("setColliderRadius", &DynamicBoneSolver::setColliderRadius);
1026 solver.addFunc("reset", &DynamicBoneSolver::reset);
1027 solver.addFunc("update", &DynamicBoneSolver::update);
1028 auto footIK = table.addClass<FootIKSolver>(
1029 "FootIKSolver", std::function<FootIKSolver *()>([]() -> FootIKSolver * { return nullptr; }), true);
1030 footIK.addFunc("setSkeleton", &FootIKSolver::setSkeleton);
1031 footIK.addFunc("getSkeleton", &FootIKSolver::getSkeleton);
1032 footIK.addFunc("setPelvisBone", &FootIKSolver::setPelvisBone);
1033 footIK.addFunc("configureLeftLeg", &FootIKSolver::configureLeftLeg);
1034 footIK.addFunc("configureRightLeg", &FootIKSolver::configureRightLeg);
1035 footIK.addFunc("configureLeftToe", &FootIKSolver::configureLeftToe);
1036 footIK.addFunc("configureRightToe", &FootIKSolver::configureRightToe);
1037 footIK.addFunc("setGroundQuery", &FootIKSolver::setGroundQuery);
1038 footIK.addFunc("setLeftContact", &FootIKSolver::setLeftContact);
1039 footIK.addFunc("setRightContact", &FootIKSolver::setRightContact);
1040 footIK.addFunc("setMaxPelvisOffset", &FootIKSolver::setMaxPelvisOffset);
1041 footIK.addFunc("setMinGroundNormalY", &FootIKSolver::setMinGroundNormalY);
1042 footIK.addFunc("setPositionResponse", &FootIKSolver::setPositionResponse);
1043 footIK.addFunc("setRotationResponse", &FootIKSolver::setRotationResponse);
1044 footIK.addFunc("setContactGraceTime", &FootIKSolver::setContactGraceTime);
1045 footIK.addFunc("setFootLockEnabled", &FootIKSolver::setFootLockEnabled);
1046 footIK.addFunc("setFootLockThresholds", &FootIKSolver::setFootLockThresholds);
1047 footIK.addFunc("isLeftFootLocked", &FootIKSolver::isLeftFootLocked);
1048 footIK.addFunc("isRightFootLocked", &FootIKSolver::isRightFootLocked);
1049 footIK.addFunc("reset", &FootIKSolver::reset);
1050 footIK.addFunc("apply", &FootIKSolver::apply);
1051
1052 auto trail = table.addClass<AnimTrail>(
1053 "AnimTrail", std::function<AnimTrail *()>([]() -> AnimTrail * { return nullptr; }), true);
1054 trail.addFunc("setCapacity", &AnimTrail::setCapacity);
1055 trail.addFunc("getCapacity", &AnimTrail::getCapacity);
1056 trail.addFunc("setDuration", &AnimTrail::setDuration);
1057 trail.addFunc("getDuration", &AnimTrail::getDuration);
1058 trail.addFunc("setMinDistance", &AnimTrail::setMinDistance);
1059 trail.addFunc("getMinDistance", &AnimTrail::getMinDistance);
1060 trail.addFunc("setWidth", &AnimTrail::setWidth);
1061 trail.addFunc("getWidth", &AnimTrail::getWidth);
1062 trail.addFunc("setColor", &AnimTrail::setColor);
1063 trail.addFunc("getColorR", &AnimTrail::getColorR);
1064 trail.addFunc("getColorG", &AnimTrail::getColorG);
1065 trail.addFunc("getColorB", &AnimTrail::getColorB);
1066 trail.addFunc("getColorA", &AnimTrail::getColorA);
1067 trail.addFunc("setFade", &AnimTrail::setFade);
1068 trail.addFunc("getFade", &AnimTrail::getFade);
1069 trail.addFunc("setStyle", &AnimTrail::setStyle);
1070 trail.addFunc("getStyle", &AnimTrail::getStyle);
1071 trail.addFunc("setDrawScale", &AnimTrail::setDrawScale);
1072 trail.addFunc("getDrawScaleX", &AnimTrail::getDrawScaleX);
1073 trail.addFunc("getDrawScaleY", &AnimTrail::getDrawScaleY);
1074 trail.addFunc("setDrawOffset", &AnimTrail::setDrawOffset);
1075 trail.addFunc("getDrawOffsetX", &AnimTrail::getDrawOffsetX);
1076 trail.addFunc("getDrawOffsetY", &AnimTrail::getDrawOffsetY);
1077 trail.addFunc("addPoint", &AnimTrail::addPoint);
1078 trail.addFunc("addPoint3", &AnimTrail::addPoint3);
1079 trail.addFunc("sampleBone", &AnimTrail::sampleBone);
1080 trail.addFunc("sampleBoneOffset", &AnimTrail::sampleBoneOffset);
1081 trail.addFunc("clear", &AnimTrail::clear);
1082 trail.addFunc("update", &AnimTrail::update);
1083 trail.addFunc("getPointCount", &AnimTrail::getPointCount);
1084 trail.addFunc("getPointX", &AnimTrail::getPointX);
1085 trail.addFunc("getPointY", &AnimTrail::getPointY);
1086 trail.addFunc("getPointZ", &AnimTrail::getPointZ);
1087 trail.addFunc("getPointAge", &AnimTrail::getPointAge);
1088 trail.addFunc("getPointAlpha", &AnimTrail::getPointAlpha);
1089 trail.addFunc("draw", &AnimTrail::draw);
1090
1091 auto sheet = table.addClass<SpriteSheet>(
1092 "SpriteSheet", std::function<SpriteSheet *()>([]() -> SpriteSheet * { return nullptr; }),
1093 true);
1094 sheet.addFunc("addFrame", &SpriteSheet::addFrame);
1095 sheet.addFunc("setGrid", &SpriteSheet::setGrid);
1096 sheet.addFunc("clear", &SpriteSheet::clear);
1097 sheet.addFunc("setTexture", &SpriteSheet::setTexture);
1098 sheet.addFunc("getTexture", &SpriteSheet::getTexture);
1099 sheet.addFunc("getFrameCount", &SpriteSheet::getFrameCount);
1100 sheet.addFunc("findFrame", &SpriteSheet::findFrame);
1101 sheet.addFunc("getFrameName", &SpriteSheet::getFrameName);
1102 sheet.addFunc("getFrameX", &SpriteSheet::getFrameX);
1103 sheet.addFunc("getFrameY", &SpriteSheet::getFrameY);
1104 sheet.addFunc("getFrameWidth", &SpriteSheet::getFrameWidth);
1105 sheet.addFunc("getFrameHeight", &SpriteSheet::getFrameHeight);
1106 sheet.addFunc("getFrameSourceWidth", &SpriteSheet::getFrameSourceWidth);
1107 sheet.addFunc("getFrameSourceHeight", &SpriteSheet::getFrameSourceHeight);
1108 sheet.addFunc("getFrameOffsetX", &SpriteSheet::getFrameOffsetX);
1109 sheet.addFunc("getFrameOffsetY", &SpriteSheet::getFrameOffsetY);
1110 sheet.addFunc("applyToQuad", &SpriteSheet::applyToQuad);
1111
1112 auto sclip = table.addClass<SpriteClip>(
1113 "SpriteClip", std::function<SpriteClip *()>([]() -> SpriteClip * { return nullptr; }),
1114 true);
1115 sclip.addFunc("setName", &SpriteClip::setName);
1116 sclip.addFunc("getName", &SpriteClip::getName);
1117 sclip.addFunc("setLoop", &SpriteClip::setLoop);
1118 sclip.addFunc("getLoop", &SpriteClip::getLoop);
1119 sclip.addFunc("addFrame", &SpriteClip::addFrame);
1120 sclip.addFunc("addFrameByName", &SpriteClip::addFrameByName);
1121 sclip.addFunc("addRange", &SpriteClip::addRange);
1122 sclip.addFunc("setFPS", &SpriteClip::setFPS);
1123 sclip.addFunc("getFPS", &SpriteClip::getFPS);
1124 sclip.addFunc("addEvent", &SpriteClip::addEvent);
1125 sclip.addFunc("getEvent", &SpriteClip::getEvent);
1126 sclip.addFunc("clear", &SpriteClip::clear);
1127 sclip.addFunc("getFrameCount", &SpriteClip::getFrameCount);
1128 sclip.addFunc("getSheetFrame", &SpriteClip::getSheetFrame);
1129 sclip.addFunc("getFrameDuration", &SpriteClip::getFrameDuration);
1130 sclip.addFunc("getDuration", &SpriteClip::getDuration);
1131 sclip.addFunc("frameAtTime", &SpriteClip::frameAtTime);
1132 sclip.addFunc("wrapTime", &SpriteClip::wrapTime);
1133
1134 auto sanim = table.addClass<SpriteAnim>(
1135 "SpriteAnim", std::function<SpriteAnim *()>([]() -> SpriteAnim * { return nullptr; }),
1136 true);
1137 sanim.addFunc("setSheet", &SpriteAnim::setSheet);
1138 sanim.addFunc("getSheet", &SpriteAnim::getSheet);
1139 sanim.addFunc("play", &SpriteAnim::play);
1140 sanim.addFunc("playReverse", &SpriteAnim::playReverse);
1141 sanim.addFunc("stop", &SpriteAnim::stop);
1142 sanim.addFunc("pause", &SpriteAnim::pause);
1143 sanim.addFunc("resume", &SpriteAnim::resume);
1144 sanim.addFunc("setSpeed", &SpriteAnim::setSpeed);
1145 sanim.addFunc("getSpeed", &SpriteAnim::getSpeed);
1146 sanim.addFunc("addSpeedCurveKey", &SpriteAnim::addSpeedCurveKey);
1147 sanim.addFunc("clearSpeedCurve", &SpriteAnim::clearSpeedCurve);
1148 sanim.addFunc("resetSpeedCurve", &SpriteAnim::resetSpeedCurve);
1149 sanim.addFunc("setSpeedCurveLoop", &SpriteAnim::setSpeedCurveLoop);
1150 sanim.addFunc("setSpeedCurveInterpolation", &SpriteAnim::setSpeedCurveInterpolation);
1151 sanim.addFunc("getSpeedCurveValue", &SpriteAnim::getSpeedCurveValue);
1152 sanim.addFunc("setFrame", &SpriteAnim::setFrame);
1153 sanim.addFunc("step", &SpriteAnim::step);
1154 sanim.addFunc("playOnce", &SpriteAnim::playOnce);
1155 sanim.addFunc("queue", &SpriteAnim::queue);
1156 sanim.addFunc("consumeEvent", &SpriteAnim::consumeEvent);
1157 sanim.addFunc("setTime", &SpriteAnim::setTime);
1158 sanim.addFunc("getTime", &SpriteAnim::getTime);
1159 sanim.addFunc("setLoop", &SpriteAnim::setLoop);
1160 sanim.addFunc("getLoop", &SpriteAnim::getLoop);
1161 sanim.addFunc("isPlaying", &SpriteAnim::isPlaying);
1162 sanim.addFunc("isPaused", &SpriteAnim::isPaused);
1163 sanim.addFunc("isFinished", &SpriteAnim::isFinished);
1164 sanim.addFunc("getLoopCount", &SpriteAnim::getLoopCount);
1165 sanim.addFunc("consumeCompleted", &SpriteAnim::consumeCompleted);
1166 sanim.addFunc("consumeLooped", &SpriteAnim::consumeLooped);
1167 sanim.addFunc("getClip", &SpriteAnim::getClip);
1168 sanim.addFunc("getClipFrame", &SpriteAnim::getClipFrame);
1169 sanim.addFunc("getSheetFrame", &SpriteAnim::getSheetFrame);
1170 sanim.addFunc("bindQuad", &SpriteAnim::bindQuad);
1171 sanim.addFunc("unbindQuad", &SpriteAnim::unbindQuad);
1172 sanim.addFunc("getBoundQuad", &SpriteAnim::getBoundQuad);
1173 sanim.addFunc("bindSprite", &SpriteAnim::bindSprite);
1174 sanim.addFunc("applyToQuad", &SpriteAnim::applyToQuad);
1175 sanim.addFunc("update", &SpriteAnim::update);
1176
1177 auto satlas = table.addClass<SpineAtlas>(
1178 "SpineAtlas", std::function<SpineAtlas *()>([]() -> SpineAtlas * { return nullptr; }),
1179 true);
1180 satlas.addFunc("loadFromText",
1181 [](SpineAtlas *self, const std::string &text) -> bool {
1182 return self->loadFromText(text, nullptr);
1183 });
1184 satlas.addFunc("loadFromFile",
1185 [](SpineAtlas *self, const std::string &path) -> bool {
1186 return self->loadFromFile(path, nullptr);
1187 });
1188 satlas.addFunc("clear", &SpineAtlas::clear);
1189 satlas.addFunc("getPageCount", &SpineAtlas::getPageCount);
1190 satlas.addFunc("getPageName", &SpineAtlas::getPageName);
1191 satlas.addFunc("getPageWidth", &SpineAtlas::getPageWidth);
1192 satlas.addFunc("getPageHeight", &SpineAtlas::getPageHeight);
1193 satlas.addFunc("getRegionCount", &SpineAtlas::getRegionCount);
1194 satlas.addFunc("findRegion", &SpineAtlas::findRegion);
1195 satlas.addFunc("getRegionName", &SpineAtlas::getRegionName);
1196 satlas.addFunc("getRegionPage", &SpineAtlas::getRegionPage);
1197 satlas.addFunc("getRegionX", &SpineAtlas::getRegionX);
1198 satlas.addFunc("getRegionY", &SpineAtlas::getRegionY);
1199 satlas.addFunc("getRegionWidth", &SpineAtlas::getRegionWidth);
1200 satlas.addFunc("getRegionHeight", &SpineAtlas::getRegionHeight);
1201 satlas.addFunc("getRegionRotate", &SpineAtlas::getRegionRotate);
1202
1203 auto sdata = table.addClass<SpineSkeletonData>(
1204 "SpineSkeletonData",
1205 std::function<SpineSkeletonData *()>([]() -> SpineSkeletonData * { return nullptr; }),
1206 true);
1207 sdata.addFunc("loadFromJson",
1208 [](SpineSkeletonData *self, const std::string &json) -> bool {
1209 return self->loadFromJson(json, nullptr);
1210 });
1211 sdata.addFunc("loadFromFile",
1212 [](SpineSkeletonData *self, const std::string &path) -> bool {
1213 return self->loadFromFile(path, nullptr);
1214 });
1215 sdata.addFunc("clear", &SpineSkeletonData::clear);
1216 sdata.addFunc("getSpineVersion", &SpineSkeletonData::getSpineVersion);
1217 sdata.addFunc("getBoneCount", &SpineSkeletonData::getBoneCount);
1218 sdata.addFunc("findBone", &SpineSkeletonData::findBone);
1219 sdata.addFunc("getBoneName", &SpineSkeletonData::getBoneName);
1220 sdata.addFunc("getBoneParent", &SpineSkeletonData::getBoneParent);
1221 sdata.addFunc("getSlotCount", &SpineSkeletonData::getSlotCount);
1222 sdata.addFunc("findSlot", &SpineSkeletonData::findSlot);
1223 sdata.addFunc("getSlotName", &SpineSkeletonData::getSlotName);
1224 sdata.addFunc("getSlotBone", &SpineSkeletonData::getSlotBone);
1225 sdata.addFunc("getSkinCount", &SpineSkeletonData::getSkinCount);
1226 sdata.addFunc("findSkin", &SpineSkeletonData::findSkin);
1227 sdata.addFunc("getSkinName", &SpineSkeletonData::getSkinName);
1228 sdata.addFunc("getAnimationCount", &SpineSkeletonData::getAnimationCount);
1229 sdata.addFunc("findAnimation", &SpineSkeletonData::findAnimation);
1230 sdata.addFunc("getAnimationName", &SpineSkeletonData::getAnimationName);
1231 sdata.addFunc("getAnimationDuration", &SpineSkeletonData::getAnimationDuration);
1232
1233 auto ssk = table.addClass<SpineSkeleton>(
1234 "SpineSkeleton",
1235 std::function<SpineSkeleton *()>([]() -> SpineSkeleton * { return nullptr; }), true);
1236 ssk.addFunc("getData", &SpineSkeleton::getData);
1237 ssk.addFunc("setSkin", &SpineSkeleton::setSkin);
1238 ssk.addFunc("getSkin", &SpineSkeleton::getSkin);
1239 ssk.addFunc("setToSetupPose", &SpineSkeleton::setToSetupPose);
1240 ssk.addFunc("updateWorldTransform", &SpineSkeleton::updateWorldTransform);
1241 ssk.addFunc("getBoneCount", &SpineSkeleton::getBoneCount);
1242 ssk.addFunc("getBoneWorldX", &SpineSkeleton::getBoneWorldX);
1243 ssk.addFunc("getBoneWorldY", &SpineSkeleton::getBoneWorldY);
1244 ssk.addFunc("getBoneWorldRotation", &SpineSkeleton::getBoneWorldRotation);
1245 ssk.addFunc("getSlotCount", &SpineSkeleton::getSlotCount);
1246 ssk.addFunc("getSlotAttachmentName", &SpineSkeleton::getSlotAttachmentName);
1247 ssk.addFunc("setSlotAttachmentName", &SpineSkeleton::setSlotAttachmentName);
1248
1249 auto spanim = table.addClass<SpineAnim>(
1250 "SpineAnim", std::function<SpineAnim *()>([]() -> SpineAnim * { return nullptr; }), true);
1251 spanim.addFunc("getSkeleton", &SpineAnim::getSkeleton);
1252 spanim.addFunc("setAtlas", &SpineAnim::setAtlas);
1253 spanim.addFunc("getAtlas", &SpineAnim::getAtlas);
1254 spanim.addFunc("setPageTexture", &SpineAnim::setPageTexture);
1255 spanim.addFunc("setPageTextureByName", &SpineAnim::setPageTextureByName);
1256 spanim.addFunc("getPageTexture", &SpineAnim::getPageTexture);
1257 spanim.addFunc("play", &SpineAnim::play);
1258 spanim.addFunc("stop", &SpineAnim::stop);
1259 spanim.addFunc("pause", &SpineAnim::pause);
1260 spanim.addFunc("resume", &SpineAnim::resume);
1261 spanim.addFunc("setSpeed", &SpineAnim::setSpeed);
1262 spanim.addFunc("getSpeed", &SpineAnim::getSpeed);
1263 spanim.addFunc("setTime", &SpineAnim::setTime);
1264 spanim.addFunc("getTime", &SpineAnim::getTime);
1265 spanim.addFunc("setLoop", &SpineAnim::setLoop);
1266 spanim.addFunc("getLoop", &SpineAnim::getLoop);
1267 spanim.addFunc("setFlipY", &SpineAnim::setFlipY);
1268 spanim.addFunc("getFlipY", &SpineAnim::getFlipY);
1269 spanim.addFunc("setPosition", &SpineAnim::setPosition);
1270 spanim.addFunc("getX", &SpineAnim::getX);
1271 spanim.addFunc("getY", &SpineAnim::getY);
1272 spanim.addFunc("setScale", &SpineAnim::setScale);
1273 spanim.addFunc("getScaleX", &SpineAnim::getScaleX);
1274 spanim.addFunc("getScaleY", &SpineAnim::getScaleY);
1275 spanim.addFunc("setLayer", &SpineAnim::setLayer);
1276 spanim.addFunc("getLayer", &SpineAnim::getLayer);
1277 spanim.addFunc("setColor", &SpineAnim::setColor);
1278 spanim.addFunc("isPlaying", &SpineAnim::isPlaying);
1279 spanim.addFunc("isPaused", &SpineAnim::isPaused);
1280 spanim.addFunc("isFinished", &SpineAnim::isFinished);
1281 spanim.addFunc("getAnimation", &SpineAnim::getAnimation);
1282 spanim.addFunc("getAnimationDuration", &SpineAnim::getAnimationDuration);
1283 spanim.addFunc("apply", &SpineAnim::apply);
1284 spanim.addFunc("update", &SpineAnim::update);
1285 spanim.addFunc("draw", &SpineAnim::draw);
1286 // collectDrawItems is C++-only (shared DrawItem2D queue); scripts use getDrawSlot*.
1287 spanim.addFunc("getDrawSlotCount", &SpineAnim::getDrawSlotCount);
1288 spanim.addFunc("getDrawSlotX", &SpineAnim::getDrawSlotX);
1289 spanim.addFunc("getDrawSlotY", &SpineAnim::getDrawSlotY);
1290 spanim.addFunc("getDrawSlotWidth", &SpineAnim::getDrawSlotWidth);
1291 spanim.addFunc("getDrawSlotHeight", &SpineAnim::getDrawSlotHeight);
1292 spanim.addFunc("getDrawSlotRotation", &SpineAnim::getDrawSlotRotation);
1293 spanim.addFunc("getDrawSlotRegion", &SpineAnim::getDrawSlotRegion);
1294}
1295
1296void Animation::expose(ssq::Class &cls) {
1297 cls.addFunc("getName", &Animation::getName);
1298 cls.addFunc("newTween", &Animation::newTween);
1299 cls.addFunc("newSpriteSheet", &Animation::newSpriteSheet);
1300 cls.addFunc("newSpriteSheetFromSequence", &Animation::newSpriteSheetFromSequence);
1301 cls.addFunc("newSpriteSheetFromAtlasJson", &Animation::newSpriteSheetFromAtlasJson);
1302 cls.addFunc("getSpriteSequenceCacheCount", &Animation::getSpriteSequenceCacheCount);
1303 cls.addFunc("getSpriteSequenceCacheBytes", &Animation::getSpriteSequenceCacheBytes);
1304 cls.addFunc("clearSpriteSequenceCache", &Animation::clearSpriteSequenceCache);
1305 cls.addFunc("newSpriteClip", &Animation::newSpriteClip);
1306 cls.addFunc("newSpriteAnim", &Animation::newSpriteAnim);
1307 cls.addFunc("newSpineAtlas", &Animation::newSpineAtlas);
1308 cls.addFunc("newSpineSkeletonData", &Animation::newSpineSkeletonData);
1309 cls.addFunc("newSpineSkeleton", &Animation::newSpineSkeleton);
1310 cls.addFunc("newSpineAnim", &Animation::newSpineAnim);
1311 cls.addFunc("newSpineAtlasFromFile", &Animation::newSpineAtlasFromFile);
1312 cls.addFunc("newSpineAtlasFromText", &Animation::newSpineAtlasFromText);
1313 cls.addFunc("newSpineSkeletonDataFromFile", &Animation::newSpineSkeletonDataFromFile);
1314 cls.addFunc("newSpineSkeletonDataFromJson", &Animation::newSpineSkeletonDataFromJson);
1315 cls.addFunc("newSkeleton", &Animation::newSkeleton);
1316 cls.addFunc("newClip", &Animation::newClip);
1317 cls.addFunc("newPose", &Animation::newPose);
1318 cls.addFunc("newBatch", &Animation::newBatch);
1319 cls.addFunc("newConstraintStack", &Animation::newConstraintStack);
1320 cls.addFunc("newDynamicBoneSolver", &Animation::newDynamicBoneSolver);
1321 cls.addFunc("setupHairChain", &Animation::setupHairChain);
1322 cls.addFunc("setupHairHeadCollider", &Animation::setupHairHeadCollider);
1323 cls.addFunc("newFootIKSolver", &Animation::newFootIKSolver);
1324 cls.addFunc("newSyncGroup", &Animation::newSyncGroup);
1325 cls.addFunc("newPlayer", &Animation::newPlayer);
1326 cls.addFunc("newGraph", &Animation::newGraph);
1327 cls.addFunc("newBoneMask", &Animation::newBoneMask);
1328 cls.addFunc("newLayerMixer", &Animation::newLayerMixer);
1329 cls.addFunc("newStateMachine", &Animation::newStateMachine);
1330 cls.addFunc("newMotionDatabase", &Animation::newMotionDatabase);
1331 cls.addFunc("newMotionMatcher", &Animation::newMotionMatcher);
1332 cls.addFunc("newControlAnim", &Animation::newControlAnim);
1333 cls.addFunc("newControlPose", &Animation::newControlPose);
1334 cls.addFunc("newPhysicalBalancePose", &Animation::newPhysicalBalancePose);
1335 cls.addFunc("newSkeletonFromAnimationFixtureText", &Animation::newSkeletonFromAnimationFixtureText);
1336 cls.addFunc("newClipFromAnimationFixtureText", &Animation::newClipFromAnimationFixtureText);
1337 cls.addFunc("newLattice", &Animation::newLattice);
1338#if defined(EVE_ANIMATION_MODEL3D)
1340#endif
1341 cls.addFunc("newTrail", &Animation::newTrail);
1342 cls.addFunc("update", &Animation::update);
1343 cls.addFunc("getTweenCount", &Animation::getTweenCount);
1344 cls.addFunc("getMotionCount", &Animation::getMotionCount);
1345 cls.addFunc("getSpriteAnimCount", &Animation::getSpriteAnimCount);
1346 cls.addFunc("getSpineAnimCount", &Animation::getSpineAnimCount);
1347 cls.addFunc("getActiveCount", &Animation::getActiveCount);
1348 cls.addFunc("clearFinished", &Animation::clearFinished);
1349 cls.addFunc("clearAll", &Animation::clearAll);
1350}
1351
1352} // namespace eve::animation
float w
Definition AnimClip.cpp:738
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float duration
int root
Definition AnimSmr.cpp:119
std::string from
eve::EntitySpatialPose pose
int mask
float py
HSQOBJECT cls
Definition ECS.cpp:21
filesystem::File * file
scene::NodeDesc desc
int rows
std::string pattern
std::uint32_t capacity
glm::vec4 clip
glm::vec3 n
Definition Grass.cpp:63
std::int32_t first
HexCoordinates to
Cell the unit walks towards on this segment.
Definition HexUnits.cpp:64
int h
std::vector< Colorf > px
std::string text
std::uint64_t bytes
std::string name
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:26
Fluent LitMotion-style builder that commits into MotionRuntime.
Dense motion storage advanced by Animation::advance(SimulationStep).
Squirrel GC wrappers for Motion builder / handle / sequence.
Lean LitMotion-style sequence: Append / Join / Insert / AppendInterval.
std::string error
Definition Package.cpp:60
std::map< std::string, std::vector< std::string > > graph
Definition Package.cpp:59
float radius
std::string path
Definition PlayHost.cpp:110
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:140
float t
std::uint32_t count
int columns
float inertia
Definition TreeMesh.cpp:309
float step
Definition TreeMesh.cpp:314
float size
Definition TreeMesh.cpp:156
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result< Duration > fromSeconds(double seconds)
Convert finite seconds to the nearest nanosecond.
Definition Time.cpp:16
EVENGINE_API_FOUNDATION public API.
Definition Exception.h:13
virtual std::string getName() const =0
Returns the name.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:164
void ignore(std::string_view reason={}) const noexcept
Explicitly discard this result after documenting the reason.
Definition Result.h:393
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Parallel batch evaluator for independent character clip poses. Script type: AnimBatch.
Definition AnimBatch.h:13
void evaluate(int workerCount=0)
Evaluate queued poses, using hardware concurrency when workerCount is zero.
Definition AnimBatch.cpp:21
void clear()
Remove all queued jobs without deleting referenced objects.
Definition AnimBatch.h:21
void add(AnimClip *clip, AnimSkeleton *skeleton, AnimPose *pose, float time, int lodLevel=0)
Queue one clip sample. The clip, skeleton and pose must outlive evaluate().
Definition AnimBatch.cpp:14
int getCount() const
Returns the count.
Definition AnimBatch.h:23
int getLastWorkerCount() const
Returns the last worker count.
Definition AnimBatch.h:27
Per-bone weights used by override and additive animation layers.
bool setBoneWeight(int boneIndex, float weight)
Set one bone's clamped weight.
bool setBoneAndChildren(const std::string &boneName, float weight)
Set a bone and all descendants to the same clamped weight.
void setAll(float weight)
Set every bone to the same clamped weight.
bool setBoneWeightByName(const std::string &boneName, float weight)
Set a named bone's clamped weight.
float getBoneWeight(int boneIndex) const
Return one bone's weight, or zero for an invalid index.
int getBoneCount() const
Return the number of bones represented by this mask.
static void registerPath(const std::string &path, AnimClip *clip)
Track a clip under a source path (keys are normalized).
Keyframed skeletal animation clip (local TRS tracks per bone). Script type: AnimClip.
Definition AnimClip.h:145
Ordered main-thread post-process stack with aim, limb IK and foot planting.
void setSkeleton(AnimSkeleton *skeleton)
Rebind the borrowed skeleton; changing it clears old index constraints.
void addAim(int bone, float targetX, float targetY, float targetZ, float weight=1.f)
Append a weighted bone aim constraint.
int getCount() const
Return constraint count.
void clear()
Remove all constraints.
void addFootIK(int hip, int knee, int foot, float groundY, float normalX=0.f, float normalY=1.f, float normalZ=0.f, float soleOffset=0.f, float weight=1.f)
Plant a foot at groundY + soleOffset and orient its local +Z toward the ground normal.
void apply(AnimPose *pose) const
Apply constraints in insertion order and refresh world transforms. Main-thread only.
void addTwoBoneIK(int root, int mid, int tip, float targetX, float targetY, float targetZ, float weight=1.f)
Append a weighted two-bone IK constraint.
AnimSkeleton * getSkeleton() const
Return the borrowed skeleton, or null after explicit unbinding. @ownership Borrowed; ownership remain...
Composable runtime pose graph supporting clips, blends, additive layers, per-bone masks,...
Definition AnimGraph.h:26
int addClip(AnimClip *clip)
Adds clip.
Definition AnimGraph.cpp:40
void setPosition2D(int node, float x, float y)
Sets the position 2 d.
int getRoot() const
Returns the root.
Definition AnimGraph.h:63
int addAdditive(int base, int additive, float weight=1.f)
Adds additive.
Definition AnimGraph.cpp:56
void addBlendSpace2DPoint(int node, float x, float y, int child)
Adds blend space 2 d point.
Definition AnimGraph.cpp:99
void setSpeed(int node, float speed)
Sets the speed.
int addBlendSpace2D()
Adds blend space 2 d.
Definition AnimGraph.cpp:90
void setWeight(int node, float weight)
Sets the weight.
AnimPose * getPose() override
Borrowed pointer accessor. @ownership Borrowed @lifetime Valid while the owning animation object rema...
Definition AnimGraph.h:97
void trigger(int node)
Trigger.
int addBlendSpace1D()
Adds blend space 1 d.
Definition AnimGraph.cpp:89
bool isOneShotActive(int node) const
True when one shot active.
int addBlend(int a, int b, float weight=0.5f)
Adds blend.
Definition AnimGraph.cpp:46
void setBoneMask(int node, int boneIndex, float weight, bool includeChildren=false)
Sets the bone mask.
void clearBoneMask(int node)
Clears bone mask.
int addLayer(int base, int overlay, float weight=1.f)
Adds layer.
Definition AnimGraph.cpp:66
void setPosition1D(int node, float x)
Sets the position 1 d.
int addOneShot(int base, int shot, float fadeIn=0.1f, float fadeOut=0.1f)
Adds one shot.
Definition AnimGraph.cpp:77
void setRoot(int node)
Sets the root.
void addBlendSpace1DPoint(int node, float x, int child)
Adds blend space 1 d point.
Definition AnimGraph.cpp:92
void update(float dt)
Legacy seconds facade; explicitly forwards to advance().
std::string getAdditiveReference(int node) const
Return "bind" / "identity", or empty for non-additive / invalid nodes.
bool setAdditiveReferenceCompat(int node, const std::string &reference)
Compatibility facade over setAdditiveReference.
int getNodeCount() const
Returns the node count.
Definition AnimGraph.h:65
static void importAnimationFixtureTextFile(const std::string &path, AnimSkeleton **skeletonOut, AnimClip **clipOut)
Load from an *.anim.txt fixture path.
CPU 3D lattice scale-deformer (晶格缩放变形).
Definition AnimLattice.h:42
void setDivisions(int divX, int divY, int divZ)
Changes divisions; resets all control points to identity and clears the bind.
float getDeformedPositionX(int vertexIndex) const
Cached deformed position component (requires updateDeformedPositions).
std::vector< float > getDeformedNormals() const
Copy of the cached deformed normals (xyz packed; empty when not updated).
std::vector< float > getDeformedPositions() const
Copy of the cached deformed positions (xyz packed; empty when not updated).
void setPointScale(int ix, int iy, int iz, float sx, float sy, float sz)
Per-control-point scale (squash / stretch about the lattice origin).
float getPointOffsetX(int ix, int iy, int iz) const
Returns the point offset x.
float getSizeZ() const
Returns the size z.
Definition AnimLattice.h:73
bool getClamp() const
Returns the clamp.
Definition AnimLattice.h:90
float getOriginZ() const
Returns the origin z.
Definition AnimLattice.h:82
bool updateDeformedPositions()
Deform the bound bind positions into the internal cache.
int getDivisionsY() const
Returns the divisions y.
Definition AnimLattice.h:62
float getOriginY() const
Returns the origin y.
Definition AnimLattice.h:80
float getBindPositionZ(int vertexIndex) const
Returns the bind position z.
void setOrigin(float ox, float oy, float oz)
Center of the lattice box in model space.
void setClamp(bool clamp)
When true (default), vertices outside the box are clamped to the boundary cells; when false,...
Definition AnimLattice.h:88
void bindModel(const model3d::ModelData *model, int meshIndex)
Binds the current lattice to meshIndex of model (uses current divisions).
bool updateDeformedNormals(const std::vector< float > &posXYZ, const std::vector< float > &inNrmXYZ)
Deform packed xyz normals (with packed positions for cell lookup) into the internal normal cache.
float getPointScaleX(int ix, int iy, int iz) const
Returns the point scale x.
int getDivisionsX() const
Returns the divisions x.
Definition AnimLattice.h:60
float getPointOffsetY(int ix, int iy, int iz) const
Returns the point offset y.
float getDeformedPositionY(int vertexIndex) const
Returns the deformed position y.
int getPointCount() const
Total control point count (divX * divY * divZ).
Definition AnimLattice.h:95
bool updateDeformedPositions(const std::vector< float > &inPosXYZ)
Deform an input packed xyz array into the internal cache (size vertexCount*3).
void clearBind()
Clears bind.
float getSizeY() const
Returns the size y.
Definition AnimLattice.h:71
void setSize(float sx, float sy, float sz)
World-space size of the lattice box (components must be > 0).
float getDeformedPositionZ(int vertexIndex) const
Returns the deformed position z.
void setPointOffset(int ix, int iy, int iz, float dx, float dy, float dz)
Per-control-point translation offset (local bulge / pinch).
float getOriginX() const
Returns the origin x.
Definition AnimLattice.h:78
bool hasDeformedPositions() const
True after a successful updateDeformedPositions().
float getPointScaleY(int ix, int iy, int iz) const
Returns the point scale y.
void setScale(float sx, float sy, float sz)
Applies one scale to every control point (whole-lattice squash & stretch).
int getDivisionsZ() const
Returns the divisions z.
Definition AnimLattice.h:64
int getVertexCount() const
Returns the vertex count.
float getBindPositionX(int vertexIndex) const
Bind-pose position component for vertex v (0..vertexCount-1).
float getSizeX() const
Returns the size x.
Definition AnimLattice.h:69
float getPointOffsetZ(int ix, int iy, int iz) const
Returns the point offset z.
void reset()
Resets every control point to identity (offset 0, scale 1).
bool hasDeformedNormals() const
True after a successful updateDeformedNormals().
float getPointScaleZ(int ix, int iy, int iz) const
Returns the point scale z.
void bindPositions(const float *posXYZ, int count)
Binds a packed xyz array (count * 3 floats). Uses current divisions/size/origin.
float getBindPositionY(int vertexIndex) const
Returns the bind position y.
Combines a borrowed base pose source with ordered override/additive layers.
std::string getLayerMode(const std::string &name) const
Return "override" / "additive", or empty for unknown names.
bool setBaseStateMachine(AnimStateMachine *stateMachine)
Compatibility facade over setBaseSource(AnimStateMachine*).
void update(float dt)
Legacy seconds facade; explicitly forwards to advance().
int addStateMachineLayer(const std::string &name, AnimStateMachine *stateMachine, AnimBoneMask *mask, const std::string &mode)
Compatibility facade over addPoseLayer(AnimStateMachine*).
std::string getEventName(int index) const override
Returns the event name.
bool removeLayer(const std::string &name)
Remove a layer by name.
int addLayer(const std::string &name, AnimPlayer *player, AnimBoneMask *mask, const std::string &mode)
Compatibility facade over addPoseLayer(AnimPlayer*).
int getLayerCount() const
Return the number of configured layers.
bool getLayerEnabled(const std::string &name) const
Return whether a layer is enabled; false for unknown names.
AnimPose * getPose() override
Return the most recently combined pose. @ownership Borrowed @lifetime Valid while the owning animatio...
bool setBaseGraph(AnimGraph *graph)
Compatibility facade over setBaseSource(AnimGraph*).
void clearEvents()
Clear events collected by the most recent update.
std::string getLayerAdditiveReference(const std::string &name) const
Return "bind" / "identity", or empty for unknown names.
bool setLayerAdditiveReferenceCompat(const std::string &name, const std::string &reference)
Compatibility facade over setLayerAdditiveReference.
int addGraphLayer(const std::string &name, AnimGraph *graph, AnimBoneMask *mask, const std::string &mode)
Compatibility facade over addPoseLayer(AnimGraph*).
std::string getLayerName(int index) const
Return a layer name, or empty for an invalid index.
int getEventCount() const override
Returns the event count.
bool setLayerEnabled(const std::string &name, bool enabled)
Enable or disable a layer without removing it. Disabled layers still advance.
bool setBasePlayer(AnimPlayer *player)
Compatibility facade over setBaseSource(AnimPlayer*).
std::string getEventPayload(int index) const override
Returns the event payload.
std::string getEventLayer(int index) const
Source layer name; "base" identifies the base source.
AnimPlayer * getBasePlayer() const
Return the base when it is an AnimPlayer; otherwise null. @ownership Borrowed @lifetime Valid while t...
float getLayerWeight(const std::string &name) const
Return a layer weight, or zero for an unknown name.
bool setLayerWeight(const std::string &name, float weight)
Set a layer's global clamped weight.
Single-clip (or cross-fading) 3D animation player. Script type: AnimPlayer.
Definition AnimPlayer.h:30
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
float getLocalRotationX(int boneIndex) const
Returns the local rotation x.
Definition AnimPose.cpp:174
float getWorldRotationX(int boneIndex) const
Returns the world rotation x.
Definition AnimPose.cpp:350
float getWorldPositionZ(int boneIndex) const
Returns the world position z.
Definition AnimPose.cpp:346
float getLocalScaleZ(int boneIndex) const
Returns the local scale z.
Definition AnimPose.cpp:198
float getLocalPositionZ(int boneIndex) const
Returns the local position z.
Definition AnimPose.cpp:170
void blendFrom(const AnimPose *a, const AnimPose *b, float t)
Blend from.
Definition AnimPose.cpp:97
int getBoneCount() const
Returns the bone count.
Definition AnimPose.h:36
float getWorldMatrixElement(int boneIndex, int elementIndex) const
Column-major 4x4 world matrix for boneIndex after computeWorld(). elementIndex in [0,...
Definition AnimPose.cpp:372
float getLocalPositionX(int boneIndex) const
Returns the local position x.
Definition AnimPose.cpp:162
float getLocalRotationW(int boneIndex) const
Returns the local rotation w.
Definition AnimPose.cpp:186
float getWorldPositionX(int boneIndex) const
Returns the world position x.
Definition AnimPose.cpp:338
void setLocalScale(int boneIndex, float x, float y, float z)
Sets the local scale.
Definition AnimPose.cpp:154
float getLocalScaleX(int boneIndex) const
Returns the local scale x.
Definition AnimPose.cpp:190
float getWorldPositionY(int boneIndex) const
Returns the world position y.
Definition AnimPose.cpp:342
void setLocalRotation(int boneIndex, float x, float y, float z, float w)
Sets the local rotation.
Definition AnimPose.cpp:144
float getWorldRotationW(int boneIndex) const
Returns the world rotation w.
Definition AnimPose.cpp:362
float getWorldRotationZ(int boneIndex) const
Returns the world rotation z.
Definition AnimPose.cpp:358
float getWorldRotationY(int boneIndex) const
Returns the world rotation y.
Definition AnimPose.cpp:354
float getLocalScaleY(int boneIndex) const
Returns the local scale y.
Definition AnimPose.cpp:194
float getLocalRotationZ(int boneIndex) const
Returns the local rotation z.
Definition AnimPose.cpp:182
void setLocalPosition(int boneIndex, float x, float y, float z)
Sets the local position.
Definition AnimPose.cpp:136
float getLocalPositionY(int boneIndex) const
Returns the local position y.
Definition AnimPose.cpp:166
void copyFrom(const AnimPose *other)
Copies from.
Definition AnimPose.cpp:91
float getLocalRotationY(int boneIndex) const
Returns the local rotation y.
Definition AnimPose.cpp:178
bool aimBone(const AnimSkeleton *skeleton, int boneIndex, float targetX, float targetY, float targetZ, float weight=1.f)
Rotate a bone so its local +Z axis aims at a world-space target.
Definition AnimPose.cpp:220
void computeWorld(const AnimSkeleton *skeleton)
Compute world transforms from local pose + skeleton hierarchy. World values readable via getWorld* af...
Definition AnimPose.cpp:203
void resize(int boneCount)
Resize.
Definition AnimPose.cpp:78
bool solveTwoBoneIK(const AnimSkeleton *skeleton, int rootBone, int midBone, int tipBone, float targetX, float targetY, float targetZ, float weight=1.f)
Analytically solve a root-mid-tip chain toward a world-space target.
Definition AnimPose.cpp:237
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...
float getBindPositionY(int boneIndex) const
Returns the bind position y.
float getBindScaleX(int boneIndex) const
Returns the bind scale x.
int getBoneCount() const
Returns the bone count.
int getParent(int boneIndex) const
Returns the parent.
void setBindPosition(int boneIndex, float x, float y, float z)
Sets the bind position.
float getBindPositionZ(int boneIndex) const
Returns the bind position z.
float getBindRotationW(int boneIndex) const
Returns the bind rotation w.
float getBindScaleY(int boneIndex) const
Returns the bind scale y.
float getBindRotationY(int boneIndex) const
Returns the bind rotation y.
float getBindScaleZ(int boneIndex) const
Returns the bind scale z.
float getBindPositionX(int boneIndex) const
Returns the bind position x.
float getBindRotationZ(int boneIndex) const
Returns the bind rotation z.
float getBindRotationX(int boneIndex) const
Returns the bind rotation x.
int getBoneLodLimit(int boneIndex) const
Highest LOD at which the bone is sampled; defaults to all LODs.
std::string getBoneName(int boneIndex) const
Returns the bone name.
void setBoneLodLimit(int boneIndex, int highestLod)
Set the highest animation LOD at which this bone is sampled (0 = full-detail only)....
int findBone(const std::string &name) const
Finds bone.
void setBindScale(int boneIndex, float x, float y, float z)
Sets the bind scale.
void setBindRotation(int boneIndex, float x, float y, float z, float w)
Sets the bind rotation.
void applyBindPose(class AnimPose *pose) const
Fill pose locals with bind pose.
int addBone(const std::string &name, int parentIndex=-1)
Append a bone. parentIndex = -1 for root.
int getSkeletonBone(int skinBoneIndex) const
Skeleton bone index used by skin joint i (-1 if unused).
Definition AnimSkin.cpp:104
bool applyToMesh(graphics::Graphics *gfx, graphics::Mesh *mesh, const AnimPose *pose)
Skin positions (and normals when available) and write the result back to a GPU mesh in one call....
Definition AnimSkin.cpp:341
float getInverseBindElement(int skinBoneIndex, int elementIndex) const
Inverse-bind matrix element (column-major, 0..15) for skin joint i.
Definition AnimSkin.cpp:114
int getBoneCount() const
Returns the bone count.
Definition AnimSkin.h:76
std::vector< float > getSkinnedPositions() const
Packed skinned positions (xyz, vertexCount*3) as a copy. Empty when updateSkinnedPositions() has not ...
Definition AnimSkin.cpp:274
float getSkinnedPositionX(int vertexIndex) const
Cached skinned position component (requires updateSkinnedPositions).
Definition AnimSkin.cpp:258
bool updateMatrixPalette(const AnimPose *pose) const
Build and cache the column-major skinning matrix palette for a pose. The palette contains boneWorld *...
Definition AnimSkin.cpp:122
float getBindPositionX(int vertexIndex) const
Bind-pose (unskinned) position component for vertex v (0..vertexCount-1).
Definition AnimSkin.cpp:168
int getVertexBone(int vertexIndex, int influenceIndex) const
Influence slot i (0..3) for vertex: skeleton bone index or -1.
Definition AnimSkin.cpp:181
bool hasSkinnedPositions() const
True after a successful updateSkinnedPositions().
Definition AnimSkin.h:122
bool updateSkinnedPositions(const AnimPose *pose)
Skin into an internal cache readable via getSkinnedPosition*. Returns false if pose is null or there ...
Definition AnimSkin.cpp:247
float getMatrixPaletteElement(int skinBoneIndex, int elementIndex) const
Cached palette element for one skin bone (elementIndex 0..15).
Definition AnimSkin.cpp:135
bool updateSkinnedNormals(const AnimPose *pose)
Skin the bind-pose normals captured at fromModel with the pose. pose must already have computeWorld(s...
Definition AnimSkin.cpp:279
int getInfluenceCount() const
Returns the influence count.
Definition AnimSkin.h:78
float getVertexWeight(int vertexIndex, int influenceIndex) const
Returns the vertex weight.
Definition AnimSkin.cpp:198
std::string getSkinBoneName(int skinBoneIndex) const
Returns the skin bone name.
Definition AnimSkin.cpp:109
bool hasSkinnedNormals() const
True after a successful updateSkinnedNormals().
Definition AnimSkin.h:146
bool bindGpuMesh(graphics::Graphics *gfx, graphics::Mesh *mesh)
Upload this skin's joint/weight vertex stream to an existing GPU mesh.
Definition AnimSkin.cpp:144
std::vector< float > getSkinnedNormals() const
Packed skinned normals (xyz, vertexCount*3) as a copy.
Definition AnimSkin.cpp:336
float getBindPositionZ(int vertexIndex) const
Returns the bind position z.
Definition AnimSkin.cpp:176
bool updateGpuMesh(graphics::Mesh *mesh, const AnimPose *pose) const
Update a bound GPU mesh's matrix palette from a world-computed pose.
Definition AnimSkin.cpp:163
int getVertexSkinJoint(int vertexIndex, int influenceIndex) const
Influence slot i (0..3) for vertex: skin-local joint index or -1.
Definition AnimSkin.cpp:191
float getSkinnedPositionZ(int vertexIndex) const
Returns the skinned position z.
Definition AnimSkin.cpp:268
float getSkinnedPositionY(int vertexIndex) const
Returns the skinned position y.
Definition AnimSkin.cpp:263
float getBindPositionY(int vertexIndex) const
Returns the bind position y.
Definition AnimSkin.cpp:172
int getVertexCount() const
Definition AnimSkin.h:74
Clip-driven animation state machine with float/bool/trigger parameters and cross-fade transitions....
void setHasExitTime(int transitionId, bool enabled)
Sets the has exit time.
float getFloat(const std::string &name) const
Returns the float.
int addTransition(const std::string &from, const std::string &to, float blendSeconds)
Add transition from → to with blend duration.
std::string getCurrentState() const
Returns the current state.
void addTriggerCondition(int transitionId, const std::string &param)
Adds trigger condition.
void update(float dt)
Legacy seconds facade retained for scripts and old callers.
bool hasState(const std::string &name) const
True when state.
void resetTrigger(const std::string &name)
Resets trigger.
void addBoolCondition(int transitionId, const std::string &param, bool value)
Adds bool condition.
float getStateTime() const
Returns the state time.
void setTrigger(const std::string &name)
Sets the trigger.
void addFloatCondition(int transitionId, const std::string &param, const std::string &op, float threshold)
Comparison op: ">", ">=", "<", "<=", "==", "!=".
void setBool(const std::string &name, bool value)
Sets the bool.
int getStateCount() const
Returns the state count.
void setFloat(const std::string &name, float value)
Sets the float.
void addState(const std::string &name, AnimClip *clip)
Adds state.
bool getBool(const std::string &name) const
Returns the bool.
AnimPose * getPose() override
Borrowed pointer accessor. @ownership Borrowed @lifetime Valid while the owning animation object rema...
bool isBlending() const
True when blending.
void setEntry(const std::string &name)
Sets the entry.
void setExitTime(int transitionId, float normalizedTime)
Optional: require normalized local time in [0,1] >= exitTime before transition.
Marker-aware synchronization group for locomotion animation players.
void update(float dt)
Legacy seconds facade; explicitly forwards to advance().
int getLeader() const
Returns the leader.
void setLeader(int index)
Sets the leader.
float getPhase() const
Returns the phase.
bool getUsedMarkerSync() const
Whether the latest update used compatible sync markers for at least one follower.
int getCount() const
Returns the count.
void addPlayer(AnimPlayer *player, float phaseOffset=0.f)
Adds player.
Motion trail / afterimage recorder + 2D trajectory drawer.
Definition AnimTrail.h:34
std::string getStyle() const
Returns the style.
Definition AnimTrail.cpp:64
void setDuration(float seconds)
How long each sample lives (seconds). <= 0 keeps until capacity eviction.
Definition AnimTrail.cpp:29
float getColorB() const
Returns the color b.
Definition AnimTrail.h:71
bool getFade() const
Returns the fade.
Definition AnimTrail.h:78
void setCapacity(int capacity)
Max retained samples (ring). Clamped to >= 2.
Definition AnimTrail.cpp:21
void setWidth(float pixels)
Sets the width.
Definition AnimTrail.cpp:38
void update(float dt)
Legacy seconds facade; explicitly forwards to advance().
void addPoint3(float x, float y, float z)
Append a 3D sample (draw uses set plane / first two mapped axes via sampleBone).
Definition AnimTrail.cpp:80
void setDrawOffset(float ox, float oy)
Sets the draw offset.
Definition AnimTrail.cpp:73
int getPointCount() const
Returns the point count.
Definition AnimTrail.h:125
void setMinDistance(float distance)
Skip new samples closer than this distance to the newest point (0 = always add).
Definition AnimTrail.cpp:33
void draw(graphics::Graphics *gfx)
Draw trajectory in 2D pixel/world space via Graphics.
float getDrawScaleY() const
Returns the draw scale y.
Definition AnimTrail.h:93
float getWidth() const
Returns the width.
Definition AnimTrail.h:62
void setColor(float r, float g, float b, float a=1.f)
Head (newest) color; alpha fades toward 0 along the trail when fade is on.
Definition AnimTrail.cpp:43
float getDrawOffsetX() const
Returns the draw offset x.
Definition AnimTrail.h:97
float getPointZ(int index) const
Returns the point z.
void sampleBone(const AnimPose *pose, int boneIndex, const std::string &plane="xy")
Sample bone world position after pose->computeWorld. plane maps axes to draw (x,y): "xy" | "xz" | "yz...
float getColorR() const
Returns the color r.
Definition AnimTrail.h:67
void setStyle(const std::string &style)
"line" | "points". Invalid → exception.
Definition AnimTrail.cpp:52
void setFade(bool enable)
Sets the fade.
Definition AnimTrail.cpp:50
float getDrawOffsetY() const
Returns the draw offset y.
Definition AnimTrail.h:99
float getDrawScaleX() const
Returns the draw scale x.
Definition AnimTrail.h:91
float getMinDistance() const
Returns the min distance.
Definition AnimTrail.h:57
float getPointAlpha(int index) const
Effective draw alpha in [0, colorA] after fade.
float getPointX(int index) const
Index 0 = oldest retained sample; count-1 = newest.
float getColorG() const
Returns the color g.
Definition AnimTrail.h:69
float getColorA() const
Returns the color a.
Definition AnimTrail.h:73
void setDrawScale(float sx, float sy)
Applied at draw time: screen = (x,y) * scale + offset. Useful when sampling bone world units into pix...
Definition AnimTrail.cpp:68
float getPointY(int index) const
Returns the point y.
float getDuration() const
Returns the duration.
Definition AnimTrail.h:52
float getPointAge(int index) const
Returns the point age.
void sampleBoneOffset(const AnimPose *pose, int boneIndex, float ox, float oy, float oz, const std::string &plane="xy")
Sample bone offset.
void addPoint(float x, float y)
Append a 2D sample (z stored as 0).
Definition AnimTrail.cpp:78
int getCapacity() const
Returns the capacity.
Definition AnimTrail.h:47
Animation module — tween factory + 2D sprite-sheet / Spine + 3D skeletal playback (player / state mac...
Definition Animation.h:80
PhysicalBalancePose * newPhysicalBalancePose(AnimSkeleton *skeleton)
Impulse-driven balance overlay that wobbles then recovers toward the authored pose.
MotionVec2Builder motionVec2(MotionVec2 from, MotionVec2 to, float duration)
LitMotion-style Vec2 motion builder.
SpriteSheet * newSpriteSheetFromSequence(eve::graphics::Graphics *gfx, const std::string &pattern, int first, int last, int columns=0)
Load numbered PNG files into a runtime atlas and return its frame table. Pattern must contain {n},...
SpriteSheet * newSpriteSheetFromAtlasJson(eve::graphics::Graphics *gfx, const std::string &texturePath, const std::string &jsonPath)
Import Aseprite/TexturePacker JSON frame metadata and its atlas texture.
AnimConstraintStack * newConstraintStack(AnimSkeleton *skeleton)
Create an ordered procedural constraint stack.
MotionVec2Builder shakeVec2(MotionVec2 from, MotionVec2 strength, float duration)
Vec2 shake builder.
Tween * newTween(float duration=1.f)
Create a tween (duration in seconds). Returned pointer is owned by script GC.
AnimClip * newClipFromAnimationFixtureText(const std::string &path)
Load an animation clip from an internal *.anim.txt test fixture.
int setupHairChain(DynamicBoneSolver *solver, const std::string &rootBone, const std::string &tipBone, float stiffness=0.12f, float damping=0.18f, float inertia=0.8f, float endLength=0.08f, bool selfCollision=true)
Add a hair/tail spring chain with card-friendly defaults.
int getSpriteSequenceCacheCount() const
Number of decoded runtime sequence atlases retained for reuse.
AnimPose * newPose(int boneCount=0)
Creates a pose. @ownership Caller deletes unless documented otherwise.
AnimLattice * newLattice(int divX=2, int divY=2, int divZ=2)
3D lattice scale-deformer (晶格缩放变形). divX/divY/divZ are the control-point divisions (each >= 2)....
MotionBuilder punch(float from, float strength, float duration)
SpineAtlas * newSpineAtlasFromFile(const std::string &path)
Load helpers (allocate + parse; false → empty object still returned? prefer nullable).
void clearSpriteSequenceCache()
Drop cache metadata; existing returned sheets/textures remain valid.
MotionVec2Builder punchVec2(MotionVec2 from, MotionVec2 strength, float duration)
Vec2 punch builder.
void update(float dt)
Legacy seconds facade; invalid input is explicitly consumed and ignored.
AnimBoneMask * newBoneMask(AnimSkeleton *skeleton)
Create a zero-weight per-bone animation mask.
eve::Result< void > advance(const eve::SimulationStep &step)
Advance all registered tweens, motions, sprite anims, and spine anims.
AnimTrail * newTrail(int capacity=64)
Motion trail / afterimage (script GC owns returned object). capacity: max retained samples (>= 2).
SpineSkeleton * newSpineSkeleton(SpineSkeletonData *data)
Creates a spine skeleton. @ownership Caller deletes unless documented otherwise.
SpriteClip * newSpriteClip(const std::string &name="")
Creates a sprite clip. @ownership Caller deletes unless documented otherwise.
MotionSequence sequence()
AnimGraph * newGraph(AnimSkeleton *skeleton)
Create a composable pose graph for the skeleton.
int getSpriteSequenceCacheBytes() const
Approximate RGBA8 bytes retained by cached sequence atlases.
int getSpriteAnimCount() const
Returns the sprite anim count.
Definition Animation.h:347
AnimSkeleton * newSkeleton()
3D skeletal animation factories (script GC owns returned objects).
ControlAnim * newControlAnim(float frequencyHz=3.f, float dampingZeta=1.f, float response=1.f)
Control-theory procedural animation (second-order / spring / PD). frequencyHz: natural frequency f (H...
void clearAll()
Detach all tweens from the registry (does not delete Tween objects).
AnimClip * newClip(const std::string &name="")
Creates a clip. @ownership Caller deletes unless documented otherwise.
SpineAtlas * newSpineAtlas()
Spine (region attachment subset) factories.
MotionDatabase * newMotionDatabase(AnimSkeleton *skeleton)
Creates a motion database. @ownership Caller deletes unless documented otherwise.
SpineSkeletonData * newSpineSkeletonDataFromJson(const std::string &json)
Creates a spine skeleton data from json. @ownership Caller deletes unless documented otherwise.
AnimPlayer * newPlayer(AnimSkeleton *skeleton)
Creates a player. @ownership Caller deletes unless documented otherwise.
AnimStateMachine * newStateMachine(AnimSkeleton *skeleton)
Creates a state machine. @ownership Caller deletes unless documented otherwise.
SpriteAnim * newSpriteAnim()
Creates a sprite anim. @ownership Caller deletes unless documented otherwise.
MotionVec3Builder motionVec3(MotionVec3 from, MotionVec3 to, float duration)
LitMotion-style Vec3 motion builder.
AnimBatch * newBatch()
Create a parallel batch clip evaluator.
int setupHairHeadCollider(DynamicBoneSolver *solver, const std::string &boneName, float radius=0.12f)
Attach a head sphere collider for hair chains.
int getTweenCount() const
Returns the tween count.
Definition Animation.h:329
MotionColorBuilder motionColor(MotionColor from, MotionColor to, float duration)
Color tween builder (lerp).
AnimLayerMixer * newLayerMixer(AnimSkeleton *skeleton)
Create an override/additive animation layer mixer.
int getActiveCount() const
Returns the active count.
DynamicBoneSolver * newDynamicBoneSolver(AnimSkeleton *skeleton)
Create a dynamic bone solver for spring-damped chains. @ownership Returned object is owned by script ...
MotionQuatBuilder motionQuat(MotionQuat from, MotionQuat to, float duration)
Quaternion tween builder (slerp).
SpriteSheet * newSpriteSheet()
2D sprite-sheet animation factories (script GC owns returned objects).
AnimSyncGroup * newSyncGroup()
Create a normalized-time player synchronization group.
MotionVec3Builder shakeVec3(MotionVec3 from, MotionVec3 strength, float duration)
Vec3 shake builder.
int getSpineAnimCount() const
Returns the spine anim count.
Definition Animation.h:349
int getMotionCount() const
Returns the motion count.
Definition Animation.h:331
MotionBuilder shake(float from, float strength, float duration)
LitMotion-style shake (punch with deterministic random signs).
SpineSkeletonData * newSpineSkeletonData()
Creates a spine skeleton data. @ownership Caller deletes unless documented otherwise.
MotionMatcher * newMotionMatcher(AnimSkeleton *skeleton, MotionDatabase *database)
Creates a motion matcher. @ownership Caller deletes unless documented otherwise.
void clearFinished()
Drop finished/stopped entries from the registry (does not delete Tween objects).
~Animation() override
Animation.
SpineAnim * newSpineAnim(SpineSkeleton *skeleton)
Creates a spine anim. @ownership Caller deletes unless documented otherwise.
AnimSkeleton * newSkeletonFromAnimationFixtureText(const std::string &path)
Load a skeleton from an internal *.anim.txt test fixture.
ControlPose * newControlPose(AnimSkeleton *skeleton)
Creates a control pose. @ownership Caller deletes unless documented otherwise.
MotionBuilder motion(float from, float to, float duration)
SpineAtlas * newSpineAtlasFromText(const std::string &text)
Creates a spine atlas from text. @ownership Caller deletes unless documented otherwise.
MotionVec3Builder punchVec3(MotionVec3 from, MotionVec3 strength, float duration)
Vec3 punch builder.
SpineSkeletonData * newSpineSkeletonDataFromFile(const std::string &path)
Creates a spine skeleton data from file. @ownership Caller deletes unless documented otherwise.
FootIKSolver * newFootIKSolver(AnimSkeleton *skeleton)
Create a paired-foot IK solver for a borrowed skeleton. @ownership Returned object is owned by script...
Control-theory procedural animation for named scalar properties.
Definition ControlAnim.h:25
float getVelocity(const std::string &name) const
Returns the velocity.
void remove(const std::string &name)
Removes .
void set(const std::string &name, float value)
Create/update a channel: current value snaps to value, velocity cleared.
float getResponse() const
Returns the response.
Definition ControlAnim.h:46
void setTarget(const std::string &name, float value)
Move the tracking target (does not snap state). Creates channel if missing.
float get(const std::string &name) const
Returns the value.
void setDamping(float dampingZeta)
Sets the damping.
void setFrequency(float frequencyHz)
Sets the frequency.
int getPropertyCount() const
Returns the property count.
Definition ControlAnim.h:76
float getFrequency() const
Returns the frequency.
Definition ControlAnim.h:38
float getDamping() const
Returns the damping.
Definition ControlAnim.h:42
bool has(const std::string &name) const
True when active.
float getTarget(const std::string &name) const
Returns the target.
void setResponse(float response)
Sets the response.
std::string getIntegrator() const
Returns the integrator.
std::string getPropertyName(int index) const
Returns the property name.
void setIntegrator(const std::string &kind)
Integrator: "secondOrder" | "spring" | "pd". Invalid → exception.
void update(float dt)
Legacy seconds facade; explicitly forwards to advance().
void setTargetVelocity(const std::string &name, float velocity)
Optional explicit target velocity (used by secondOrder / pd).
void impulse(const std::string &name, float deltaVelocity)
Inject an instantaneous velocity impulse (procedural “hit”).
Control-theory procedural pose driver: tracks a target AnimPose with per-channel second-order / sprin...
Definition ControlPose.h:23
void setBoneWeight(int boneIndex, float weight)
Per-bone blend weight in [0,1]; 1 = full dynamics, 0 = hard snap to target.
void setDamping(float dampingZeta)
Sets the damping.
float getBoneWeight(int boneIndex) const
Returns the bone weight.
void update(float dt)
Legacy seconds facade; explicitly forwards to advance().
void setTargetPose(const AnimPose *target)
Copy target pose. Channels without prior state snap; existing state keeps momentum.
float getFrequency() const
Returns the frequency.
Definition ControlPose.h:39
AnimPose * getPose()
Returns the pose.
float getDamping() const
Returns the damping.
Definition ControlPose.h:43
void snapToTarget()
Snap current state to the last target without changing the target.
std::string getIntegrator() const
Returns the integrator.
void setResponse(float response)
Sets the response.
void setFrequency(float frequencyHz)
Sets the frequency.
AnimPose * getTargetPose()
Returns the target pose.
float getResponse() const
Returns the response.
Definition ControlPose.h:47
void setIntegrator(const std::string &kind)
Sets the integrator.
World-space spring-chain solver that writes results as local bone rotations.
void setObjectMoveResponse(float value)
Set how much simulated particles follow root translation, from zero to one.
void setColliderInside(int index, bool inside)
Select inside containment or outside exclusion for a collider.
void setChainParticleParameters(int chainIndex, int particleIndex, float stiffness, float damping, float inertia, float gravityScale, float radius)
Override simulation parameters for one chain particle, where zero is the root.
int addChain(int rootBone, int endBone, float stiffness, float damping, float inertia, float gravityScale=1.f, float radius=0.f, int iterations=4)
Add an ancestor-to-descendant spring chain.
float getUpdateRate() const
Return preferred simulation frequency.
float getGlobalGravityX() const
Return gravity X.
float getWeight() const
Return final rotation blend weight.
void setColliderRadius(int index, float radius)
Change a collider radius; non-positive values are ignored.
void setDistanceLimit(float value)
Set sleep distance; zero disables distance sleeping.
void setWeight(float weight)
Set final rotation blend weight in [0, 1].
void addBoneColliderCapsule(int boneIndex, float startX, float startY, float startZ, float endX, float endY, float endZ, float radius)
Add a capsule whose endpoints follow bone-local offsets.
void addColliderSphere(float centerX, float centerY, float centerZ, float radius)
Add a fixed model-space sphere collider; non-positive radii are ignored.
void clearChainEnd(int chainIndex)
Remove a chain's virtual terminal particle.
float getTeleportThreshold() const
Return teleport reset distance; zero disables it.
void clearColliders()
Remove all colliders.
float getObjectMoveResponse() const
Return root translation response.
void addColliderCapsule(float startX, float startY, float startZ, float endX, float endY, float endZ, float radius)
Add a fixed model-space capsule collider.
void setTeleportThreshold(float distance)
Set root movement distance that triggers a simulation reset.
void setUpdateRate(float updatesPerSecond)
Set preferred simulation frequency; zero means one step per update.
void setChainEndOffset(int chainIndex, float x, float y, float z)
Add a virtual particle at a last-bone-local offset; this replaces end length mode.
void update(AnimPose *pose, float dt)
Simulate one frame using injected dt and update pose local rotations.
float getGlobalGravityY() const
Return gravity Y.
void setColliderEnabled(int index, bool enabled)
Enable or disable a collider without changing its index.
void reset()
Reset all chains to the animated pose on their next update.
bool isChainSleeping(int chainIndex) const
Return whether a valid chain is currently distance-sleeping.
void setExternalForce(float x, float y, float z)
Set additional model-space acceleration such as wind.
void setGlobalGravity(float x, float y, float z)
Set model-space gravity acceleration.
void removeCollider(int index)
Remove a valid collider index; invalid indices are ignored.
bool isChainEnabled(int chainIndex) const
Return enabled state, or false for an invalid index.
void setChainSelfCollision(int chainIndex, bool enabled)
Enable or disable non-adjacent particle self-collision for a chain.
void setDistanceReference(float x, float y, float z)
Set the model-space point used for distance-based sleeping.
void setChainEndLength(int chainIndex, float length)
Add a virtual particle after the last bone along the animated terminal direction.
void setChainEnabled(int chainIndex, bool enabled)
Set a valid chain's enabled state; invalid indices are ignored.
int getChainCount() const
Return configured chain count.
void addBoneColliderSphere(int boneIndex, float offsetX, float offsetY, float offsetZ, float radius)
Add a sphere collider following a bone-local offset.
float getGlobalGravityZ() const
Return gravity Z.
int getColliderCount() const
Return collider count.
void clearChains()
Remove all chains and their simulation state.
int addChainByName(const std::string &rootBone, const std::string &endBone, float stiffness, float damping, float inertia, float gravityScale=1.f, float radius=0.f, int iterations=4)
Name-based addChain variant; returns -1 for invalid input.
void setChainFreezeAxis(int chainIndex, int axis)
Restrict a chain to its animated model-space plane.
Paired-foot IK with contact smoothing and pelvis compensation.
void setMinGroundNormalY(float value)
Set minimum accepted upward normal cosine in [0, 1].
void reset()
Clear interpolated contacts.
void setMaxPelvisOffset(float distance)
Set maximum pelvis compensation distance.
void setGroundQuery(float startHeight, float distance)
Set ray origin height and downward query distance.
void configureLeftToe(int toe, float soleOffset=0.f)
Configure an optional left toe child and its sole offset.
void configureRightLeg(int hip, int knee, int foot, float soleOffset=0.f)
Configure the right hip-knee-foot chain and sole offset.
void setFootLockEnabled(bool enabled)
Enable or disable world-space foot locking.
bool isLeftFootLocked() const
Return whether the left foot is currently locked.
void setPelvisBone(int bone)
Configure the pelvis bone.
void setRightContact(bool hit, float x, float y, float z, float nx, float ny, float nz, float weight=1.f)
Supply the right model-space ground contact.
void setPositionResponse(float value)
Set contact interpolation response in inverse seconds.
void setRotationResponse(float value)
Set foot-normal interpolation response in inverse seconds.
void setContactGraceTime(float seconds)
Set how long a missing automatic contact retains its prior target.
void apply(AnimPose *pose, float dt)
Apply using injected delta time and owning contact values.
bool isRightFootLocked() const
Return whether the right foot is currently locked.
void setFootLockThresholds(float enterWeight, float exitWeight)
Set lock enter and release contact-weight thresholds.
void configureLeftLeg(int hip, int knee, int foot, float soleOffset=0.f)
Configure the left hip-knee-foot chain and sole offset.
void configureRightToe(int toe, float soleOffset=0.f)
Configure an optional right toe child and its sole offset.
void setLeftContact(bool hit, float x, float y, float z, float nx, float ny, float nz, float weight=1.f)
Supply the left model-space ground contact.
AnimSkeleton * getSkeleton() const
Return the borrowed skeleton, or null. @ownership Borrowed; ownership remains with the animation sour...
void setSkeleton(AnimSkeleton *skeleton)
Rebind; changing skeleton clears all bone-index configuration.
Configure then bind/run a float motion into a MotionRuntime.
MotionBuilder & style(MotionStyle style)
Select Tween / Punch / Shake evaluation.
Color fluent builder (Tween / lerp only).
Baked motion-matching feature database from one or more AnimClips. Feature layout per frame: [0....
Runtime motion matching player: builds a query feature from current pose + desired trajectory,...
Quaternion fluent builder (Tween / slerp only).
int activeCount() const noexcept
eve::Result< void > advance(const eve::SimulationStep &step)
eve::SimulationTick currentTick() const noexcept
bool hasCurrentTick() const noexcept
Schedule unspawned builders onto a shared MotionRuntime timeline.
MotionVec2Builder & style(MotionStyle style)
Select Tween / Punch / Shake evaluation.
MotionVec3Builder & style(MotionStyle style)
Select Tween / Punch / Shake evaluation.
Authored-pose overlay that wobbles from world impulses and recovers balance.
Spine animation player + 2D draw collector (region attachments).
Definition SpineAnim.h:35
void apply()
Apply current animation time to skeleton and update world transforms.
void setPageTexture(int pageIndex, graphics::Texture *texture)
Bind a GPU texture to an atlas page (by index or page image name).
Definition SpineAnim.cpp:36
SpineAtlas * getAtlas() const
Returns the atlas.
Definition SpineAnim.h:51
graphics::Texture * getPageTexture(int pageIndex) const
Returns the page texture.
Definition SpineAnim.cpp:56
float getDrawSlotHeight(int index) const
Returns the draw slot height.
void setSpeed(float speed)
Sets the speed.
Definition SpineAnim.cpp:92
void setPageTextureByName(const std::string &pageName, graphics::Texture *texture)
Sets the page texture by name.
Definition SpineAnim.cpp:45
float getDrawSlotX(int index) const
Returns the draw slot x.
bool update(float dt)
Legacy seconds facade; explicitly forwards to advance().
void setAtlas(SpineAtlas *atlas)
Sets the atlas.
Definition SpineAnim.cpp:30
void setScale(float sx, float sy)
Sets the scale.
bool isPaused() const
True when paused.
Definition SpineAnim.h:109
float getScaleX() const
Returns the scale x.
Definition SpineAnim.h:96
SpineSkeleton * getSkeleton() const
Returns the skeleton.
Definition SpineAnim.h:46
int getDrawSlotCount() const
Query posed draw slots without textures (for unit tests). Returns number of visible region attachment...
void setLayer(int layer)
Sets the layer.
Definition SpineAnim.h:100
float getX() const
Returns the x.
Definition SpineAnim.h:90
float getAnimationDuration() const
Returns the animation duration.
float getDrawSlotRotation(int index) const
Returns the draw slot rotation.
float getY() const
Returns the y.
Definition SpineAnim.h:92
float getDrawSlotY(int index) const
Returns the draw slot y.
void setLoop(bool loop)
Sets the loop.
Definition SpineAnim.h:78
bool isFinished() const
True when finished.
Definition SpineAnim.h:111
float getSpeed() const
Returns the speed.
Definition SpineAnim.h:72
void setPosition(float x, float y)
Sets the position.
bool play(const std::string &animationName)
Play.
Definition SpineAnim.cpp:61
bool getLoop() const
Returns the loop.
Definition SpineAnim.h:80
bool getFlipY() const
Returns the flip y.
Definition SpineAnim.h:85
float getDrawSlotWidth(int index) const
Returns the draw slot width.
std::string getDrawSlotRegion(int index) const
Returns the draw slot region.
void setColor(float r, float g, float b, float a=1.f)
Sets the color.
float getTime() const
Returns the time.
Definition SpineAnim.h:76
void setFlipY(bool flip)
When true (default), Spine Y-up is flipped for screen Y-down draw items.
Definition SpineAnim.h:83
float getScaleY() const
Returns the scale y.
Definition SpineAnim.h:98
int getLayer() const
Returns the layer.
Definition SpineAnim.h:102
bool isPlaying() const
True when playing.
Definition SpineAnim.h:107
std::string getAnimation() const
Returns the animation.
Definition SpineAnim.h:113
void setTime(float seconds)
Sets the time.
Definition SpineAnim.cpp:97
void draw(graphics::Graphics *gfx)
Draw the current pose into an existing frame without clearing or presenting it.
Esoteric Spine .atlas text parser (region rectangles + page metadata). Does not load image pixels — b...
Definition SpineAtlas.h:16
int getRegionY(int index) const
Returns the region y.
int getPageHeight(int pageIndex) const
Returns the page height.
std::string getPageName(int pageIndex) const
Returns the page name.
std::string getRegionName(int index) const
Returns the region name.
int getPageWidth(int pageIndex) const
Returns the page width.
bool getRegionRotate(int index) const
Returns the region rotate.
int getPageCount() const
Returns the page count.
Definition SpineAtlas.h:35
int getRegionPage(int index) const
Returns the region page.
int getRegionWidth(int index) const
Returns the region width.
int getRegionX(int index) const
Returns the region x.
int getRegionHeight(int index) const
Returns the region height.
int getRegionCount() const
Returns the region count.
Definition SpineAtlas.h:44
int findRegion(const std::string &name) const
Finds region.
Spine skeleton JSON data (bones / slots / skins / animations).
float getAnimationDuration(int index) const
Returns the animation duration.
int getSlotBone(int index) const
Returns the slot bone.
std::string getSpineVersion() const
Returns the spine version.
int getSkinCount() const
Returns the skin count.
int findSkin(const std::string &name) const
Finds skin.
std::string getSkinName(int index) const
Returns the skin name.
int getBoneParent(int index) const
Returns the bone parent.
int findAnimation(const std::string &name) const
Finds animation.
int getBoneCount() const
Returns the bone count.
std::string getSlotName(int index) const
Returns the slot name.
int findSlot(const std::string &name) const
Finds slot.
std::string getBoneName(int index) const
Returns the bone name.
std::string getAnimationName(int index) const
Returns the animation name.
int getAnimationCount() const
Returns the animation count.
int getSlotCount() const
Returns the slot count.
int findBone(const std::string &name) const
Finds bone.
Runtime Spine skeleton pose (local + world bone transforms, slot attachments). Script type: SpineSkel...
float getBoneWorldRotation(int index) const
Returns the bone world rotation.
bool setSkin(const std::string &name)
Sets the skin.
void setToSetupPose()
Sets the to setup pose.
std::string getSlotAttachmentName(int slotIndex) const
Returns the slot attachment name.
int getSkin() const
Returns the skin.
int getSlotCount() const
Returns the slot count.
int getBoneCount() const
Returns the bone count.
float getBoneWorldY(int index) const
Returns the bone world y.
void updateWorldTransform()
Updates world transform.
SpineSkeletonData * getData() const
Returns the data.
void setSlotAttachmentName(int slotIndex, const std::string &name)
Sets the slot attachment name.
float getBoneWorldX(int index) const
Returns the bone world x.
2D sprite-sheet clip player.
Definition SpriteAnim.h:26
SpriteSheet * getSheet() const
Returns the sheet.
Definition SpriteAnim.h:39
void bindQuad(graphics::Quad *quad)
Keep this Quad's viewport updated each update/play.
bool isFinished() const
True when finished.
Definition SpriteAnim.h:92
bool update(float dt)
Legacy seconds facade; explicitly forwards to advance().
bool consumeCompleted()
Consume and clear the one-shot completion event.
void setLoop(bool loop)
Sets the loop.
void setTime(float seconds)
Sets the time.
void resetSpeedCurve()
Restart speed-curve sampling from zero without changing clip time.
void setSpeedCurveInterpolation(const std::string &mode)
Set speed-curve interpolation: linear, smooth, or cubic.
void play(SpriteClip *clip)
Play.
void clearSpeedCurve()
Remove all speed-curve keys and restore constant-speed playback.
void setSpeed(float speed)
Sets the speed.
void step(int frames)
Step.
void setSheet(SpriteSheet *sheet)
Optional sheet used by applyToQuad / bindQuad.
int getLoopCount() const
Return loop boundaries crossed since play started.
Definition SpriteAnim.h:94
void queue(SpriteClip *clip)
Queue.
void addSpeedCurveKey(float seconds, float multiplier)
Add a piecewise-linear speed multiplier key at curve time in seconds.
float getSpeedCurveValue() const
Return the current sampled curve multiplier.
int getClipFrame() const
Index inside the current clip (0..clipFrameCount-1), or -1.
Definition SpriteAnim.h:103
float getSpeed() const
Returns the speed.
Definition SpriteAnim.h:55
void unbindQuad()
Unbinds quad.
graphics::Quad * getBoundQuad() const
Returns the bound quad.
Definition SpriteAnim.h:112
void bindSprite(graphics::Renderable2D *sprite)
Bind a Sprite2D so trimmed frame layout is synchronized automatically.
void applyToQuad(graphics::Quad *quad) const
Write current sheet frame into quad (requires sheet).
bool getLoop() const
Returns the loop.
std::string consumeEvent()
Consume event.
void playReverse(SpriteClip *clip)
Start at the clip end and play backward (speed becomes negative).
void playOnce(SpriteClip *clip)
Play once.
SpriteClip * getClip() const
Returns the clip.
Definition SpriteAnim.h:101
bool isPlaying() const
True when playing.
Definition SpriteAnim.h:88
bool isPaused() const
True when paused.
Definition SpriteAnim.h:90
int consumeLooped()
Consume and clear pending loop events, returning their count.
void setSpeedCurveLoop(bool loop)
Choose whether speed-curve time wraps after its last key.
Definition SpriteAnim.h:63
int getSheetFrame() const
Sheet frame index for the current cell, or -1.
void setFrame(int clipFrame)
Sets the frame.
float getTime() const
Returns the time.
Definition SpriteAnim.h:81
Named 2D frame sequence referencing SpriteSheet frame indices. Script type: SpriteClip.
Definition SpriteClip.h:17
int getSheetFrame(int index) const
Returns the sheet frame.
void addEvent(int clipFrame, const std::string &name)
Attach a named event to a clip-frame index.
float wrapTime(float timeSeconds) const
Local time wrapped or clamped according to loop flag.
float getFPS() const
Uniform FPS, or 0 when empty/variable-duration.
std::string getName() const
Returns the name.
Definition SpriteClip.h:30
void addFrame(int sheetFrameIndex, float duration=0.1f)
Append one cell: sheetFrameIndex + display duration (seconds).
float getDuration() const
Returns the duration.
void setName(const std::string &name)
Sets the name.
void addFrameByName(SpriteSheet *sheet, const std::string &frameName, float duration=0.1f)
Resolve name via sheet and append.
void setLoop(bool loop)
Sets the loop.
Definition SpriteClip.h:33
void setFPS(float fps)
Replace every existing frame duration with 1/fps.
int frameAtTime(float timeSeconds) const
Map absolute time (seconds) into a clip frame index. When loop is false and t >= duration,...
int getFrameCount() const
Returns the frame count.
Definition SpriteClip.h:58
void addRange(int firstSheetFrame, int lastSheetFrame, float fps)
Append inclusive sheet-frame range at a uniform frame rate.
std::string getEvent(int clipFrame) const
Return event name for a frame, or empty when none.
bool getLoop() const
Returns the loop.
Definition SpriteClip.h:35
float getFrameDuration(int index) const
Returns the frame duration.
Sprite-sheet / texture-atlas frame table (pixel rects).
Definition SpriteSheet.h:23
int getFrameCount() const
Returns the frame count.
Definition SpriteSheet.h:56
int getFrameX(int index) const
Returns the frame x.
graphics::Texture * getTexture() const
Return the optional atlas texture without transferring ownership.
Definition SpriteSheet.h:53
int getFrameOffsetX(int index) const
Returns the frame offset x.
int addFrame(const std::string &name, int x, int y, int w, int h)
Append a named frame. Returns frame index. Empty name → "frameN".
int getFrameSourceWidth(int index) const
Returns the frame source width.
int setGrid(int columns, int rows, int frameW, int frameH, int margin=0, int spacing=0, int originX=0, int originY=0)
Generate frames in row-major order from a grid. frameW/frameH are cell sizes; margin is outer padding...
void setTexture(graphics::Texture *texture)
Optional atlas texture produced by a sequence loader or assigned by the user.
Definition SpriteSheet.h:51
std::string getFrameName(int index) const
Returns the frame name.
int getFrameWidth(int index) const
Returns the frame width.
int getFrameHeight(int index) const
Returns the frame height.
int getFrameY(int index) const
Returns the frame y.
int getFrameOffsetY(int index) const
Returns the frame offset y.
int findFrame(const std::string &name) const
Finds frame.
void applyToQuad(graphics::Quad *quad, int frameIndex) const
Write pixel viewport into an existing Quad (does not allocate).
int getFrameSourceHeight(int index) const
Returns the frame source height.
Property tween — interpolates named float properties from → to over time.
Definition Tween.h:25
bool isFinished() const
True when finished.
Definition Tween.h:101
void setFrom(const std::string &name, float value)
Sets the from.
Definition Tween.cpp:36
bool isRunning() const
True when running.
Definition Tween.h:97
void setDelay(float seconds)
Sets the delay.
Definition Tween.cpp:117
void start()
Starts .
Definition Tween.cpp:204
int getRepeat() const
Returns the repeat.
Definition Tween.h:79
void setDeltaAngle(const std::string &name, float deltaRadians)
Sets the delta angle.
Definition Tween.cpp:76
bool getYoyo() const
Returns the yoyo.
Definition Tween.h:83
void setToAngle(const std::string &name, float radians)
Sets the to angle.
Definition Tween.cpp:68
int getPropertyCount() const
Names of all property tracks (stable order = insertion order).
Definition Tween.h:131
void setEase(const std::string &kind)
Sets the ease.
Definition Tween.cpp:122
float getDuration() const
Returns the duration.
Definition Tween.h:63
void pause()
Pause.
Definition Tween.cpp:214
void reset()
Resets .
Definition Tween.cpp:231
bool isPaused() const
True when paused.
Definition Tween.h:99
float getEasedProgress() const
Eased progress used for interpolation, [0,1].
Definition Tween.cpp:198
bool update(float dt)
Advance by dt seconds; legacy facade that forwards to advance().
Definition Tween.cpp:304
void setFromAngle(const std::string &name, float radians)
Sets the from angle.
Definition Tween.cpp:60
float get(const std::string &name) const
Returns the value.
Definition Tween.cpp:86
void setYoyo(bool enabled)
Sets the yoyo.
Definition Tween.h:81
bool isDelayed() const
True when delayed.
Definition Tween.h:105
bool isActive() const
True when active.
Definition Tween.h:107
float getProgress() const
Linear progress in the current cycle, [0,1].
Definition Tween.cpp:193
void setDuration(float seconds)
Sets the duration.
Definition Tween.cpp:112
std::string getPropertyName(int index) const
Returns the property name.
Definition Tween.cpp:328
float evaluate(const std::string &name, float t) const
Sample property at linear t in [0,1] using current from/to (no state change).
Definition Tween.cpp:315
void stop()
Stops .
Definition Tween.cpp:226
float getFrom(const std::string &name) const
Returns the from.
Definition Tween.cpp:92
float getDelay() const
Returns the delay.
Definition Tween.h:67
void setRepeat(int count)
Play count: 1 = once (default), N = N cycles, -1 = infinite. Values < -1 are clamped to -1.
Definition Tween.cpp:128
void setDelta(const std::string &name, float delta)
Relative change: end = start + delta (resolved when start() runs).
Definition Tween.cpp:52
float getTo(const std::string &name) const
Returns the to.
Definition Tween.cpp:98
void setTo(const std::string &name, float value)
Sets the to.
Definition Tween.cpp:44
void resume()
Resume.
Definition Tween.cpp:218
std::string getEase() const
Returns the ease.
Definition Tween.h:71
float getDelta(const std::string &name) const
Returns the delta.
Definition Tween.cpp:105
bool has(const std::string &name) const
True when active.
Definition Tween.cpp:84
float getElapsed() const
Elapsed time in the current cycle (excludes delay).
Definition Tween.h:112
bool isStopped() const
True when stopped.
Definition Tween.h:103
constexpr std::optional< StrongUint64 > incremented() const noexcept
Returns the next value, or empty instead of unsigned wraparound.
Texture * newTextureFromImageData(image::ImageData *data, bool repeatU=false, bool repeatV=false)
Creates a texture from image data. @ownership Caller deletes unless documented otherwise.
virtual Texture * newTextureFromFile(const std::string &filename)=0
Creates a texture from file. @ownership Caller deletes unless documented otherwise.
Represents raw pixel data.
Definition ImageData.h:38
void getPixel(int x, int y, Colorf &c) const
Gets the pixel at location (x,y).
void paste(ImageData *src, int dx, int dy, int sx, int sy, int sw, int sh)
Paste part of one ImageData onto another. The subregion defined by the top-left corner (sx,...
std::string getFormat() const
This module is responsible for decoding files such as PNG, GIF, JPEG into raw pixel data,...
Definition Image.h:22
ImageData * newImageDataFromFile(std::string path)
Loads an image from a VFS path through the unified resource cache. Repeated loads of one path share a...
Definition Image.cpp:53
ImageData * newImageData(Data *data)
Creates new ImageData from FileData.
Definition Image.cpp:51
Result< int > addHeadCollider(DynamicBoneSolver &solver, const std::string &boneName, float radius, float offsetX, float offsetY, float offsetZ)
Attach a bone-following sphere collider (typically the head) for hair chains.
Result< int > addChain(DynamicBoneSolver &solver, const ChainDesc &desc)
Add one hair/tail chain by bone name.
void exposeAnimPlayerBindings(ssq::Table &table)
Register playback, sampling and event inspection for AnimPlayer.
void exposeAnimationModelImportBindings(ssq::Class &cls)
Register ModelData/Assimp import factories when AnimationModelImport.cpp is linked (OPTIONAL_DEPS mod...
void exposePhysicalBalancePoseBindings(ssq::Table &table)
Register the impulse/balance pose overlay Squirrel surface.
void exposeMotionMatcherBindings(ssq::Table &table)
Register the synchronous MotionMatcher Squirrel surface.
void exposeAnimClipBindings(ssq::Table &table)
Register AnimClip's authoring and playback-neutral Squirrel surface.
void exposeMotionScriptBindings(ssq::Table &table, ssq::Class &animationClass)
Register Motion / MotionSequence script types and Animation factories.
@ Punch
Finite damped sine punch about from.
@ Shake
Punch with per-axis deterministic random sign.
std::unordered_map< std::string, SkillDefinition > & table()
Definition Skill.cpp:65
One deterministic fixed-step emitted by SimulationClock.
Definition Time.h:158
Compact RGBA color used by motion adapters.
Definition MotionTypes.h:52
Compact quaternion used by motion adapters (xyzw).
Definition MotionTypes.h:60
Compact float2 used by motion adapters (avoids graphics math deps).
Definition MotionTypes.h:39
Compact float3 used by motion adapters.
Definition MotionTypes.h:45
One named spring chain with game-friendly hair defaults.
glm::vec4 bounds