载入中...
搜索中...
未找到
OrientationWarping.cpp
浏览该文件的文档.
23eve::Result<void> ok(eve::StatusCode code) { return eve::Result<void>::success(eve::Status::success(code)); }
40void setWorldRotation(AnimPose& pose, const AnimSkeleton& skeleton, int bone, float qx, float qy, float qz, float qw) {
50 multiplyQuat(-parentWorld.qx, -parentWorld.qy, -parentWorld.qz, parentWorld.qw, qx, qy, qz, qw, lx, ly, lz, lw);
60 multiplyQuat(0.f, std::sin(half), 0.f, std::cos(half), world.qx, world.qy, world.qz, world.qw, qx, qy, qz, qw);
64bool validBoneList(const AnimSkeleton& skeleton, int root, std::span<const int> bones, int maxCount) {
92eve::Result<void> OrientationWarping::configure(AnimSkeleton& skeleton, int rootBone, std::span<const int> spineBones,
100 eve::DiagnosticCode::InvalidArgument, "spine bones must be unique valid indices distinct from the root",
104 eve::DiagnosticCode::InvalidArgument, "ik bones must be unique valid indices distinct from the root",
173eve::Result<void> OrientationWarping::apply(AnimPose& pose, float locomotionX, float locomotionZ, float animatedX,
185 eve::DiagnosticCode::InvalidArgument, "dt must be finite in [0,1]", "orientationWarping", {}, "animation"));
253int OrientationWarping::getSpineBoneCount() const { return static_cast<int>(impl_->spineBones.size()); }
254int OrientationWarping::getIkBoneCount() const { return static_cast<int>(impl_->ikBones.size()); }
277 "OrientationWarping", std::function<OrientationWarping*()>([] { return new OrientationWarping(); }), true);
280 [bind](OrientationWarping* self, AnimSkeleton* skeleton, int root, ssq::Array spine, ssq::Array ik) {
298 script::bindMethod(cls, "setRotationInterpSpeed", [bind](OrientationWarping* self, float speed) {
302 script::bindMethod(cls, "setMinRootMotionSpeed", [bind](OrientationWarping* self, float speed) {
Stable, structured diagnostics shared by engine modules.
Per-translation-unit VM + diagnostic-source helper for Squirrel bindings.
The single Squirrel projection for common Result, Status and Value.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
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
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...
Definition AnimSkeleton.h:16
Planar orientation warp applied after motion matching, never fed back into search.
Definition OrientationWarping.h:26
eve::Result< void > setDistributedAlpha(float alpha)
Set how much of the warp is distributed onto the spine chain.
Definition OrientationWarping.cpp:121
~OrientationWarping()
Release owned interpolation state; the borrowed skeleton is not accessed.
AnimSkeleton * getSkeleton() const
Borrowed skeleton from the last successful configure, or null. @ownership Borrowed; ownership remains...
Definition OrientationWarping.cpp:251
void reset()
Clear smoothed yaw so the next apply starts from zero.
Definition OrientationWarping.cpp:168
float getRotationInterpSpeed() const
Definition OrientationWarping.cpp:152
float getAngleThreshold() const
Definition OrientationWarping.cpp:141
eve::Result< void > apply(AnimPose &pose, float locomotionX, float locomotionZ, float animatedX, float animatedZ, float dt)
Warp a local pose so animated planar velocity aligns with locomotion velocity.
Definition OrientationWarping.cpp:173
float getDistributedAlpha() const
Definition OrientationWarping.cpp:130
float getAppliedAngle() const
Smoothed yaw last applied to a pose, radians, positive from +Z toward +X.
Definition OrientationWarping.cpp:249
eve::Result< void > setAngleThreshold(float radians)
Set the inclusive planar-angle magnitude that disables warping.
Definition OrientationWarping.cpp:132
eve::Result< void > setMinRootMotionSpeed(float metresPerSecond)
Set the planar speed below which either direction is treated as stationary.
Definition OrientationWarping.cpp:154
eve::Result< void > setRotationInterpSpeed(float speed)
Set how quickly the applied yaw approaches the target, matching Unreal FInterpTo.
Definition OrientationWarping.cpp:143
void setEnabled(bool enabled)
Enable or disable pose mutation. Disabled apply calls still recompute the target.
Definition OrientationWarping.cpp:165
eve::Result< void > configure(AnimSkeleton &skeleton, int rootBone, std::span< const int > spineBones={}, std::span< const int > ikBones={})
Atomically bind a skeleton and bone lists used by later apply calls.
Definition OrientationWarping.cpp:92
OrientationWarping()
Construct an unconfigured warper with no borrowed skeleton.
Definition OrientationWarping.cpp:89
float getTargetAngle() const
Unsmoothed target yaw from the last successful apply, radians.
Definition OrientationWarping.cpp:250
float getMinRootMotionSpeed() const
Definition OrientationWarping.cpp:163
Pins the active VM and a stable diagnostic source for one expose() TU.
Definition SquirrelBindContext.h:32
Definition Animation.cpp:58
void multiplyQuat(float ax, float ay, float az, float aw, float bx, float by, float bz, float bw, float &ox, float &oy, float &oz, float &ow)
Hamilton product a * b for unit quaternions (xyzw).
Definition AnimMath.h:94
void exposeOrientationWarpingBindings(ssq::Table &table)
Register the owning OrientationWarping Squirrel surface.
Definition OrientationWarping.cpp:274
void bindMethod(ssq::Class &cls, const char *name, F &&fn)
Register one script method while keeping a literal name for Binding Contracts.
Definition SquirrelBindContext.h:130
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:540
@ InvalidArgument
@ NoOp
@ Applied
Definition Container.h:602
std::vector< int > ikBones
Definition OrientationWarping.cpp:79
float interpSpeed
Definition OrientationWarping.cpp:82
AnimSkeleton * skeleton
Definition OrientationWarping.cpp:76
float targetAngle
Definition OrientationWarping.cpp:85
float appliedAngle
Definition OrientationWarping.cpp:84
float distributedAlpha
Definition OrientationWarping.cpp:80
float minSpeed
Definition OrientationWarping.cpp:83
float angleThreshold
Definition OrientationWarping.cpp:81
std::vector< int > spineBones
Definition OrientationWarping.cpp:78