2026-05-17 15:40:16 +03:00
|
|
|
using Common;
|
2026-05-17 02:31:11 +03:00
|
|
|
using NResLib;
|
|
|
|
|
|
2026-05-17 15:40:16 +03:00
|
|
|
namespace MshLib;
|
2026-05-17 02:31:11 +03:00
|
|
|
|
|
|
|
|
public static class Msh0x08
|
|
|
|
|
{
|
|
|
|
|
public static List<AnimationDescriptor> ReadComponent(FileStream mshFs, NResArchive archive)
|
|
|
|
|
{
|
|
|
|
|
var entry = archive.Files.FirstOrDefault(x => x.FileType == "08 00 00 00");
|
|
|
|
|
|
|
|
|
|
if (entry is null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Archive doesn't contain animation descriptor component (0x08)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mshFs.Seek(entry.OffsetInFile, SeekOrigin.Begin);
|
|
|
|
|
|
|
|
|
|
var descriptors = new List<AnimationDescriptor>();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < entry.ElementCount; i++)
|
|
|
|
|
{
|
|
|
|
|
descriptors.Add(new AnimationDescriptor(
|
|
|
|
|
new Vector3(mshFs.ReadFloatLittleEndian(),
|
|
|
|
|
mshFs.ReadFloatLittleEndian(),
|
|
|
|
|
mshFs.ReadFloatLittleEndian()),
|
|
|
|
|
mshFs.ReadFloatLittleEndian(),
|
|
|
|
|
new UShortQuaternion(
|
2026-06-06 00:42:07 +03:00
|
|
|
mshFs.ReadInt16LittleEndian(),
|
|
|
|
|
mshFs.ReadInt16LittleEndian(),
|
|
|
|
|
mshFs.ReadInt16LittleEndian(),
|
|
|
|
|
mshFs.ReadInt16LittleEndian()
|
2026-05-17 02:31:11 +03:00
|
|
|
)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return descriptors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public record AnimationDescriptor(
|
|
|
|
|
Vector3 Position,
|
|
|
|
|
float Time,
|
|
|
|
|
UShortQuaternion Rotation
|
|
|
|
|
);
|
|
|
|
|
}
|