mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 17:37:09 +01:00
c8068d8f3d
Stage 8 of the EU07M model format. A model can carry animation clips; each track of a clip sets the translation, the rotation or the scale of a node at a time of the clip, and the parts of a node without a track keep its TRS. - Format, five optional sections: ACLP (clips: name, duration, flags 0x1 loop and 0x2 autoplay, range of tracks), ATRK (tracks: node, part, interpolation step / linear / cubic, ranges of keys), ATIM (key times), AVEC (vectors; with cubic the in-tangent, value and out-tangent of glTF) and AROT (rotations in 8 bytes, "smallest three": the three smaller components as snorm16 scaled by sqrt(2) and the index of the largest; eu07m::encode_rotation / decode_rotation). The validator refuses a node out of range, keys out of their arrays, times which aren't numbers from 0 up, a cubic rotation and tracks out of the range of the clip. -eu07m dump lists the clips and their tracks. The current release doesn't read these sections; a file without them loads as before. - Sampling (model/clip.cpp): step, lerp / slerp the shorter way, the Hermite spline of glTF with tangents per second; the first and the last key held outside of them; a looped clip goes around its duration, another stops at its end. - In the game: the clips play by the simulation time, from TAnimModel::play_clip(name, speed) or, flagged autoplay, from the first time the instance is drawn. RaPrepare() samples them for the instance drawn and sets the transforms of the nodes (TSubModel::SetClipTransform(), the new animation type at_Clip, gated by the instance like the others), so a clip moving the joints of a skin bends the skinned parts. The nodes a clip moves are flagged animated at load, which keeps the model out of the instancing. stop_clips() stops them. - The editor self-test gets "clip <node> <name> [speed]". Not yet: a scenery event starting a clip, and the CHNL channels bound to the time of a clip. Checked: a skinned tube with an autoplay clip (the tip to 60 degrees and back in 2 s, looped) beside a still one, six screenshots in Vulkan and in GL 4.6 go from straight to fully bent while the other stays (time let run in the editor for the test only). Unit tests 1200/1200, 6 new ones for the packing, the interpolations, the time and the file. Not built with GCC here.