/// <summary> /// Test rendering TrackData /// </summary> //[Test] public static void TestRenderingColladaTrack() { TrackLine track = new TrackLine( //TrackData.Load("TrackWithHelpers"), null); TrackData.Load("TrackBeginner"), null); TestGame.Start( delegate { RacingGameManager.Player.SetCarPosition(track.points[0].pos, new Vector3(0, 1, 0), new Vector3(0, 0, 1)); ShowGroundGrid(); ShowTrackLines(track); //always show: if (TestGame.Keyboard.IsKeyDown(Keys.LShiftKey)) ShowUpVectors(track); }); }
/// <summary> /// Show track lines /// </summary> /// <param name="track">Track</param> public static void ShowTrackLines(TrackLine track) { // Draw the line for each line part for (int num = 0; num < track.points.Count; num++) BaseGame.DrawLine( track.points[num].pos, track.points[(num + 1)%track.points.Count].pos, Color.White); }
/// <summary> /// Show up vectors /// </summary> /// <param name="track">Track</param> public static void ShowUpVectors(TrackLine track) { // Show up vector for each point for (int num = 0; num < track.points.Count; num++) { BaseGame.DrawLine( track.points[num].pos, track.points[num].pos + track.points[num].up * 2, Color.Red); BaseGame.DrawLine( track.points[num].pos, track.points[num].pos + track.points[num].dir * 2, Color.Blue); BaseGame.DrawLine( track.points[num].pos - track.points[num].right * 2 * track.points[num].roadWidth, track.points[num].pos + track.points[num].right * 2 * track.points[num].roadWidth, Color.Green); } // for (num) }
//*testing /// <summary> /// Test rendering track /// </summary> //[Test] public static void TestRenderingTrack() { /* TrackLine track; // Get rid of all warnings here track = testBigTrack; track = testCurvyTrack; track = testRectTrack; track = testLoopTrack; track = testPoorLoopTrack; track = testBigTrack; */ TrackLine testTrack = new TrackLine( new Vector3[] { new Vector3(20, 0, 0), new Vector3(20, 10, 5), new Vector3(20, 20, 10), new Vector3(10, 25, 10), new Vector3(5, 30, 10), new Vector3(-5, 30, 10), new Vector3(-10, 25, 10), new Vector3(-20, 20, 10), new Vector3(-20, 10, 5), new Vector3(-20, 0, 0), new Vector3(-10, 0, 0), new Vector3(-5, 0, 0), new Vector3(7, 0, 3), new Vector3(10, 0, 10), new Vector3(7, 0, 17), new Vector3(0, 0, 20), new Vector3(-7, 0, 17), new Vector3(-10, -2, 10), new Vector3(-7, -4, 3), new Vector3(5, -6, 0), new Vector3(10, -6, 0), }); TestGame.Start( delegate { ShowGroundGrid(); ShowTrackLines(testTrack); ShowUpVectors(testTrack); }); }