示例#1
0
        public void activar(float elapsedTime,TgcText2d textGanaste, TgcText2d textGanaste2,TgcText2d textoContadorTiempo,TgcText2d textoMejorTiempo,TgcMesh piramid, TgcSkyBox skyBox, bool terminoJuego,TgcSprite tablero,TgcText2d textFPS)
        {
            Device device = GuiController.Instance.D3dDevice;
            Control panel3d = GuiController.Instance.Panel3d;
            float aspectRatio = (float)panel3d.Width / (float)panel3d.Height;
            time += elapsedTime;

            // animo la pos del avion
            if (!terminoJuego)
            {
                g_LightPos = motorcycle.Position + 2f*(new Vector3(100, 60, 0));
                g_LightDir = motorcycle.Position + (new Vector3(0, 0, 0)) - g_LightPos;
                g_LightDir.Normalize();
            }
            // Shadow maps:
            device.EndScene();      // termino el thread anterior

            GuiController.Instance.RotCamera.CameraCenter = new Vector3(0, 0, 0);
            GuiController.Instance.RotCamera.CameraDistance = 100;
            GuiController.Instance.RotCamera.RotationSpeed = 2f;
            GuiController.Instance.CurrentCamera.updateCamera();
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);

            //Genero el shadow map
            RenderShadowMap();

            device.BeginScene();
            // dibujo la escena pp dicha
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
            RenderScene(false);
            if (terminoJuego)
            {
                textGanaste.render();
                textGanaste2.render();
            }

            GuiController.Instance.Drawer2D.beginDrawSprite();
            //Dibujar sprite (si hubiese mas, deberian ir todos aquí)
            tablero.render();
            //Finalizar el dibujado de Sprites
            GuiController.Instance.Drawer2D.endDrawSprite();

            textFPS.Text = "            FPS: " + HighResolutionTimer.Instance.FramesPerSecond.ToString();
            textFPS.render();

            textoContadorTiempo.render();
            textoMejorTiempo.render();
            piramid.render();
            renderEscena(elapsedTime);
            device.Transform.Projection =
                Matrix.PerspectiveFovLH(Geometry.DegreeToRadian(45.0f),
                TgcD3dDevice.aspectRatio, 1f, 20000f);

            skyBox.render();
        }