private Meta ReadMetaAndCheck(MmdModel model) { var magic = MmdReaderUtil.ReadStringFixedLength(_reader, 4, Encoding.UTF8); if (!"VBP ".Equals(magic)) { throw new BonePoseFileFormatException("error magic " + magic); } var mainVersion = _reader.ReadInt16(); var subVersion = _reader.ReadInt16(); if (mainVersion != 1 || subVersion != 0) { throw new BonePoseFileFormatException("not supported version: " + mainVersion + "." + subVersion); } var ret = new Meta { BoneCount = _reader.ReadInt32(), FrameCount = _reader.ReadInt32(), StepLength = _reader.ReadSingle() }; var exceptedModelHash = _reader.ReadBytes(16); var modelHash = BonePoseFileGenerator.CalculateModelHash(model); if (!exceptedModelHash.SequenceEqual(modelHash)) { throw new BonePoseNotSuitableException("model hash not equals the value in bone pose file"); } return(ret); }
public static BonePoseFileGenerator GenerateAsync(MmdModel model, MmdMotion motion, string savePath, float frameStepLength = DefaultStepLength, float timeAfterMotionFinish = 0.0f, float physicsStepLength = DefaultStepLength) { var ret = new BonePoseFileGenerator(); new Thread(() => { ret.DoGenerate(model, motion, savePath, frameStepLength, timeAfterMotionFinish, physicsStepLength); }).Start(); return(ret); }