Пример #1
0
        //test draw function
        void FormMain_KeyPress(object sender, KeyPressEventArgs e)
        {
            //camera settings terrain
            cameraTest.CameraPosition.X      = -(512 * xys) + 5000;
            cameraTest.CameraPosition.Z      = -(512 * xys);
            cameraTest.CameraPosition.Y      = 0;
            cameraTest.CameraPosition.Angle3 = 270;
            cameraTest.CameraPosition.Angle1 = -15;

            //model starting position
            mopos.X = -(512 * xys) + 4400;
            mopos.Z = -(512 * xys) + 200;
            mopos.Y = 100;

            //fps counter
            Int64 fpsUpdate = TimerTools.TimerSet(TimerTools.oneSecondMS);

            //testing
            while (true)
            {
                cameraTest.Clear();

                //terrain test
                testT.Render(cameraTest);
                cameraTest.CameraPosition.Y = testT.GetHeight(cameraTest.CameraPosition.X, cameraTest.CameraPosition.Z) + 400; //set camera on top of terrain

                //cameraTest.CameraPosition.Angle3 -= 0.20f; //spin camera

                //model test
                mopos.Y             = testT.GetHeight(mopos.X, mopos.Z) - 50; //set model on top of terrain
                mo.Position.Angle3 += 0.2f;                                   //spin model
                mo.PlayPingPong();
                mo.Render(cameraTest);

                //drawing
                KeyIO.DrawToScreen(cameraTest.ScreenDepthTexture, this);

                //performance measuring
                if (TimerTools.TimerPassed(fpsUpdate))
                {
                    fpsUpdate = TimerTools.TimerSet(TimerTools.oneSecondMS);
                    this.Text = TimerTools.FPS.ToString() + " " + TimerTools.FrameDeltaTime.ToString();//cameraTest.CameraPosition.Angle3.ToString();
                }

                TimerTools.FrameTickAll();
            }
        }