载入中...
搜索中...
未找到
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 // 脚本 motion sink 适配器由本模块持有(motion 槽位借用 sink 指针),析构时一起撤。
116}
117
119 auto *t = new Tween(duration);
120 registerTween(t);
121 return t;
122}
123
125
127 const std::string &pattern, int first,
128 int last, int columns) {
129 if (!gfx) throw Exception("Animation.newSpriteSheetFromSequence: gfx is null");
130 const size_t marker = pattern.find("{n}");
131 if (marker == std::string::npos)
132 throw Exception("Animation.newSpriteSheetFromSequence: pattern must contain '{n}'");
133 if (first < 0 || last < first)
134 throw Exception("Animation.newSpriteSheetFromSequence: expected 0 <= first <= last");
135
136 const int count = last - first + 1;
137 if (columns <= 0) columns = static_cast<int>(std::ceil(std::sqrt(float(count))));
138 if (columns <= 0)
139 throw Exception("Animation.newSpriteSheetFromSequence: columns must be > 0");
140 const std::string cacheKey = pattern + "#" + std::to_string(first) + ":" +
141 std::to_string(last) + ":" + std::to_string(columns);
142 auto cached = spriteSequenceCache_.find(cacheKey);
143 if (cached != spriteSequenceCache_.end()) return cached->second->clone();
144 const int rows = (count + columns - 1) / columns;
145
146 image::Image *images = image::Image::create();
147 std::vector<image::ImageData *> frames;
148 struct Bounds { int x = 0, y = 0, w = 1, h = 1; };
149 std::vector<Bounds> bounds;
150 frames.reserve(static_cast<size_t>(count));
151 int frameW = 0, frameH = 0;
152 int packedW = 1, packedH = 1;
153 for (int n = first; n <= last; ++n) {
154 std::string path = pattern;
155 path.replace(marker, 3, std::to_string(n));
157 if (!frame) throw Exception("Animation.newSpriteSheetFromSequence: failed '%s'", path.c_str());
158 if (frame->getFormat() != "RGBA8")
159 throw Exception("Animation.newSpriteSheetFromSequence: '%s' must be RGBA8", path.c_str());
160 if (frames.empty()) {
161 frameW = frame->getWidth();
162 frameH = frame->getHeight();
163 } else if (frame->getWidth() != frameW || frame->getHeight() != frameH) {
164 throw Exception("Animation.newSpriteSheetFromSequence: frame size mismatch at '%s'",
165 path.c_str());
166 }
167 frames.push_back(frame);
168 int minX = frameW, minY = frameH, maxX = -1, maxY = -1;
169 for (int py = 0; py < frameH; ++py) {
170 for (int px = 0; px < frameW; ++px) {
171 if (frame->getPixel(px, py).a <= 1.f / 255.f) continue;
172 minX = std::min(minX, px); minY = std::min(minY, py);
173 maxX = std::max(maxX, px); maxY = std::max(maxY, py);
174 }
175 }
176 Bounds b;
177 if (maxX >= minX && maxY >= minY)
178 b = {minX, minY, maxX - minX + 1, maxY - minY + 1};
179 bounds.push_back(b);
180 packedW = std::max(packedW, b.w);
181 packedH = std::max(packedH, b.h);
182 }
183
184 constexpr int padding = 1;
185 const int cellW = packedW + padding * 2;
186 const int cellH = packedH + padding * 2;
187 std::unique_ptr<image::ImageData> atlas(
188 images->newImageData(columns * cellW, rows * cellH, "RGBA8"));
189 auto *sheet = new SpriteSheet();
190 try {
191 for (int i = 0; i < count; ++i) {
192 const int cellX = (i % columns) * cellW;
193 const int cellY = (i / columns) * cellH;
194 const int x = cellX + padding;
195 const int y = cellY + padding;
196 image::ImageData *frame = frames[static_cast<size_t>(i)];
197 const Bounds &b = bounds[size_t(i)];
198 atlas->paste(frame, x, y, b.x, b.y, b.w, b.h);
199 atlas->paste(frame, x, cellY, b.x, b.y, b.w, 1);
200 atlas->paste(frame, x, y + b.h, b.x, b.y + b.h - 1, b.w, 1);
201 atlas->paste(frame, cellX, y, b.x, b.y, 1, b.h);
202 atlas->paste(frame, x + b.w, y, b.x + b.w - 1, b.y, 1, b.h);
203 atlas->paste(frame, cellX, cellY, b.x, b.y, 1, 1);
204 atlas->paste(frame, x + b.w, cellY, b.x + b.w - 1, b.y, 1, 1);
205 atlas->paste(frame, cellX, y + b.h, b.x, b.y + b.h - 1, 1, 1);
206 atlas->paste(frame, x + b.w, y + b.h, b.x + b.w - 1, b.y + b.h - 1, 1, 1);
207 sheet->addFrameTrimmed(std::to_string(first + i), x, y, b.w, b.h,
208 frameW, frameH, b.x, b.y);
209 }
210 sheet->setTexture(gfx->newTextureFromImageData(atlas.get()));
211 spriteSequenceCache_[cacheKey].reset(sheet->clone());
212 } catch (...) {
213 delete sheet;
214 throw;
215 }
216 return sheet;
217}
218
219int Animation::getSpriteSequenceCacheCount() const { return int(spriteSequenceCache_.size()); }
221 int bytes = 0;
222 for (const auto &entry : spriteSequenceCache_) {
223 auto *texture = entry.second->getTexture();
224 if (texture) bytes += texture->getWidth() * texture->getHeight() * 4;
225 }
226 return bytes;
227}
228void Animation::clearSpriteSequenceCache() { spriteSequenceCache_.clear(); }
229
231 const std::string &texturePath,
232 const std::string &jsonPath) {
233 if (!gfx) throw Exception("Animation.newSpriteSheetFromAtlasJson: gfx is null");
234 auto *fs = ModuleManager::getInstance<filesystem::Filesystem>("Filesystem");
235 if (!fs) fs = filesystem::Filesystem::create();
236 std::unique_ptr<filesystem::FileData> file(fs->read(jsonPath));
237 std::string text(static_cast<const char *>(file->getData()), size_t(file->getSize()));
238 auto *dm = data::DataModule::create();
239 std::string error;
240 std::unique_ptr<data::JsonDocument> doc(dm->decodeJson(text, &error));
241 if (!doc || !doc->isObject()) throw Exception("Atlas JSON: %s", error.c_str());
242 auto root = doc->object();
243 if (!root->has("frames")) throw Exception("Atlas JSON: missing frames");
244 auto frames = root->getObject("frames");
245 if (!frames) throw Exception("Atlas JSON: frames must be an object");
246 // TexturePacker JSON Hash stores logical (unrotated) frame.w/h even for
247 // clockwise-packed frames. Normalize pixels once at import, keeping the
248 // ordinary Quad/Sprite2D UV and trimmed-layout contract unchanged.
249 bool normalize = false;
250 int cellW = 0, cellH = 0;
251 const auto names = frames->getNames();
252 for (const auto &name : names) {
253 auto item = frames->getObject(name);
254 auto rect = item->getObject("frame");
255 const int w = rect->getValue<int>("w"), h = rect->getValue<int>("h");
256 if (w <= 0 || h <= 0)
257 throw Exception("Atlas JSON '%s', frame '%s': invalid frame dimensions", jsonPath.c_str(), name.c_str());
258 normalize |= item->optValue<bool>("rotated", false);
259 cellW = std::max(cellW, w);
260 cellH = std::max(cellH, h);
261 }
262 // Image::newImageDataFromFile borrows from ResourceManager's cache.
263 image::ImageData *source = nullptr;
264 std::unique_ptr<image::ImageData> atlas;
265 int columns = 1;
266 if (normalize) {
267 if (cellW > 16382 || cellH > 16382)
268 throw Exception("Atlas JSON '%s': normalized frame exceeds 16384 pixels including padding",
269 jsonPath.c_str());
270 cellW += 2;
271 cellH += 2;
272 auto *images = image::Image::create();
273 source = images->newImageDataFromFile(texturePath);
274 columns = static_cast<int>(std::ceil(std::sqrt(double(names.size()))));
275 const size_t rows = (names.size() + size_t(columns) - 1) / size_t(columns);
276 if (size_t(cellW) * size_t(columns) > 16384 || size_t(cellH) * rows > 16384)
277 throw Exception("Atlas JSON '%s': normalized atlas exceeds 16384 pixels; split the atlas",
278 jsonPath.c_str());
279 atlas.reset(images->newImageData(cellW * columns, cellH * int(rows), "RGBA8"));
280 }
281 auto *sheet = new SpriteSheet();
282 try {
283 int index = 0;
284 for (const auto &name : names) {
285 auto item = frames->getObject(name);
286 auto rect = item->getObject("frame");
287 auto src = item->getObject("spriteSourceSize");
288 auto size = item->getObject("sourceSize");
289 const int w = rect->getValue<int>("w"), h = rect->getValue<int>("h");
290 int x = rect->getValue<int>("x"), y = rect->getValue<int>("y");
291 const int sourceW = size ? size->getValue<int>("w") : w;
292 const int sourceH = size ? size->getValue<int>("h") : h;
293 const int offsetX = src ? src->getValue<int>("x") : 0;
294 const int offsetY = src ? src->getValue<int>("y") : 0;
295 if (sourceW < w || sourceH < h || offsetX < 0 || offsetY < 0 || offsetX > sourceW - w ||
296 offsetY > sourceH - h || (src && (src->getValue<int>("w") != w || src->getValue<int>("h") != h)))
297 throw Exception("Atlas JSON '%s', frame '%s': inconsistent trimmed layout", jsonPath.c_str(),
298 name.c_str());
299 if (normalize) {
300 const bool rotated = item->optValue<bool>("rotated", false);
301 const int packedW = rotated ? h : w, packedH = rotated ? w : h;
302 if (x < 0 || y < 0 || packedW > source->getWidth() || packedH > source->getHeight() ||
303 x > source->getWidth() - packedW || y > source->getHeight() - packedH)
304 throw Exception("Atlas JSON '%s', frame '%s': packed rectangle outside texture", jsonPath.c_str(),
305 name.c_str());
306 const int dx = (index % columns) * cellW + 1;
307 const int dy = (index / columns) * cellH + 1;
308 // Include one extruded border pixel to prevent linear-filter bleed.
309 for (int py = -1; py <= h; ++py) {
310 for (int px = -1; px <= w; ++px) {
311 const int u = std::clamp(px, 0, w - 1);
312 const int v = std::clamp(py, 0, h - 1);
313 const int sx = x + (rotated ? h - 1 - v : u);
314 const int sy = y + (rotated ? u : v);
315 atlas->setPixel(dx + px, dy + py, source->getPixel(sx, sy));
316 }
317 }
318 x = dx;
319 y = dy;
320 }
321 sheet->addFrameTrimmed(name, x, y, w, h, sourceW, sourceH, offsetX, offsetY);
322 ++index;
323 }
324 sheet->setTexture(normalize ? gfx->newTextureFromImageData(atlas.get()) : gfx->newTextureFromFile(texturePath));
325 } catch (...) { delete sheet; throw; }
326 return sheet;
327}
328
329SpriteClip *Animation::newSpriteClip(const std::string &name) { return new SpriteClip(name); }
330
332 auto *a = new SpriteAnim();
333 registerSpriteAnim(a);
334 return a;
335}
336
338
340
344
346 auto *a = new SpineAnim(skeleton);
347 registerSpineAnim(a);
348 return a;
349}
350
352 auto *atlas = new SpineAtlas();
353 std::string err;
354 if (!atlas->loadFromFile(path, &err)) {
355 delete atlas;
356 return nullptr;
357 }
358 return atlas;
359}
360
362 auto *atlas = new SpineAtlas();
363 std::string err;
364 if (!atlas->loadFromText(text, &err)) {
365 delete atlas;
366 return nullptr;
367 }
368 return atlas;
369}
370
372 auto *data = new SpineSkeletonData();
373 std::string err;
374 if (!data->loadFromFile(path, &err)) {
375 delete data;
376 return nullptr;
377 }
378 return data;
379}
380
382 auto *data = new SpineSkeletonData();
383 std::string err;
384 if (!data->loadFromJson(json, &err)) {
385 delete data;
386 return nullptr;
387 }
388 return data;
389}
390
392
393AnimClip *Animation::newClip(const std::string &name) { return new AnimClip(name); }
394
395AnimPose *Animation::newPose(int boneCount) { return new AnimPose(boneCount); }
403
404int Animation::setupHairChain(DynamicBoneSolver *solver, const std::string &rootBone,
405 const std::string &tipBone, float stiffness, float damping,
406 float inertia, float endLength, bool selfCollision) {
407 if (!solver) return -1;
409 desc.rootBone = rootBone;
410 desc.tipBone = tipBone;
411 desc.stiffness = stiffness;
412 desc.damping = damping;
413 desc.inertia = inertia;
414 desc.endLength = endLength;
415 desc.selfCollision = selfCollision;
416 auto result = hair::addChain(*solver, desc);
417 return result ? result.value() : -1;
418}
419
420int Animation::setupHairHeadCollider(DynamicBoneSolver *solver, const std::string &boneName,
421 float radius) {
422 if (!solver) return -1;
423 auto result = hair::addHeadCollider(*solver, boneName, radius);
424 return result ? result.value() : -1;
425}
428
429AnimPlayer *Animation::newPlayer(AnimSkeleton *skeleton) { return new AnimPlayer(skeleton); }
430AnimGraph *Animation::newGraph(AnimSkeleton *skeleton) { return new AnimGraph(skeleton); }
431
433
435
439
441 return new MotionDatabase(skeleton);
442}
443
445 return new MotionMatcher(skeleton, database);
446}
447
448ControlAnim *Animation::newControlAnim(float frequencyHz, float dampingZeta, float response) {
449 return new ControlAnim(frequencyHz, dampingZeta, response);
450}
451
453
457
459 AnimSkeleton *sk = nullptr;
460 AnimClip *clip = nullptr;
462 delete clip;
463 return sk;
464}
465
467 AnimSkeleton *sk = nullptr;
468 AnimClip *clip = nullptr;
470 delete sk;
472 return clip;
473}
474
475AnimLattice *Animation::newLattice(int divX, int divY, int divZ) {
476 return new AnimLattice(divX, divY, divZ);
477}
478
480
482 return MotionBuilder(motions_, from, to, duration);
483}
484
488
492
494
498
502
506
510
514
518
522
526
527
528
529void Animation::registerTween(Tween *t) {
530 if (!t) return;
531 t->setOwner(this);
532 if (std::find(tweens_.begin(), tweens_.end(), t) == tweens_.end()) tweens_.push_back(t);
533}
534
535void Animation::unregisterTween(Tween *t) {
536 if (!t) return;
537 auto it = std::find(tweens_.begin(), tweens_.end(), t);
538 if (it != tweens_.end()) tweens_.erase(it);
539 if (t->owner() == this) t->setOwner(nullptr);
540}
541
542void Animation::registerSpriteAnim(SpriteAnim *a) {
543 if (!a) return;
544 a->setOwner(this);
545 if (std::find(spriteAnims_.begin(), spriteAnims_.end(), a) == spriteAnims_.end())
546 spriteAnims_.push_back(a);
547}
548
549void Animation::unregisterSpriteAnim(SpriteAnim *a) {
550 if (!a) return;
551 auto it = std::find(spriteAnims_.begin(), spriteAnims_.end(), a);
552 if (it != spriteAnims_.end()) spriteAnims_.erase(it);
553 if (a->owner() == this) a->setOwner(nullptr);
554}
555
556void Animation::registerSpineAnim(SpineAnim *a) {
557 if (!a) return;
558 a->setOwner(this);
559 if (std::find(spineAnims_.begin(), spineAnims_.end(), a) == spineAnims_.end())
560 spineAnims_.push_back(a);
561}
562
563void Animation::unregisterSpineAnim(SpineAnim *a) {
564 if (!a) return;
565 auto it = std::find(spineAnims_.begin(), spineAnims_.end(), a);
566 if (it != spineAnims_.end()) spineAnims_.erase(it);
567 if (a->owner() == this) a->setOwner(nullptr);
568}
569
571 if (step.delta.nanoseconds() < 0)
573 "animation simulation delta must be non-negative"));
574 if (hasLastTick_ && step.tick <= lastTick_)
576 eve::DiagnosticCode::Conflict, "animation simulation tick must advance monotonically"));
577
578 const float dt = static_cast<float>(step.delta.seconds());
579 if (!std::isfinite(dt))
581 "animation simulation delta is outside float range"));
582
583 // Preflight every live child before mutating any of them. A child may also
584 // be driven directly by a caller, so the host must preserve all-or-none
585 // behavior when one child has already consumed this tick.
586 for (Tween *t : tweens_) {
587 if (t && t->isActive() && t->hasCurrentTick() && step.tick <= t->currentTick())
589 eve::DiagnosticCode::Conflict, "animation Tween child already consumed this tick"));
590 }
591 for (SpriteAnim *a : spriteAnims_) {
592 if (a && a->isPlaying() && a->hasCurrentTick() && step.tick <= a->currentTick())
594 eve::DiagnosticCode::Conflict, "animation SpriteAnim child already consumed this tick"));
595 }
596 for (SpineAnim *a : spineAnims_) {
597 if (a && a->isPlaying() && a->hasCurrentTick() && step.tick <= a->currentTick())
599 eve::DiagnosticCode::Conflict, "animation SpineAnim child already consumed this tick"));
600 }
601 if (motions_.hasCurrentTick() && step.tick <= motions_.currentTick())
603 eve::DiagnosticCode::Conflict, "animation MotionRuntime already consumed this tick"));
604
605 // Copy pointer lists: destructors during update must not invalidate iteration.
606 std::vector<Tween *> tweenSnap = tweens_;
607 for (Tween *t : tweenSnap) {
608 if (!t) continue;
609 if (t->isActive()) {
610 auto result = t->advance(step);
611 if (!result) return eve::Result<void>::failure(result.status());
612 }
613 }
614 std::vector<SpriteAnim *> spriteSnap = spriteAnims_;
615 for (SpriteAnim *a : spriteSnap) {
616 if (a && a->isPlaying()) {
617 auto result = a->advance(step);
618 if (!result) return eve::Result<void>::failure(result.status());
619 }
620 }
621 std::vector<SpineAnim *> spineSnap = spineAnims_;
622 for (SpineAnim *a : spineSnap) {
623 if (a && a->isPlaying()) {
624 auto result = a->advance(step);
625 if (!result) return eve::Result<void>::failure(result.status());
626 }
627 }
628
629 {
630 auto result = motions_.advance(step);
631 if (!result) return eve::Result<void>::failure(result.status());
632 }
633
634 lastTick_ = step.tick;
635 hasLastTick_ = true;
637}
638
640 EV_PROFILE_MODULE("animation", "Animation::update");
642 if (!duration) {
643 duration.ignore("legacy animation update received an invalid duration");
644 return;
645 }
646 auto nextTick = hasLastTick_ ? lastTick_.incremented() : std::optional<eve::SimulationTick>(eve::SimulationTick(1));
647 if (!nextTick) {
649 eve::Diagnostic::error(eve::DiagnosticCode::InvariantViolation, "animation simulation tick overflow"))
650 .ignore("legacy animation update tick overflow");
651 return;
652 }
653 advance({*nextTick, std::move(duration).takeValue()}).ignore("legacy animation update facade");
654}
655
657 int n = motions_.activeCount();
658 for (const Tween *t : tweens_) {
659 if (t && t->isActive()) ++n;
660 }
661 for (const SpriteAnim *a : spriteAnims_) {
662 if (a && a->isPlaying()) ++n;
663 }
664 for (const SpineAnim *a : spineAnims_) {
665 if (a && a->isPlaying()) ++n;
666 }
667 return n;
668}
669
671 auto it = tweens_.begin();
672 while (it != tweens_.end()) {
673 Tween *t = *it;
674 if (!t || t->isFinished() || t->isStopped()) {
675 if (t && t->owner() == this) t->setOwner(nullptr);
676 it = tweens_.erase(it);
677 } else {
678 ++it;
679 }
680 }
681}
682
684 for (Tween *t : tweens_) {
685 if (t && t->owner() == this) t->setOwner(nullptr);
686 }
687 tweens_.clear();
688}
689
690void Animation::expose(ssq::Table &table) {
691 auto cls = table.addClass(name, Animation::create, false);
692 expose(cls);
694
695 auto tw = table.addClass<Tween>(
696 "Tween", std::function<Tween *()>([]() -> Tween * { return nullptr; }), true);
697 tw.addFunc("setFrom", &Tween::setFrom);
698 tw.addFunc("setTo", &Tween::setTo);
699 tw.addFunc("setDelta", &Tween::setDelta);
700 tw.addFunc("setFromAngle", &Tween::setFromAngle);
701 tw.addFunc("setToAngle", &Tween::setToAngle);
702 tw.addFunc("setDeltaAngle", &Tween::setDeltaAngle);
703 tw.addFunc("has", &Tween::has);
704 tw.addFunc("get", &Tween::get);
705 tw.addFunc("getFrom", &Tween::getFrom);
706 tw.addFunc("getTo", &Tween::getTo);
707 tw.addFunc("getDelta", &Tween::getDelta);
708 tw.addFunc("setDuration", &Tween::setDuration);
709 tw.addFunc("getDuration", &Tween::getDuration);
710 tw.addFunc("setDelay", &Tween::setDelay);
711 tw.addFunc("getDelay", &Tween::getDelay);
712 tw.addFunc("setEase", &Tween::setEase);
713 tw.addFunc("getEase", &Tween::getEase);
714 tw.addFunc("setRepeat", &Tween::setRepeat);
715 tw.addFunc("getRepeat", &Tween::getRepeat);
716 tw.addFunc("setYoyo", &Tween::setYoyo);
717 tw.addFunc("getYoyo", &Tween::getYoyo);
718 tw.addFunc("start", &Tween::start);
719 tw.addFunc("pause", &Tween::pause);
720 tw.addFunc("resume", &Tween::resume);
721 tw.addFunc("stop", &Tween::stop);
722 tw.addFunc("reset", &Tween::reset);
723 tw.addFunc("isRunning", &Tween::isRunning);
724 tw.addFunc("isPaused", &Tween::isPaused);
725 tw.addFunc("isFinished", &Tween::isFinished);
726 tw.addFunc("isStopped", &Tween::isStopped);
727 tw.addFunc("isDelayed", &Tween::isDelayed);
728 tw.addFunc("isActive", &Tween::isActive);
729 tw.addFunc("getElapsed", &Tween::getElapsed);
730 tw.addFunc("getProgress", &Tween::getProgress);
731 tw.addFunc("getEasedProgress", &Tween::getEasedProgress);
732 tw.addFunc("update", &Tween::update);
733 tw.addFunc("evaluate", &Tween::evaluate);
734 tw.addFunc("getPropertyCount", &Tween::getPropertyCount);
735 tw.addFunc("getPropertyName", &Tween::getPropertyName);
736
737 auto sk = table.addClass<AnimSkeleton>(
738 "AnimSkeleton", std::function<AnimSkeleton *()>([]() -> AnimSkeleton * { return nullptr; }),
739 true);
740 sk.addFunc("addBone", &AnimSkeleton::addBone);
741 sk.addFunc("getBoneCount", &AnimSkeleton::getBoneCount);
742 sk.addFunc("getBoneName", &AnimSkeleton::getBoneName);
743 sk.addFunc("findBone", &AnimSkeleton::findBone);
744 sk.addFunc("getParent", &AnimSkeleton::getParent);
745 sk.addFunc("setBindPosition", &AnimSkeleton::setBindPosition);
746 sk.addFunc("setBindRotation", &AnimSkeleton::setBindRotation);
747 sk.addFunc("setBindScale", &AnimSkeleton::setBindScale);
748 sk.addFunc("setBoneLodLimit", &AnimSkeleton::setBoneLodLimit);
749 sk.addFunc("getBoneLodLimit", &AnimSkeleton::getBoneLodLimit);
750 sk.addFunc("getBindPositionX", &AnimSkeleton::getBindPositionX);
751 sk.addFunc("getBindPositionY", &AnimSkeleton::getBindPositionY);
752 sk.addFunc("getBindPositionZ", &AnimSkeleton::getBindPositionZ);
753 sk.addFunc("getBindRotationX", &AnimSkeleton::getBindRotationX);
754 sk.addFunc("getBindRotationY", &AnimSkeleton::getBindRotationY);
755 sk.addFunc("getBindRotationZ", &AnimSkeleton::getBindRotationZ);
756 sk.addFunc("getBindRotationW", &AnimSkeleton::getBindRotationW);
757 sk.addFunc("getBindScaleX", &AnimSkeleton::getBindScaleX);
758 sk.addFunc("getBindScaleY", &AnimSkeleton::getBindScaleY);
759 sk.addFunc("getBindScaleZ", &AnimSkeleton::getBindScaleZ);
760 sk.addFunc("applyBindPose", &AnimSkeleton::applyBindPose);
761
763
764 auto pose = table.addClass<AnimPose>(
765 "AnimPose", std::function<AnimPose *()>([]() -> AnimPose * { return nullptr; }), true);
766 pose.addFunc("resize", &AnimPose::resize);
767 // Adapt the noexcept native member to the Squirrel binding pointer type.
768 pose.addFunc("getBoneCount", static_cast<int (AnimPose::*)() const>(&AnimPose::getBoneCount));
769 pose.addFunc("copyFrom", &AnimPose::copyFrom);
770 pose.addFunc("blendFrom", &AnimPose::blendFrom);
771 pose.addFunc("setLocalPosition", &AnimPose::setLocalPosition);
772 pose.addFunc("setLocalRotation", &AnimPose::setLocalRotation);
773 pose.addFunc("setLocalScale", &AnimPose::setLocalScale);
774 pose.addFunc("getLocalPositionX", &AnimPose::getLocalPositionX);
775 pose.addFunc("getLocalPositionY", &AnimPose::getLocalPositionY);
776 pose.addFunc("getLocalPositionZ", &AnimPose::getLocalPositionZ);
777 pose.addFunc("getLocalRotationX", &AnimPose::getLocalRotationX);
778 pose.addFunc("getLocalRotationY", &AnimPose::getLocalRotationY);
779 pose.addFunc("getLocalRotationZ", &AnimPose::getLocalRotationZ);
780 pose.addFunc("getLocalRotationW", &AnimPose::getLocalRotationW);
781 pose.addFunc("getLocalScaleX", &AnimPose::getLocalScaleX);
782 pose.addFunc("getLocalScaleY", &AnimPose::getLocalScaleY);
783 pose.addFunc("getLocalScaleZ", &AnimPose::getLocalScaleZ);
784 pose.addFunc("computeWorld", &AnimPose::computeWorld);
785 pose.addFunc("aimBone", &AnimPose::aimBone);
786 pose.addFunc("solveTwoBoneIK", &AnimPose::solveTwoBoneIK);
787 pose.addFunc("getWorldPositionX", &AnimPose::getWorldPositionX);
788 pose.addFunc("getWorldPositionY", &AnimPose::getWorldPositionY);
789 pose.addFunc("getWorldPositionZ", &AnimPose::getWorldPositionZ);
790 pose.addFunc("getWorldRotationX", &AnimPose::getWorldRotationX);
791 pose.addFunc("getWorldRotationY", &AnimPose::getWorldRotationY);
792 pose.addFunc("getWorldRotationZ", &AnimPose::getWorldRotationZ);
793 pose.addFunc("getWorldRotationW", &AnimPose::getWorldRotationW);
794 pose.addFunc("getWorldMatrixElement", &AnimPose::getWorldMatrixElement);
795
796 auto batch = table.addClass<AnimBatch>(
797 "AnimBatch", std::function<AnimBatch *()>([]() -> AnimBatch * { return nullptr; }), true);
798 batch.addFunc("add", &AnimBatch::add);
799 batch.addFunc("clear", &AnimBatch::clear);
800 batch.addFunc("getCount", &AnimBatch::getCount);
801 batch.addFunc("evaluate", &AnimBatch::evaluate);
802 batch.addFunc("getLastWorkerCount", &AnimBatch::getLastWorkerCount);
803
804 auto constraints = table.addClass<AnimConstraintStack>(
805 "AnimConstraintStack", std::function<AnimConstraintStack *()>([]() -> AnimConstraintStack * { return nullptr; }),
806 true);
807 constraints.addFunc("clear", &AnimConstraintStack::clear);
808 constraints.addFunc("getCount", &AnimConstraintStack::getCount);
809 constraints.addFunc("setSkeleton", &AnimConstraintStack::setSkeleton);
810 constraints.addFunc("getSkeleton", &AnimConstraintStack::getSkeleton);
811 constraints.addFunc("addAim", &AnimConstraintStack::addAim);
812 constraints.addFunc("addTwoBoneIK", &AnimConstraintStack::addTwoBoneIK);
813 constraints.addFunc("addFootIK", &AnimConstraintStack::addFootIK);
814 constraints.addFunc("apply", &AnimConstraintStack::apply);
815
816 auto sync = table.addClass<AnimSyncGroup>(
817 "AnimSyncGroup", std::function<AnimSyncGroup *()>([]() -> AnimSyncGroup * { return nullptr; }), true);
818 sync.addFunc("addPlayer", &AnimSyncGroup::addPlayer);
819 sync.addFunc("clear", &AnimSyncGroup::clear);
820 sync.addFunc("getCount", &AnimSyncGroup::getCount);
821 sync.addFunc("setLeader", &AnimSyncGroup::setLeader);
822 sync.addFunc("getLeader", &AnimSyncGroup::getLeader);
823 sync.addFunc("update", &AnimSyncGroup::update);
824 sync.addFunc("getPhase", &AnimSyncGroup::getPhase);
825 sync.addFunc("getUsedMarkerSync", &AnimSyncGroup::getUsedMarkerSync);
826
827 auto skin = table.addClass<AnimSkin>(
828 "AnimSkin", std::function<AnimSkin *()>([]() -> AnimSkin * { return nullptr; }), true);
829 skin.addFunc("getVertexCount", &AnimSkin::getVertexCount);
830 skin.addFunc("getBoneCount", &AnimSkin::getBoneCount);
831 skin.addFunc("getInfluenceCount", &AnimSkin::getInfluenceCount);
832 skin.addFunc("getSkeletonBone", &AnimSkin::getSkeletonBone);
833 skin.addFunc("getSkinBoneName", &AnimSkin::getSkinBoneName);
834 skin.addFunc("getInverseBindElement", &AnimSkin::getInverseBindElement);
835 skin.addFunc("updateMatrixPalette", &AnimSkin::updateMatrixPalette);
836 skin.addFunc("getMatrixPaletteElement", &AnimSkin::getMatrixPaletteElement);
837 skin.addFunc("bindGpuMesh", &AnimSkin::bindGpuMesh);
838 skin.addFunc("updateGpuMesh", &AnimSkin::updateGpuMesh);
839 skin.addFunc("getBindPositionX", &AnimSkin::getBindPositionX);
840 skin.addFunc("getBindPositionY", &AnimSkin::getBindPositionY);
841 skin.addFunc("getBindPositionZ", &AnimSkin::getBindPositionZ);
842 skin.addFunc("getVertexBone", &AnimSkin::getVertexBone);
843 skin.addFunc("getVertexSkinJoint", &AnimSkin::getVertexSkinJoint);
844 skin.addFunc("getVertexWeight", &AnimSkin::getVertexWeight);
845 skin.addFunc("updateSkinnedPositions", &AnimSkin::updateSkinnedPositions);
846 skin.addFunc("hasSkinnedPositions", &AnimSkin::hasSkinnedPositions);
847 skin.addFunc("getSkinnedPositionX", &AnimSkin::getSkinnedPositionX);
848 skin.addFunc("getSkinnedPositionY", &AnimSkin::getSkinnedPositionY);
849 skin.addFunc("getSkinnedPositionZ", &AnimSkin::getSkinnedPositionZ);
850 skin.addFunc("getSkinnedPositions", &AnimSkin::getSkinnedPositions);
851 skin.addFunc("updateSkinnedNormals", &AnimSkin::updateSkinnedNormals);
852 skin.addFunc("hasSkinnedNormals", &AnimSkin::hasSkinnedNormals);
853 skin.addFunc("getSkinnedNormals", &AnimSkin::getSkinnedNormals);
854 skin.addFunc("applyToMesh",
855 std::function<bool(AnimSkin *, graphics::Graphics *,
856 graphics::Mesh *, AnimPose *)>(
858
859 auto lattice = table.addClass<AnimLattice>(
860 "AnimLattice", std::function<AnimLattice *()>([]() -> AnimLattice * { return nullptr; }),
861 true);
862 lattice.addFunc("setDivisions", &AnimLattice::setDivisions);
863 lattice.addFunc("getDivisionsX", &AnimLattice::getDivisionsX);
864 lattice.addFunc("getDivisionsY", &AnimLattice::getDivisionsY);
865 lattice.addFunc("getDivisionsZ", &AnimLattice::getDivisionsZ);
866 lattice.addFunc("setSize", &AnimLattice::setSize);
867 lattice.addFunc("getSizeX", &AnimLattice::getSizeX);
868 lattice.addFunc("getSizeY", &AnimLattice::getSizeY);
869 lattice.addFunc("getSizeZ", &AnimLattice::getSizeZ);
870 lattice.addFunc("setOrigin", &AnimLattice::setOrigin);
871 lattice.addFunc("getOriginX", &AnimLattice::getOriginX);
872 lattice.addFunc("getOriginY", &AnimLattice::getOriginY);
873 lattice.addFunc("getOriginZ", &AnimLattice::getOriginZ);
874 lattice.addFunc("setClamp", &AnimLattice::setClamp);
875 lattice.addFunc("getClamp", &AnimLattice::getClamp);
876 lattice.addFunc("getPointCount", &AnimLattice::getPointCount);
877 lattice.addFunc("setPointScale", &AnimLattice::setPointScale);
878 lattice.addFunc("setPointOffset", &AnimLattice::setPointOffset);
879 lattice.addFunc("setScale", &AnimLattice::setScale);
880 lattice.addFunc("reset", &AnimLattice::reset);
881 lattice.addFunc("getPointScaleX", &AnimLattice::getPointScaleX);
882 lattice.addFunc("getPointScaleY", &AnimLattice::getPointScaleY);
883 lattice.addFunc("getPointScaleZ", &AnimLattice::getPointScaleZ);
884 lattice.addFunc("getPointOffsetX", &AnimLattice::getPointOffsetX);
885 lattice.addFunc("getPointOffsetY", &AnimLattice::getPointOffsetY);
886 lattice.addFunc("getPointOffsetZ", &AnimLattice::getPointOffsetZ);
887 lattice.addFunc("bindModel", &AnimLattice::bindModel);
888 lattice.addFunc("bindPositionsFromArray",
889 std::function<void(AnimLattice *, ssq::Array)>(bindPositionsFromArray));
890 lattice.addFunc("clearBind", &AnimLattice::clearBind);
891 lattice.addFunc("getVertexCount", &AnimLattice::getVertexCount);
892 lattice.addFunc("getBindPositionX", &AnimLattice::getBindPositionX);
893 lattice.addFunc("getBindPositionY", &AnimLattice::getBindPositionY);
894 lattice.addFunc("getBindPositionZ", &AnimLattice::getBindPositionZ);
895 lattice.addFunc(
896 "updateDeformedPositions",
897 static_cast<bool (AnimLattice::*)()>(&AnimLattice::updateDeformedPositions));
898 lattice.addFunc(
899 "updateDeformedPositionsFromArray",
900 std::function<bool(AnimLattice *, ssq::Array)>(updateDeformedPositionsFromArray));
901 lattice.addFunc(
902 "updateDeformedNormalsFromArray",
903 std::function<bool(AnimLattice *, ssq::Array, ssq::Array)>(
904 updateDeformedNormalsFromArray));
905 lattice.addFunc("hasDeformedPositions", &AnimLattice::hasDeformedPositions);
906 lattice.addFunc("hasDeformedNormals", &AnimLattice::hasDeformedNormals);
907 lattice.addFunc("getDeformedPositionX", &AnimLattice::getDeformedPositionX);
908 lattice.addFunc("getDeformedPositionY", &AnimLattice::getDeformedPositionY);
909 lattice.addFunc("getDeformedPositionZ", &AnimLattice::getDeformedPositionZ);
910 lattice.addFunc("getDeformedPositions", &AnimLattice::getDeformedPositions);
911 lattice.addFunc("getDeformedNormals", &AnimLattice::getDeformedNormals);
912
915
916 auto graph = table.addClass<AnimGraph>(
917 "AnimGraph", std::function<AnimGraph *()>([]() -> AnimGraph * { return nullptr; }), true);
918 graph.addFunc("addClip", &AnimGraph::addClip);
919 graph.addFunc("addBlend", &AnimGraph::addBlend);
920 graph.addFunc("addAdditive", &AnimGraph::addAdditive);
921 graph.addFunc("addLayer", &AnimGraph::addLayer);
922 graph.addFunc("addOneShot", &AnimGraph::addOneShot);
923 graph.addFunc("addBlendSpace1D", &AnimGraph::addBlendSpace1D);
924 graph.addFunc("addBlendSpace2D", &AnimGraph::addBlendSpace2D);
925 graph.addFunc("addBlendSpace1DPoint", &AnimGraph::addBlendSpace1DPoint);
926 graph.addFunc("addBlendSpace2DPoint", &AnimGraph::addBlendSpace2DPoint);
927 graph.addFunc("setBoneMask", &AnimGraph::setBoneMask);
928 graph.addFunc("clearBoneMask", &AnimGraph::clearBoneMask);
929 graph.addFunc("setRoot", &AnimGraph::setRoot);
930 graph.addFunc("getRoot", &AnimGraph::getRoot);
931 graph.addFunc("getNodeCount", &AnimGraph::getNodeCount);
932 graph.addFunc("setWeight", &AnimGraph::setWeight);
933 graph.addFunc("setPosition1D", &AnimGraph::setPosition1D);
934 graph.addFunc("setPosition2D", &AnimGraph::setPosition2D);
935 graph.addFunc("setSpeed", &AnimGraph::setSpeed);
936 graph.addFunc("trigger", &AnimGraph::trigger);
937 graph.addFunc("isOneShotActive", &AnimGraph::isOneShotActive);
938 graph.addFunc("setAdditiveReference", &AnimGraph::setAdditiveReferenceCompat);
939 graph.addFunc("getAdditiveReference", &AnimGraph::getAdditiveReference);
940 graph.addFunc("getPose", &AnimGraph::getPose);
941 graph.addFunc("update", &AnimGraph::update);
942
943 auto mask = table.addClass<AnimBoneMask>(
944 "AnimBoneMask", std::function<AnimBoneMask*()>([]() -> AnimBoneMask* { return nullptr; }), true);
945 mask.addFunc("setAll", &AnimBoneMask::setAll);
946 mask.addFunc("setBoneWeight", &AnimBoneMask::setBoneWeight);
947 mask.addFunc("setBoneWeightByName", &AnimBoneMask::setBoneWeightByName);
948 mask.addFunc("setBoneAndChildren", &AnimBoneMask::setBoneAndChildren);
949 mask.addFunc("getBoneWeight", &AnimBoneMask::getBoneWeight);
950 mask.addFunc("getBoneCount", &AnimBoneMask::getBoneCount);
951
952 auto mixer = table.addClass<AnimLayerMixer>(
953 "AnimLayerMixer", std::function<AnimLayerMixer*()>([]() -> AnimLayerMixer* { return nullptr; }), true);
954 mixer.addFunc("setBasePlayer", &AnimLayerMixer::setBasePlayer);
955 mixer.addFunc("setBaseGraph", &AnimLayerMixer::setBaseGraph);
956 mixer.addFunc("setBaseStateMachine", &AnimLayerMixer::setBaseStateMachine);
957 mixer.addFunc("getBasePlayer", &AnimLayerMixer::getBasePlayer);
958 mixer.addFunc("addLayer", &AnimLayerMixer::addLayer);
959 mixer.addFunc("addGraphLayer", &AnimLayerMixer::addGraphLayer);
960 mixer.addFunc("addStateMachineLayer", &AnimLayerMixer::addStateMachineLayer);
961 mixer.addFunc("removeLayer", &AnimLayerMixer::removeLayer);
962 mixer.addFunc("setLayerWeight", &AnimLayerMixer::setLayerWeight);
963 mixer.addFunc("setLayerEnabled", &AnimLayerMixer::setLayerEnabled);
964 mixer.addFunc("setLayerAdditiveReference", &AnimLayerMixer::setLayerAdditiveReferenceCompat);
965 mixer.addFunc("getLayerCount", &AnimLayerMixer::getLayerCount);
966 mixer.addFunc("getLayerName", &AnimLayerMixer::getLayerName);
967 mixer.addFunc("getLayerWeight", &AnimLayerMixer::getLayerWeight);
968 mixer.addFunc("getLayerEnabled", &AnimLayerMixer::getLayerEnabled);
969 mixer.addFunc("getLayerMode", &AnimLayerMixer::getLayerMode);
970 mixer.addFunc("getLayerAdditiveReference", &AnimLayerMixer::getLayerAdditiveReference);
971 mixer.addFunc("update", &AnimLayerMixer::update);
972 mixer.addFunc("getPose", &AnimLayerMixer::getPose);
973 mixer.addFunc("getEventCount", &AnimLayerMixer::getEventCount);
974 mixer.addFunc("getEventLayer", &AnimLayerMixer::getEventLayer);
975 mixer.addFunc("getEventName", &AnimLayerMixer::getEventName);
976 mixer.addFunc("getEventPayload", &AnimLayerMixer::getEventPayload);
977 mixer.addFunc("clearEvents", &AnimLayerMixer::clearEvents);
978
979 auto sm = table.addClass<AnimStateMachine>(
980 "AnimStateMachine",
981 std::function<AnimStateMachine *()>([]() -> AnimStateMachine * { return nullptr; }), true);
982 sm.addFunc("addState", &AnimStateMachine::addState);
983 sm.addFunc("setEntry", &AnimStateMachine::setEntry);
984 sm.addFunc("hasState", &AnimStateMachine::hasState);
985 sm.addFunc("getCurrentState", &AnimStateMachine::getCurrentState);
986 sm.addFunc("getStateCount", &AnimStateMachine::getStateCount);
987 sm.addFunc("addTransition", &AnimStateMachine::addTransition);
988 sm.addFunc("addFloatCondition", &AnimStateMachine::addFloatCondition);
989 sm.addFunc("addBoolCondition", &AnimStateMachine::addBoolCondition);
990 sm.addFunc("addTriggerCondition", &AnimStateMachine::addTriggerCondition);
991 sm.addFunc("setExitTime", &AnimStateMachine::setExitTime);
992 sm.addFunc("setHasExitTime", &AnimStateMachine::setHasExitTime);
993 sm.addFunc("setFloat", &AnimStateMachine::setFloat);
994 sm.addFunc("getFloat", &AnimStateMachine::getFloat);
995 sm.addFunc("setBool", &AnimStateMachine::setBool);
996 sm.addFunc("getBool", &AnimStateMachine::getBool);
997 sm.addFunc("setTrigger", &AnimStateMachine::setTrigger);
998 sm.addFunc("resetTrigger", &AnimStateMachine::resetTrigger);
999 sm.addFunc("getPose", &AnimStateMachine::getPose);
1000 sm.addFunc("getStateTime", &AnimStateMachine::getStateTime);
1001 sm.addFunc("isBlending", &AnimStateMachine::isBlending);
1002 sm.addFunc("update", &AnimStateMachine::update);
1003
1005
1006 auto ca = table.addClass<ControlAnim>(
1007 "ControlAnim", std::function<ControlAnim *()>([]() -> ControlAnim * { return nullptr; }),
1008 true);
1009 ca.addFunc("setFrequency", &ControlAnim::setFrequency);
1010 ca.addFunc("getFrequency", &ControlAnim::getFrequency);
1011 ca.addFunc("setDamping", &ControlAnim::setDamping);
1012 ca.addFunc("getDamping", &ControlAnim::getDamping);
1013 ca.addFunc("setResponse", &ControlAnim::setResponse);
1014 ca.addFunc("getResponse", &ControlAnim::getResponse);
1015 ca.addFunc("setIntegrator", &ControlAnim::setIntegrator);
1016 ca.addFunc("getIntegrator", &ControlAnim::getIntegrator);
1017 ca.addFunc("set", &ControlAnim::set);
1018 ca.addFunc("setTarget", &ControlAnim::setTarget);
1019 ca.addFunc("setTargetVelocity", &ControlAnim::setTargetVelocity);
1020 ca.addFunc("impulse", &ControlAnim::impulse);
1021 ca.addFunc("has", &ControlAnim::has);
1022 ca.addFunc("get", &ControlAnim::get);
1023 ca.addFunc("getVelocity", &ControlAnim::getVelocity);
1024 ca.addFunc("getTarget", &ControlAnim::getTarget);
1025 ca.addFunc("clear", &ControlAnim::clear);
1026 ca.addFunc("remove", &ControlAnim::remove);
1027 ca.addFunc("getPropertyCount", &ControlAnim::getPropertyCount);
1028 ca.addFunc("getPropertyName", &ControlAnim::getPropertyName);
1029 ca.addFunc("update", &ControlAnim::update);
1030
1031 auto cp = table.addClass<ControlPose>(
1032 "ControlPose", std::function<ControlPose *()>([]() -> ControlPose * { return nullptr; }),
1033 true);
1034 cp.addFunc("setFrequency", &ControlPose::setFrequency);
1035 cp.addFunc("getFrequency", &ControlPose::getFrequency);
1036 cp.addFunc("setDamping", &ControlPose::setDamping);
1037 cp.addFunc("getDamping", &ControlPose::getDamping);
1038 cp.addFunc("setResponse", &ControlPose::setResponse);
1039 cp.addFunc("getResponse", &ControlPose::getResponse);
1040 cp.addFunc("setIntegrator", &ControlPose::setIntegrator);
1041 cp.addFunc("getIntegrator", &ControlPose::getIntegrator);
1042 cp.addFunc("setBoneWeight", &ControlPose::setBoneWeight);
1043 cp.addFunc("getBoneWeight", &ControlPose::getBoneWeight);
1044 cp.addFunc("setTargetPose", &ControlPose::setTargetPose);
1045 cp.addFunc("snapToTarget", &ControlPose::snapToTarget);
1046 cp.addFunc("getPose", &ControlPose::getPose);
1047 cp.addFunc("getTargetPose", &ControlPose::getTargetPose);
1048 cp.addFunc("update", &ControlPose::update);
1049
1050 auto solver = table.addClass<DynamicBoneSolver>(
1051 "DynamicBoneSolver",
1052 std::function<DynamicBoneSolver *()>([]() -> DynamicBoneSolver * { return nullptr; }), true);
1053 solver.addFunc("addChain", &DynamicBoneSolver::addChain);
1054 solver.addFunc("addChainByName", &DynamicBoneSolver::addChainByName);
1055 solver.addFunc("getChainCount", &DynamicBoneSolver::getChainCount);
1056 solver.addFunc("clearChains", &DynamicBoneSolver::clearChains);
1057 solver.addFunc("setChainEnabled", &DynamicBoneSolver::setChainEnabled);
1058 solver.addFunc("isChainEnabled", &DynamicBoneSolver::isChainEnabled);
1059 solver.addFunc("setChainFreezeAxis", &DynamicBoneSolver::setChainFreezeAxis);
1060 solver.addFunc("setChainSelfCollision", &DynamicBoneSolver::setChainSelfCollision);
1061 solver.addFunc("setChainParticleParameters", &DynamicBoneSolver::setChainParticleParameters);
1062 solver.addFunc("setChainEndLength", &DynamicBoneSolver::setChainEndLength);
1063 solver.addFunc("setChainEndOffset", &DynamicBoneSolver::setChainEndOffset);
1064 solver.addFunc("clearChainEnd", &DynamicBoneSolver::clearChainEnd);
1065 solver.addFunc("setGlobalGravity", &DynamicBoneSolver::setGlobalGravity);
1066 solver.addFunc("setExternalForce", &DynamicBoneSolver::setExternalForce);
1067 solver.addFunc("getGlobalGravityX", &DynamicBoneSolver::getGlobalGravityX);
1068 solver.addFunc("getGlobalGravityY", &DynamicBoneSolver::getGlobalGravityY);
1069 solver.addFunc("getGlobalGravityZ", &DynamicBoneSolver::getGlobalGravityZ);
1070 solver.addFunc("setWeight", &DynamicBoneSolver::setWeight);
1071 solver.addFunc("getWeight", &DynamicBoneSolver::getWeight);
1072 solver.addFunc("setUpdateRate", &DynamicBoneSolver::setUpdateRate);
1073 solver.addFunc("getUpdateRate", &DynamicBoneSolver::getUpdateRate);
1074 solver.addFunc("setTeleportThreshold", &DynamicBoneSolver::setTeleportThreshold);
1075 solver.addFunc("getTeleportThreshold", &DynamicBoneSolver::getTeleportThreshold);
1076 solver.addFunc("setObjectMoveResponse", &DynamicBoneSolver::setObjectMoveResponse);
1077 solver.addFunc("getObjectMoveResponse", &DynamicBoneSolver::getObjectMoveResponse);
1078 solver.addFunc("setDistanceReference", &DynamicBoneSolver::setDistanceReference);
1079 solver.addFunc("setDistanceLimit", &DynamicBoneSolver::setDistanceLimit);
1080 solver.addFunc("isChainSleeping", &DynamicBoneSolver::isChainSleeping);
1081 solver.addFunc("addColliderSphere", &DynamicBoneSolver::addColliderSphere);
1082 solver.addFunc("addBoneColliderSphere", &DynamicBoneSolver::addBoneColliderSphere);
1083 solver.addFunc("addColliderCapsule", &DynamicBoneSolver::addColliderCapsule);
1084 solver.addFunc("addBoneColliderCapsule", &DynamicBoneSolver::addBoneColliderCapsule);
1085 solver.addFunc("clearColliders", &DynamicBoneSolver::clearColliders);
1086 solver.addFunc("getColliderCount", &DynamicBoneSolver::getColliderCount);
1087 solver.addFunc("removeCollider", &DynamicBoneSolver::removeCollider);
1088 solver.addFunc("setColliderEnabled", &DynamicBoneSolver::setColliderEnabled);
1089 solver.addFunc("setColliderInside", &DynamicBoneSolver::setColliderInside);
1090 solver.addFunc("setColliderRadius", &DynamicBoneSolver::setColliderRadius);
1091 solver.addFunc("setColliderCenter", &DynamicBoneSolver::setColliderCenter);
1092 solver.addFunc("reset", &DynamicBoneSolver::reset);
1093 solver.addFunc("update", &DynamicBoneSolver::update);
1094 auto footIK = table.addClass<FootIKSolver>(
1095 "FootIKSolver", std::function<FootIKSolver *()>([]() -> FootIKSolver * { return nullptr; }), true);
1096 footIK.addFunc("setSkeleton", &FootIKSolver::setSkeleton);
1097 footIK.addFunc("getSkeleton", &FootIKSolver::getSkeleton);
1098 footIK.addFunc("setPelvisBone", &FootIKSolver::setPelvisBone);
1099 footIK.addFunc("configureLeftLeg", &FootIKSolver::configureLeftLeg);
1100 footIK.addFunc("configureRightLeg", &FootIKSolver::configureRightLeg);
1101 footIK.addFunc("configureLeftToe", &FootIKSolver::configureLeftToe);
1102 footIK.addFunc("configureRightToe", &FootIKSolver::configureRightToe);
1103 footIK.addFunc("setGroundQuery", &FootIKSolver::setGroundQuery);
1104 footIK.addFunc("setLeftContact", &FootIKSolver::setLeftContact);
1105 footIK.addFunc("setRightContact", &FootIKSolver::setRightContact);
1106 footIK.addFunc("setMaxPelvisOffset", &FootIKSolver::setMaxPelvisOffset);
1107 footIK.addFunc("setMinGroundNormalY", &FootIKSolver::setMinGroundNormalY);
1108 footIK.addFunc("setPositionResponse", &FootIKSolver::setPositionResponse);
1109 footIK.addFunc("setRotationResponse", &FootIKSolver::setRotationResponse);
1110 footIK.addFunc("setContactGraceTime", &FootIKSolver::setContactGraceTime);
1111 footIK.addFunc("setFootLockEnabled", &FootIKSolver::setFootLockEnabled);
1112 footIK.addFunc("setFootLockThresholds", &FootIKSolver::setFootLockThresholds);
1113 footIK.addFunc("isLeftFootLocked", &FootIKSolver::isLeftFootLocked);
1114 footIK.addFunc("isRightFootLocked", &FootIKSolver::isRightFootLocked);
1115 footIK.addFunc("reset", &FootIKSolver::reset);
1116 footIK.addFunc("apply", &FootIKSolver::apply);
1117
1118 auto trail = table.addClass<AnimTrail>(
1119 "AnimTrail", std::function<AnimTrail *()>([]() -> AnimTrail * { return nullptr; }), true);
1120 trail.addFunc("setCapacity", &AnimTrail::setCapacity);
1121 trail.addFunc("getCapacity", &AnimTrail::getCapacity);
1122 trail.addFunc("setDuration", &AnimTrail::setDuration);
1123 trail.addFunc("getDuration", &AnimTrail::getDuration);
1124 trail.addFunc("setMinDistance", &AnimTrail::setMinDistance);
1125 trail.addFunc("getMinDistance", &AnimTrail::getMinDistance);
1126 trail.addFunc("setWidth", &AnimTrail::setWidth);
1127 trail.addFunc("getWidth", &AnimTrail::getWidth);
1128 trail.addFunc("setColor", &AnimTrail::setColor);
1129 trail.addFunc("getColorR", &AnimTrail::getColorR);
1130 trail.addFunc("getColorG", &AnimTrail::getColorG);
1131 trail.addFunc("getColorB", &AnimTrail::getColorB);
1132 trail.addFunc("getColorA", &AnimTrail::getColorA);
1133 trail.addFunc("setFade", &AnimTrail::setFade);
1134 trail.addFunc("getFade", &AnimTrail::getFade);
1135 trail.addFunc("setStyle", &AnimTrail::setStyle);
1136 trail.addFunc("getStyle", &AnimTrail::getStyle);
1137 trail.addFunc("setDrawScale", &AnimTrail::setDrawScale);
1138 trail.addFunc("getDrawScaleX", &AnimTrail::getDrawScaleX);
1139 trail.addFunc("getDrawScaleY", &AnimTrail::getDrawScaleY);
1140 trail.addFunc("setDrawOffset", &AnimTrail::setDrawOffset);
1141 trail.addFunc("getDrawOffsetX", &AnimTrail::getDrawOffsetX);
1142 trail.addFunc("getDrawOffsetY", &AnimTrail::getDrawOffsetY);
1143 trail.addFunc("addPoint", &AnimTrail::addPoint);
1144 trail.addFunc("addPoint3", &AnimTrail::addPoint3);
1145 trail.addFunc("sampleBone", &AnimTrail::sampleBone);
1146 trail.addFunc("sampleBoneOffset", &AnimTrail::sampleBoneOffset);
1147 trail.addFunc("clear", &AnimTrail::clear);
1148 trail.addFunc("update", &AnimTrail::update);
1149 trail.addFunc("getPointCount", &AnimTrail::getPointCount);
1150 trail.addFunc("getPointX", &AnimTrail::getPointX);
1151 trail.addFunc("getPointY", &AnimTrail::getPointY);
1152 trail.addFunc("getPointZ", &AnimTrail::getPointZ);
1153 trail.addFunc("getPointAge", &AnimTrail::getPointAge);
1154 trail.addFunc("getPointAlpha", &AnimTrail::getPointAlpha);
1155 trail.addFunc("draw", &AnimTrail::draw);
1156
1157 auto sheet = table.addClass<SpriteSheet>(
1158 "SpriteSheet", std::function<SpriteSheet *()>([]() -> SpriteSheet * { return nullptr; }),
1159 true);
1160 sheet.addFunc("addFrame", &SpriteSheet::addFrame);
1161 sheet.addFunc("setGrid", &SpriteSheet::setGrid);
1162 sheet.addFunc("clear", &SpriteSheet::clear);
1163 sheet.addFunc("setTexture", &SpriteSheet::setTexture);
1164 sheet.addFunc("getTexture", &SpriteSheet::getTexture);
1165 sheet.addFunc("getFrameCount", &SpriteSheet::getFrameCount);
1166 sheet.addFunc("findFrame", &SpriteSheet::findFrame);
1167 sheet.addFunc("getFrameName", &SpriteSheet::getFrameName);
1168 sheet.addFunc("getFrameX", &SpriteSheet::getFrameX);
1169 sheet.addFunc("getFrameY", &SpriteSheet::getFrameY);
1170 sheet.addFunc("getFrameWidth", &SpriteSheet::getFrameWidth);
1171 sheet.addFunc("getFrameHeight", &SpriteSheet::getFrameHeight);
1172 sheet.addFunc("getFrameSourceWidth", &SpriteSheet::getFrameSourceWidth);
1173 sheet.addFunc("getFrameSourceHeight", &SpriteSheet::getFrameSourceHeight);
1174 sheet.addFunc("getFrameOffsetX", &SpriteSheet::getFrameOffsetX);
1175 sheet.addFunc("getFrameOffsetY", &SpriteSheet::getFrameOffsetY);
1176 sheet.addFunc("applyToQuad", &SpriteSheet::applyToQuad);
1177
1178 auto sclip = table.addClass<SpriteClip>(
1179 "SpriteClip", std::function<SpriteClip *()>([]() -> SpriteClip * { return nullptr; }),
1180 true);
1181 sclip.addFunc("setName", &SpriteClip::setName);
1182 sclip.addFunc("getName", &SpriteClip::getName);
1183 sclip.addFunc("setLoop", &SpriteClip::setLoop);
1184 sclip.addFunc("getLoop", &SpriteClip::getLoop);
1185 sclip.addFunc("addFrame", &SpriteClip::addFrame);
1186 sclip.addFunc("addFrameByName", &SpriteClip::addFrameByName);
1187 sclip.addFunc("addRange", &SpriteClip::addRange);
1188 sclip.addFunc("setFPS", &SpriteClip::setFPS);
1189 sclip.addFunc("getFPS", &SpriteClip::getFPS);
1190 sclip.addFunc("addEvent", &SpriteClip::addEvent);
1191 sclip.addFunc("getEvent", &SpriteClip::getEvent);
1192 sclip.addFunc("clear", &SpriteClip::clear);
1193 sclip.addFunc("getFrameCount", &SpriteClip::getFrameCount);
1194 sclip.addFunc("getSheetFrame", &SpriteClip::getSheetFrame);
1195 sclip.addFunc("getFrameDuration", &SpriteClip::getFrameDuration);
1196 sclip.addFunc("getDuration", &SpriteClip::getDuration);
1197 sclip.addFunc("frameAtTime", &SpriteClip::frameAtTime);
1198 sclip.addFunc("wrapTime", &SpriteClip::wrapTime);
1199
1200 auto sanim = table.addClass<SpriteAnim>(
1201 "SpriteAnim", std::function<SpriteAnim *()>([]() -> SpriteAnim * { return nullptr; }),
1202 true);
1203 sanim.addFunc("setSheet", &SpriteAnim::setSheet);
1204 sanim.addFunc("getSheet", &SpriteAnim::getSheet);
1205 sanim.addFunc("play", &SpriteAnim::play);
1206 sanim.addFunc("playReverse", &SpriteAnim::playReverse);
1207 sanim.addFunc("stop", &SpriteAnim::stop);
1208 sanim.addFunc("pause", &SpriteAnim::pause);
1209 sanim.addFunc("resume", &SpriteAnim::resume);
1210 sanim.addFunc("setSpeed", &SpriteAnim::setSpeed);
1211 sanim.addFunc("getSpeed", &SpriteAnim::getSpeed);
1212 sanim.addFunc("addSpeedCurveKey", &SpriteAnim::addSpeedCurveKey);
1213 sanim.addFunc("clearSpeedCurve", &SpriteAnim::clearSpeedCurve);
1214 sanim.addFunc("resetSpeedCurve", &SpriteAnim::resetSpeedCurve);
1215 sanim.addFunc("setSpeedCurveLoop", &SpriteAnim::setSpeedCurveLoop);
1216 sanim.addFunc("setSpeedCurveInterpolation", &SpriteAnim::setSpeedCurveInterpolation);
1217 sanim.addFunc("getSpeedCurveValue", &SpriteAnim::getSpeedCurveValue);
1218 sanim.addFunc("setFrame", &SpriteAnim::setFrame);
1219 sanim.addFunc("step", &SpriteAnim::step);
1220 sanim.addFunc("playOnce", &SpriteAnim::playOnce);
1221 sanim.addFunc("queue", &SpriteAnim::queue);
1222 sanim.addFunc("consumeEvent", &SpriteAnim::consumeEvent);
1223 sanim.addFunc("setTime", &SpriteAnim::setTime);
1224 sanim.addFunc("getTime", &SpriteAnim::getTime);
1225 sanim.addFunc("setLoop", &SpriteAnim::setLoop);
1226 sanim.addFunc("getLoop", &SpriteAnim::getLoop);
1227 sanim.addFunc("isPlaying", &SpriteAnim::isPlaying);
1228 sanim.addFunc("isPaused", &SpriteAnim::isPaused);
1229 sanim.addFunc("isFinished", &SpriteAnim::isFinished);
1230 sanim.addFunc("getLoopCount", &SpriteAnim::getLoopCount);
1231 sanim.addFunc("consumeCompleted", &SpriteAnim::consumeCompleted);
1232 sanim.addFunc("consumeLooped", &SpriteAnim::consumeLooped);
1233 sanim.addFunc("getClip", &SpriteAnim::getClip);
1234 sanim.addFunc("getClipFrame", &SpriteAnim::getClipFrame);
1235 sanim.addFunc("getSheetFrame", &SpriteAnim::getSheetFrame);
1236 sanim.addFunc("bindQuad", &SpriteAnim::bindQuad);
1237 sanim.addFunc("unbindQuad", &SpriteAnim::unbindQuad);
1238 sanim.addFunc("getBoundQuad", &SpriteAnim::getBoundQuad);
1239 sanim.addFunc("bindSprite", &SpriteAnim::bindSprite);
1240 sanim.addFunc("applyToQuad", &SpriteAnim::applyToQuad);
1241 sanim.addFunc("update", &SpriteAnim::update);
1242
1243 auto satlas = table.addClass<SpineAtlas>(
1244 "SpineAtlas", std::function<SpineAtlas *()>([]() -> SpineAtlas * { return nullptr; }),
1245 true);
1246 satlas.addFunc("loadFromText",
1247 [](SpineAtlas *self, const std::string &text) -> bool {
1248 return self->loadFromText(text, nullptr);
1249 });
1250 satlas.addFunc("loadFromFile",
1251 [](SpineAtlas *self, const std::string &path) -> bool {
1252 return self->loadFromFile(path, nullptr);
1253 });
1254 satlas.addFunc("clear", &SpineAtlas::clear);
1255 satlas.addFunc("getPageCount", &SpineAtlas::getPageCount);
1256 satlas.addFunc("getPageName", &SpineAtlas::getPageName);
1257 satlas.addFunc("getPageWidth", &SpineAtlas::getPageWidth);
1258 satlas.addFunc("getPageHeight", &SpineAtlas::getPageHeight);
1259 satlas.addFunc("getRegionCount", &SpineAtlas::getRegionCount);
1260 satlas.addFunc("findRegion", &SpineAtlas::findRegion);
1261 satlas.addFunc("getRegionName", &SpineAtlas::getRegionName);
1262 satlas.addFunc("getRegionPage", &SpineAtlas::getRegionPage);
1263 satlas.addFunc("getRegionX", &SpineAtlas::getRegionX);
1264 satlas.addFunc("getRegionY", &SpineAtlas::getRegionY);
1265 satlas.addFunc("getRegionWidth", &SpineAtlas::getRegionWidth);
1266 satlas.addFunc("getRegionHeight", &SpineAtlas::getRegionHeight);
1267 satlas.addFunc("getRegionRotate", &SpineAtlas::getRegionRotate);
1268
1269 auto sdata = table.addClass<SpineSkeletonData>(
1270 "SpineSkeletonData",
1271 std::function<SpineSkeletonData *()>([]() -> SpineSkeletonData * { return nullptr; }),
1272 true);
1273 sdata.addFunc("loadFromJson",
1274 [](SpineSkeletonData *self, const std::string &json) -> bool {
1275 return self->loadFromJson(json, nullptr);
1276 });
1277 sdata.addFunc("loadFromFile",
1278 [](SpineSkeletonData *self, const std::string &path) -> bool {
1279 return self->loadFromFile(path, nullptr);
1280 });
1281 sdata.addFunc("clear", &SpineSkeletonData::clear);
1282 sdata.addFunc("getSpineVersion", &SpineSkeletonData::getSpineVersion);
1283 sdata.addFunc("getBoneCount", &SpineSkeletonData::getBoneCount);
1284 sdata.addFunc("findBone", &SpineSkeletonData::findBone);
1285 sdata.addFunc("getBoneName", &SpineSkeletonData::getBoneName);
1286 sdata.addFunc("getBoneParent", &SpineSkeletonData::getBoneParent);
1287 sdata.addFunc("getSlotCount", &SpineSkeletonData::getSlotCount);
1288 sdata.addFunc("findSlot", &SpineSkeletonData::findSlot);
1289 sdata.addFunc("getSlotName", &SpineSkeletonData::getSlotName);
1290 sdata.addFunc("getSlotBone", &SpineSkeletonData::getSlotBone);
1291 sdata.addFunc("getSkinCount", &SpineSkeletonData::getSkinCount);
1292 sdata.addFunc("findSkin", &SpineSkeletonData::findSkin);
1293 sdata.addFunc("getSkinName", &SpineSkeletonData::getSkinName);
1294 sdata.addFunc("getAnimationCount", &SpineSkeletonData::getAnimationCount);
1295 sdata.addFunc("findAnimation", &SpineSkeletonData::findAnimation);
1296 sdata.addFunc("getAnimationName", &SpineSkeletonData::getAnimationName);
1297 sdata.addFunc("getAnimationDuration", &SpineSkeletonData::getAnimationDuration);
1298
1299 auto ssk = table.addClass<SpineSkeleton>(
1300 "SpineSkeleton",
1301 std::function<SpineSkeleton *()>([]() -> SpineSkeleton * { return nullptr; }), true);
1302 ssk.addFunc("getData", &SpineSkeleton::getData);
1303 ssk.addFunc("setSkin", &SpineSkeleton::setSkin);
1304 ssk.addFunc("getSkin", &SpineSkeleton::getSkin);
1305 ssk.addFunc("setToSetupPose", &SpineSkeleton::setToSetupPose);
1306 ssk.addFunc("updateWorldTransform", &SpineSkeleton::updateWorldTransform);
1307 ssk.addFunc("getBoneCount", &SpineSkeleton::getBoneCount);
1308 ssk.addFunc("getBoneWorldX", &SpineSkeleton::getBoneWorldX);
1309 ssk.addFunc("getBoneWorldY", &SpineSkeleton::getBoneWorldY);
1310 ssk.addFunc("getBoneWorldRotation", &SpineSkeleton::getBoneWorldRotation);
1311 ssk.addFunc("getSlotCount", &SpineSkeleton::getSlotCount);
1312 ssk.addFunc("getSlotAttachmentName", &SpineSkeleton::getSlotAttachmentName);
1313 ssk.addFunc("setSlotAttachmentName", &SpineSkeleton::setSlotAttachmentName);
1314
1315 auto spanim = table.addClass<SpineAnim>(
1316 "SpineAnim", std::function<SpineAnim *()>([]() -> SpineAnim * { return nullptr; }), true);
1317 spanim.addFunc("getSkeleton", &SpineAnim::getSkeleton);
1318 spanim.addFunc("setAtlas", &SpineAnim::setAtlas);
1319 spanim.addFunc("getAtlas", &SpineAnim::getAtlas);
1320 spanim.addFunc("setPageTexture", &SpineAnim::setPageTexture);
1321 spanim.addFunc("setPageTextureByName", &SpineAnim::setPageTextureByName);
1322 spanim.addFunc("getPageTexture", &SpineAnim::getPageTexture);
1323 spanim.addFunc("play", &SpineAnim::play);
1324 spanim.addFunc("stop", &SpineAnim::stop);
1325 spanim.addFunc("pause", &SpineAnim::pause);
1326 spanim.addFunc("resume", &SpineAnim::resume);
1327 spanim.addFunc("setSpeed", &SpineAnim::setSpeed);
1328 spanim.addFunc("getSpeed", &SpineAnim::getSpeed);
1329 spanim.addFunc("setTime", &SpineAnim::setTime);
1330 spanim.addFunc("getTime", &SpineAnim::getTime);
1331 spanim.addFunc("setLoop", &SpineAnim::setLoop);
1332 spanim.addFunc("getLoop", &SpineAnim::getLoop);
1333 spanim.addFunc("setFlipY", &SpineAnim::setFlipY);
1334 spanim.addFunc("getFlipY", &SpineAnim::getFlipY);
1335 spanim.addFunc("setPosition", &SpineAnim::setPosition);
1336 spanim.addFunc("getX", &SpineAnim::getX);
1337 spanim.addFunc("getY", &SpineAnim::getY);
1338 spanim.addFunc("setScale", &SpineAnim::setScale);
1339 spanim.addFunc("getScaleX", &SpineAnim::getScaleX);
1340 spanim.addFunc("getScaleY", &SpineAnim::getScaleY);
1341 spanim.addFunc("setLayer", &SpineAnim::setLayer);
1342 spanim.addFunc("getLayer", &SpineAnim::getLayer);
1343 spanim.addFunc("setColor", &SpineAnim::setColor);
1344 spanim.addFunc("isPlaying", &SpineAnim::isPlaying);
1345 spanim.addFunc("isPaused", &SpineAnim::isPaused);
1346 spanim.addFunc("isFinished", &SpineAnim::isFinished);
1347 spanim.addFunc("getAnimation", &SpineAnim::getAnimation);
1348 spanim.addFunc("getAnimationDuration", &SpineAnim::getAnimationDuration);
1349 spanim.addFunc("apply", &SpineAnim::apply);
1350 spanim.addFunc("update", &SpineAnim::update);
1351 spanim.addFunc("draw", &SpineAnim::draw);
1352 // collectDrawItems is C++-only (shared DrawItem2D queue); scripts use getDrawSlot*.
1353 spanim.addFunc("getDrawSlotCount", &SpineAnim::getDrawSlotCount);
1354 spanim.addFunc("getDrawSlotX", &SpineAnim::getDrawSlotX);
1355 spanim.addFunc("getDrawSlotY", &SpineAnim::getDrawSlotY);
1356 spanim.addFunc("getDrawSlotWidth", &SpineAnim::getDrawSlotWidth);
1357 spanim.addFunc("getDrawSlotHeight", &SpineAnim::getDrawSlotHeight);
1358 spanim.addFunc("getDrawSlotRotation", &SpineAnim::getDrawSlotRotation);
1359 spanim.addFunc("getDrawSlotRegion", &SpineAnim::getDrawSlotRegion);
1360}
1361
1362void Animation::expose(ssq::Class &cls) {
1363 cls.addFunc("getName", &Animation::getName);
1364 cls.addFunc("newTween", &Animation::newTween);
1365 cls.addFunc("newSpriteSheet", &Animation::newSpriteSheet);
1366 cls.addFunc("newSpriteSheetFromSequence", &Animation::newSpriteSheetFromSequence);
1367 cls.addFunc("newSpriteSheetFromAtlasJson", &Animation::newSpriteSheetFromAtlasJson);
1368 cls.addFunc("getSpriteSequenceCacheCount", &Animation::getSpriteSequenceCacheCount);
1369 cls.addFunc("getSpriteSequenceCacheBytes", &Animation::getSpriteSequenceCacheBytes);
1370 cls.addFunc("clearSpriteSequenceCache", &Animation::clearSpriteSequenceCache);
1371 cls.addFunc("newSpriteClip", &Animation::newSpriteClip);
1372 cls.addFunc("newSpriteAnim", &Animation::newSpriteAnim);
1373 cls.addFunc("newSpineAtlas", &Animation::newSpineAtlas);
1374 cls.addFunc("newSpineSkeletonData", &Animation::newSpineSkeletonData);
1375 cls.addFunc("newSpineSkeleton", &Animation::newSpineSkeleton);
1376 cls.addFunc("newSpineAnim", &Animation::newSpineAnim);
1377 cls.addFunc("newSpineAtlasFromFile", &Animation::newSpineAtlasFromFile);
1378 cls.addFunc("newSpineAtlasFromText", &Animation::newSpineAtlasFromText);
1379 cls.addFunc("newSpineSkeletonDataFromFile", &Animation::newSpineSkeletonDataFromFile);
1380 cls.addFunc("newSpineSkeletonDataFromJson", &Animation::newSpineSkeletonDataFromJson);
1381 cls.addFunc("newSkeleton", &Animation::newSkeleton);
1382 cls.addFunc("newClip", &Animation::newClip);
1383 cls.addFunc("newPose", &Animation::newPose);
1384 cls.addFunc("newBatch", &Animation::newBatch);
1385 cls.addFunc("newConstraintStack", &Animation::newConstraintStack);
1386 cls.addFunc("newDynamicBoneSolver", &Animation::newDynamicBoneSolver);
1387 cls.addFunc("setupHairChain", &Animation::setupHairChain);
1388 cls.addFunc("setupHairHeadCollider", &Animation::setupHairHeadCollider);
1389 cls.addFunc("newFootIKSolver", &Animation::newFootIKSolver);
1390 cls.addFunc("newSyncGroup", &Animation::newSyncGroup);
1391 cls.addFunc("newPlayer", &Animation::newPlayer);
1392 cls.addFunc("newGraph", &Animation::newGraph);
1393 cls.addFunc("newBoneMask", &Animation::newBoneMask);
1394 cls.addFunc("newLayerMixer", &Animation::newLayerMixer);
1395 cls.addFunc("newStateMachine", &Animation::newStateMachine);
1396 cls.addFunc("newMotionDatabase", &Animation::newMotionDatabase);
1397 cls.addFunc("newMotionMatcher", &Animation::newMotionMatcher);
1398 cls.addFunc("newControlAnim", &Animation::newControlAnim);
1399 cls.addFunc("newControlPose", &Animation::newControlPose);
1400 cls.addFunc("newPhysicalBalancePose", &Animation::newPhysicalBalancePose);
1401 cls.addFunc("newSkeletonFromAnimationFixtureText", &Animation::newSkeletonFromAnimationFixtureText);
1402 cls.addFunc("newClipFromAnimationFixtureText", &Animation::newClipFromAnimationFixtureText);
1403 cls.addFunc("newLattice", &Animation::newLattice);
1404#if defined(EVE_ANIMATION_MODEL3D)
1406#endif
1407 cls.addFunc("newTrail", &Animation::newTrail);
1408 cls.addFunc("update", &Animation::update);
1409 cls.addFunc("getTweenCount", &Animation::getTweenCount);
1410 cls.addFunc("getMotionCount", &Animation::getMotionCount);
1411 cls.addFunc("getSpriteAnimCount", &Animation::getSpriteAnimCount);
1412 cls.addFunc("getSpineAnimCount", &Animation::getSpineAnimCount);
1413 cls.addFunc("getActiveCount", &Animation::getActiveCount);
1414 cls.addFunc("clearFinished", &Animation::clearFinished);
1415 cls.addFunc("clearAll", &Animation::clearAll);
1416}
1417
1418} // namespace eve::animation
double y
double x
float w
Definition AnimClip.cpp:738
float duration
int root
Definition AnimSmr.cpp:119
eve::EntitySpatialPose pose
int mask
HSQOBJECT cls
Definition ECS.cpp:39
std::string name
Definition ECS.cpp:154
scene::NodeDesc desc
int rows
std::string pattern
float inertia
float strength
std::uint32_t capacity
glm::vec4 clip
float u
Definition Grass.cpp:233
glm::vec3 n
Definition Grass.cpp:63
float v
std::int32_t first
int h
std::vector< Colorf > px
std::string to
std::string from
std::string response
Poco::JSON::Object::Ptr result
std::uint64_t bytes
MeleePoint3 b
Definition MeleeHit.cpp:41
double radius
Definition MeleeHit.cpp:42
MeleePoint3 a
Definition MeleeHit.cpp:40
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:27
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.
ssq::Object frame
glm::dvec3 dx
double dt
std::string error
Definition Package.cpp:174
std::map< std::string, std::vector< std::string > > graph
Definition Package.cpp:173
Texture * texture
std::string path
Definition PlayHost.cpp:111
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:158
std::string file
float t
std::string text
ScriptStructure out
std::string_view source
float dy
Definition Shadow.cpp:151
int count
int columns
float offsetX
float offsetY
float step
Definition TreeMesh.cpp:451
float size
Definition TreeMesh.cpp:158
uint32_t index
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
static Result< Duration > fromSeconds(double seconds)
Convert finite seconds to the nearest nanosecond.
Definition Time.cpp:17
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:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
void ignore(std::string_view reason={}) const noexcept
Explicitly discard this result after documenting the reason.
Definition Result.h:424
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
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:33
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:178
float getWorldRotationX(int boneIndex) const
Returns the world rotation x.
Definition AnimPose.cpp:354
int getBoneCount() const noexcept
Returns the bone count.
Definition AnimPose.h:36
float getWorldPositionZ(int boneIndex) const
Returns the world position z.
Definition AnimPose.cpp:350
float getLocalScaleZ(int boneIndex) const
Returns the local scale z.
Definition AnimPose.cpp:202
float getLocalPositionZ(int boneIndex) const
Returns the local position z.
Definition AnimPose.cpp:174
void blendFrom(const AnimPose *a, const AnimPose *b, float t)
Blend from.
Definition AnimPose.cpp:101
float getWorldMatrixElement(int boneIndex, int elementIndex) const
Column-major 4x4 world matrix for boneIndex after computeWorld(). elementIndex in [0,...
Definition AnimPose.cpp:376
float getLocalPositionX(int boneIndex) const
Returns the local position x.
Definition AnimPose.cpp:166
float getLocalRotationW(int boneIndex) const
Returns the local rotation w.
Definition AnimPose.cpp:190
float getWorldPositionX(int boneIndex) const
Returns the world position x.
Definition AnimPose.cpp:342
void setLocalScale(int boneIndex, float x, float y, float z)
Sets the local scale.
Definition AnimPose.cpp:158
float getLocalScaleX(int boneIndex) const
Returns the local scale x.
Definition AnimPose.cpp:194
float getWorldPositionY(int boneIndex) const
Returns the world position y.
Definition AnimPose.cpp:346
void setLocalRotation(int boneIndex, float x, float y, float z, float w)
Sets the local rotation.
Definition AnimPose.cpp:148
float getWorldRotationW(int boneIndex) const
Returns the world rotation w.
Definition AnimPose.cpp:366
float getWorldRotationZ(int boneIndex) const
Returns the world rotation z.
Definition AnimPose.cpp:362
float getWorldRotationY(int boneIndex) const
Returns the world rotation y.
Definition AnimPose.cpp:358
float getLocalScaleY(int boneIndex) const
Returns the local scale y.
Definition AnimPose.cpp:198
float getLocalRotationZ(int boneIndex) const
Returns the local rotation z.
Definition AnimPose.cpp:186
void setLocalPosition(int boneIndex, float x, float y, float z)
Sets the local position.
Definition AnimPose.cpp:140
float getLocalPositionY(int boneIndex) const
Returns the local position y.
Definition AnimPose.cpp:170
void copyFrom(const AnimPose *other)
Copies from.
Definition AnimPose.cpp:95
float getLocalRotationY(int boneIndex) const
Returns the local rotation y.
Definition AnimPose.cpp:182
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:224
void computeWorld(const AnimSkeleton *skeleton)
Compute world transforms from local pose + skeleton hierarchy. World values readable via getWorld* af...
Definition AnimPose.cpp:207
void resize(int boneCount)
Resize.
Definition AnimPose.cpp:82
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:241
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.
void setDuration(float seconds)
How long each sample lives (seconds). <= 0 keeps until capacity eviction.
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.
void setWidth(float pixels)
Sets the width.
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).
void setDrawOffset(float ox, float oy)
Sets the draw offset.
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).
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.
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.
void setFade(bool enable)
Sets the fade.
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...
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).
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 Hash frames and their atlas texture. Clockwise-packed frames are n...
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:354
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:336
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:356
int getMotionCount() const
Returns the motion count.
Definition Animation.h:338
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.
void setColliderCenter(int index, float x, float y, float z)
Move a world-space collider center (bone index < 0). Bone-attached colliders ignore this call because...
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 * newTextureFromFile(const std::string &filename) override
Load a path-cached file texture; cache hits return the same resource without I/O or upload....
Texture * newTextureFromImageData(image::ImageData *data, bool repeatU=false, bool repeatV=false)
Creates a texture from image data. @ownership Caller deletes unless documented otherwise.
Represents raw pixel data.
Definition ImageData.h:38
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,...
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.
EVENGINE_API_WORLD void clearScriptMotionSinkAdapters()
释放所有**脚本 motion sink** 适配器,并撤回它们在 provider 注册表里的登记。
void exposeAnimPlayerBindings(ssq::Table &table)
Register playback, sampling and event inspection for AnimPlayer.
EVENGINE_API_WORLD void exposeMotionScriptBindings(ssq::Table &table, ssq::Class &animationClass)
Register Motion / MotionSequence script types and Animation factories.
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.
@ 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:73
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