// Functions for getting various parameters from legacy TR structs. public static void TR_GetBFrameBB_Pos(Level tr, int frame_offset, BoneFrame bone_frame) { if(frame_offset < tr.FrameData.Length) { var frame = tr.FrameData.Skip(frame_offset).ToArray(); bone_frame.BBMin[0] = frame[0]; bone_frame.BBMin[1] = frame[4]; bone_frame.BBMin[2] = -frame[3]; bone_frame.BBMax[0] = frame[1]; bone_frame.BBMax[1] = frame[5]; bone_frame.BBMax[2] = -frame[2]; bone_frame.Position[0] = frame[6]; bone_frame.Position[1] = frame[8]; bone_frame.Position[2] = -frame[7]; } else { bone_frame.BBMin = Vector3.Zero; bone_frame.BBMax = Vector3.Zero; bone_frame.Position = Vector3.Zero; } bone_frame.Centre = (bone_frame.BBMin - bone_frame.BBMax) / 2.0f; }
public static void Copy(BoneFrame dst, BoneFrame src) { dst.BoneTags.Resize(src.BoneTags.Count, () => new BoneTag()); dst.Position = src.Position; dst.Centre = src.Centre; dst.BBMax = src.BBMax; dst.BBMin = src.BBMin; dst.Command = src.Command; dst.Move = src.Move; for (var i = 0; i < dst.BoneTags.Count; i++) { dst.BoneTags[i] = new BoneTag { QRotate = src.BoneTags[i].QRotate, Offset = src.BoneTags[i].Offset }; } }