public static FullAnimation From3DMAXStream(System.IO.Stream stream, SkeletonExtended skeleton, bool reverse) { Matrix[][] Frames; var clip = new FullAnimation(); var reader = new System.IO.BinaryReader(stream); var start = reader.ReadInt32(); var end = reader.ReadInt32(); var length = end - start + 1; clip.BonesCount = reader.ReadInt32(); var counter = reader.ReadInt32(); Frames = new Matrix[length][]; for (int i = 0; i < length; i++) Frames[i] = new Matrix[clip.BonesCount]; for (int i = 0; i < clip.BonesCount; i++) for (int j = 0; j < length; j++) Frames[j][i] = reader.ReadMatrix(); //теперь надо вычислить дельты //(идёт загрузка экспортированного из макса) for (int i = 0; i < clip.BonesCount; i++) for (int @in = 0; @in < length; @in++) Frames[@in][i] = skeleton.baseskelet.bones[i].BaseMatrix * Frames[@in][i]; if (reverse) { //Matrix[][] FramesTmp = new Matrix[length][]; Frames = Frames.Reverse().ToArray(); } Matrix[][] relatedMatrices = Animation.GetRelatedMatrices(Frames, skeleton.baseskelet); DecomposedMatrix[][] decomposedMatrices = GetDecomposedMatrices(skeleton.baseskelet, relatedMatrices); clip.matrices = decomposedMatrices; return clip; }
public BoundingBox(System.IO.BinaryReader reader) { unknownInt = reader.ReadInt32(); position = reader.ReadVector3(); rotation = reader.ReadMatrix(); size = reader.ReadVector3(); }