载入中...
搜索中...
未找到
PhysicalBalancePoseBindings.cpp
浏览该文件的文档.
1#include <functional>
2#include <simplesquirrel/simplesquirrel.hpp>
3#include <string>
4
9
10namespace eve::animation {
11
12void exposePhysicalBalancePoseBindings(ssq::Table& table) {
13 auto pose = table.addClass<PhysicalBalancePose>(
14 "PhysicalBalancePose", std::function<PhysicalBalancePose*()>([]() -> PhysicalBalancePose* { return nullptr; }),
15 true);
16 pose.addFunc("getSkeleton", &PhysicalBalancePose::getSkeleton);
17 pose.addFunc("setSupportBone", [vm = table.getHandle()](PhysicalBalancePose* self, int bone) {
18 return script::projectResult(vm, self->setSupportBone(bone));
19 });
20 pose.addFunc("getSupportBone", &PhysicalBalancePose::getSupportBone);
21 pose.addFunc("setBalanceBone", [vm = table.getHandle()](PhysicalBalancePose* self, int bone) {
22 return script::projectResult(vm, self->setBalanceBone(bone));
23 });
24 pose.addFunc("getBalanceBone", &PhysicalBalancePose::getBalanceBone);
25 pose.addFunc("setBoneMass", [vm = table.getHandle()](PhysicalBalancePose* self, int bone, float mass) {
26 return script::projectResult(vm, self->setBoneMass(bone, mass));
27 });
28 pose.addFunc("getBoneMass", &PhysicalBalancePose::getBoneMass);
29 pose.addFunc("setRecovery",
30 [vm = table.getHandle()](PhysicalBalancePose* self, float frequencyHz, float dampingZeta) {
31 return script::projectResult(vm, self->setRecovery(frequencyHz, dampingZeta));
32 });
33 pose.addFunc("getRecoveryFrequency", &PhysicalBalancePose::getRecoveryFrequency);
34 pose.addFunc("getRecoveryDamping", &PhysicalBalancePose::getRecoveryDamping);
35 pose.addFunc("setRecoil",
36 [vm = table.getHandle()](PhysicalBalancePose* self, float frequencyHz, float dampingZeta) {
37 return script::projectResult(vm, self->setRecoil(frequencyHz, dampingZeta));
38 });
39 pose.addFunc("getRecoilFrequency", &PhysicalBalancePose::getRecoilFrequency);
40 pose.addFunc("getRecoilDamping", &PhysicalBalancePose::getRecoilDamping);
41 pose.addFunc("setGravity", [vm = table.getHandle()](PhysicalBalancePose* self, float gravity) {
42 return script::projectResult(vm, self->setGravity(gravity));
43 });
44 pose.addFunc("getGravity", &PhysicalBalancePose::getGravity);
45 pose.addFunc("setPendulumHeight", [vm = table.getHandle()](PhysicalBalancePose* self, float height) {
46 return script::projectResult(vm, self->setPendulumHeight(height));
47 });
48 pose.addFunc("getPendulumHeight", &PhysicalBalancePose::getPendulumHeight);
49 pose.addFunc("setInertia", [vm = table.getHandle()](PhysicalBalancePose* self, float inertia) {
50 return script::projectResult(vm, self->setInertia(inertia));
51 });
52 pose.addFunc("getInertia", &PhysicalBalancePose::getInertia);
53 pose.addFunc("setRecoilInertia", [vm = table.getHandle()](PhysicalBalancePose* self, float inertia) {
54 return script::projectResult(vm, self->setRecoilInertia(inertia));
55 });
56 pose.addFunc("getRecoilInertia", &PhysicalBalancePose::getRecoilInertia);
57 pose.addFunc("setMaxLean", [vm = table.getHandle()](PhysicalBalancePose* self, float radians) {
58 return script::projectResult(vm, self->setMaxLean(radians));
59 });
60 pose.addFunc("getMaxLean", &PhysicalBalancePose::getMaxLean);
61 pose.addFunc("setTargetPose", [vm = table.getHandle()](PhysicalBalancePose* self, AnimPose* target) {
62 return script::projectResult(vm, self->setTargetPose(target));
63 });
64 pose.addFunc("snapToTarget", [vm = table.getHandle()](PhysicalBalancePose* self) {
65 return script::projectResult(vm, self->snapToTarget());
66 });
67 pose.addFunc("applyImpulse", [vm = table.getHandle()](PhysicalBalancePose* self, int bone, float ix, float iy,
68 float iz, float px, float py, float pz) {
69 return script::projectResult(vm, self->applyImpulse(bone, ix, iy, iz, px, py, pz));
70 });
71 pose.addFunc("update", &PhysicalBalancePose::update);
72 pose.addFunc("getPose", &PhysicalBalancePose::getPose);
73 pose.addFunc("getTargetPose", &PhysicalBalancePose::getTargetPose);
74 pose.addFunc("getLeanX", &PhysicalBalancePose::getLeanX);
75 pose.addFunc("getLeanZ", &PhysicalBalancePose::getLeanZ);
76 pose.addFunc("getLeanVelocityX", &PhysicalBalancePose::getLeanVelocityX);
77 pose.addFunc("getLeanVelocityZ", &PhysicalBalancePose::getLeanVelocityZ);
78 pose.addFunc("getCenterOfMassX", &PhysicalBalancePose::getCenterOfMassX);
79 pose.addFunc("getCenterOfMassY", &PhysicalBalancePose::getCenterOfMassY);
80 pose.addFunc("getCenterOfMassZ", &PhysicalBalancePose::getCenterOfMassZ);
81 pose.addFunc("getSupportX", &PhysicalBalancePose::getSupportX);
82 pose.addFunc("getSupportY", &PhysicalBalancePose::getSupportY);
83 pose.addFunc("getSupportZ", &PhysicalBalancePose::getSupportZ);
84}
85
86} // namespace eve::animation
LogicalId target
eve::EntitySpatialPose pose
float py
float pz
HSQUIRRELVM vm
Definition ECS.cpp:20
std::vector< Colorf > px
std::uint32_t height
std::uint32_t bone
double gravity
The single Squirrel projection for common Result, Status and Value.
float inertia
Definition TreeMesh.cpp:309
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
Authored-pose overlay that wobbles from world impulses and recovers balance.
void update(float dt)
Legacy seconds facade; forwards to advance() and ignores its Result.
AnimPose * getPose()
Overlay pose after the last successful advance (or snap). @ownership Borrowed; this object retains ow...
AnimPose * getTargetPose()
Last authored target, or bind pose before the first setTargetPose. @ownership Borrowed; this object r...
AnimSkeleton * getSkeleton() const
Borrowed skeleton. @ownership Borrowed; ownership remains with the animation source....
void exposePhysicalBalancePoseBindings(ssq::Table &table)
Register the impulse/balance pose overlay Squirrel surface.