private static void AddDebugSuspensionPoints(CarData.SuspensionsPack pack, CarData.SuspensionBase suspension, InputLayouts.VerticePC[] result, ref int index) { for (var i = 0; i < suspension.DebugLines.Length; i++) { var line = suspension.DebugLines[i]; result[index++] = new InputLayouts.VerticePC(pack.TranslateRelativeToCarModel(suspension, line.Start), line.Color.ToVector4()); result[index++] = new InputLayouts.VerticePC(pack.TranslateRelativeToCarModel(suspension, line.End), line.Color.ToVector4()); } }
private static InputLayouts.VerticePC[] GetDebugSuspensionVertices(CarData.SuspensionsPack pack) { CarData.IndependentSuspensionsGroup ifg, irg; CarData.DependentSuspensionGroup dfg, drg; var index = 0; var result = new InputLayouts.VerticePC[(CountDebugSuspensionPoints(pack.Front, out ifg, out dfg) + CountDebugSuspensionPoints(pack.Rear, out irg, out drg)) * 2]; AddDebugSuspensionPoints(pack, result, ifg, dfg, ref index); AddDebugSuspensionPoints(pack, result, irg, drg, ref index); return(result); }
private static void AddDebugSuspensionPoints(CarData.SuspensionsPack pack, InputLayouts.VerticePC[] result, CarData.IndependentSuspensionsGroup independent, CarData.DependentSuspensionGroup dependent, ref int index) { if (independent != null) { AddDebugSuspensionPoints(pack, independent.Left, result, ref index); AddDebugSuspensionPoints(pack, independent.Right, result, ref index); } else if (dependent != null) { AddDebugSuspensionPoints(pack, dependent.Both, result, ref index); } }