Esempio n. 1
0
        }         // ShowGroundGrid()

        /// <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);
            }
        }         // ShowTrackLines(track)
Esempio n. 2
0
        }         // ShowUpVectors(track)

        #endregion

        #region Test rendering track
        //*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);
            });
        }         // TestRenderingTrack()
Esempio n. 3
0
        }         // TestRenderingTrack()

        //*/
        #endregion

        #region Test rendering TrackData
        /// <summary>
        /// Test rendering TrackData
        /// </summary>
        //[Test]
        public static void TestRenderingColladaTrack()
        {
            TrackLine track = new TrackLine(
                TrackData.Load("TrackSimple"), null);

            TestGame.Start(
                delegate
            {
                SpeedyRacerManager.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);
            });
        }         // TestRenderingTrack()
Esempio n. 4
0
        }         // ShowTrackLines(track)

        /// <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)
        }         // ShowUpVectors(track)
        //*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);
                });
        }
        /// <summary>
        /// Test rendering TrackData
        /// </summary>
        //[Test]
        public static void TestRenderingColladaTrack()
        {
            TrackLine track = new TrackLine(
                TrackData.Load("TrackSimple"), null);

            TestGame.Start(
                delegate
                {
                    SpeedyRacerManager.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 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)
 }
 /// <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);
 }