18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 00:45:29 +01:00

feat(model): the channels of EU07M models move joints and scrub clips

A channel (CHNL component) is a named value of a model, kept within its range, which moves what it's bound to. The game now
follows its bindings to joints and to clips.

- A joint binding (a JOIN component of a node): the value of the target (channel * scale + offset) turns a hinge (radians)
  or a screw (turning and moving by its pitch), or moves a slider (metres) along the axis of the joint, from the transform
  of the node, within the limits of the joint when it has them; a fixed or a ball joint leaves the node at rest
  (animation::joint_transform()).
- A clip binding: the value of the target is the share of the duration of the clip, 0 to 1, so the channel scrubs the clip
  without playing it.
- Bindings to variants and light slots are read but not followed yet.
- Format, before the release: the target of a clip binding is the index of the clip in ACLP (clips aren't components); the
  validator checks the target by the kind of the binding (a joint has to be a JOIN component).
- TAnimModel::set_channel(name, value); a channel not set has its initial value. RaPrepare() sets the nodes from the
  channels after the clips playing, so a channel overrides a clip on the same node. The nodes of the joints are flagged
  animated at load, which keeps the model out of the instancing.
- New form of the animation event: "animation <delay> <model> channel <name> <value>"; a channel the model hasn't gets
  "Bad event: ... can't find channel ..." in the log. The current release doesn't read the new form.
- The editor self-test gets "channel <node> <name> <value>".

Checked in the game (Vulkan, a skinned tube with a hinge on its tip and a clip on its base): "bend 1" from the self-test
and "bend -1" from an event turn the tip both ways, "phase 0.5" from an event turns the whole tube through the clip, an
unknown channel logs the error. Unit tests 1204/1204, 4 new ones for the hinge, slider, screw and limits, the range of a
channel and the targets of the bindings in the file. Not built with GCC here.
This commit is contained in:
maj00r
2026-11-29 01:47:21 +01:00
parent 64c54b8a38
commit 55c7050c49
14 changed files with 383 additions and 7 deletions
+1
View File
@@ -100,6 +100,7 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
// lineside <vehicle|hekto|fouling|parallel> the tab of the objects along the track in the track window
// event <name> queues the event
// eventrun <name> runs the event at once, its targets found first, as the simulation does (the editor runs none)
// channel <node> <name> <value> sets a channel of the model of the instance (EU07M)
// clip <node> <name> [speed] starts an animation clip of the model of the instance (EU07M), by the simulation time
// animate <node> <submodel> <x> <y> <z> turns a submodel of a model instance to the angles, as an animation event does (the
// editor doesn't run the events); the animation goes by the simulation time