public FMAAKey GetLeft(int frame) { FMAAKey prev = keys[0]; for (int i = 0; i < keys.Count - 1; i++) { FMAAKey key = keys[i]; if (key.frame > frame && prev.frame <= frame) { break; } prev = key; } return(prev); }
public BFRES_MTA(MaterialAnim vis) { ImageKey = "image"; SelectedImageKey = "image"; Text = vis.Name; FrameCount = (uint)vis.FrameCount; foreach (MaterialAnimData matanim in vis.MaterialAnimDataList) { MatAnimEntry mat = new MatAnimEntry(); FMAANode matnode = new FMAANode(matanim); mat.Text = matanim.Name; for (int Frame = 0; Frame < vis.FrameCount; Frame++) { int CurTrack = 0; foreach (FMAATrack track in matnode.tracks) { MatAnimData md = new MatAnimData(); float value; if (matanim.Curves[CurTrack].CurveType == AnimCurveType.Cubic) { FMAAKey left = track.GetLeft(Frame); FMAAKey right = track.GetRight(Frame); value = Animation.Hermite(Frame, left.frame, right.frame, 0, 0, left.unk1, right.unk1); md.keys.Add(value); } mat.matCurves.Add(md); CurTrack++; } } matEntries.Add(mat); } }
public FMAAKey GetRight(int frame) { FMAAKey cur = keys[0]; FMAAKey prev = keys[0]; for (int i = 1; i < keys.Count; i++) { FMAAKey key = keys[i]; cur = key; if (key.frame > frame && prev.frame <= frame) { break; } prev = key; } return(cur); }