Exemple #1
0
        //(Matrix viewMatrix, Matrix projectionMatrix)
        /// <summary>
        /// Draws a heads up display on the current camera in its viewport, as long as the ship is not PlayerType.None
        /// </summary>
        public static void DrawHUD(CameraWrapper camera, Racer racer, GameTime gameTime)
        {
            //Getting information from the GraphicsDevice might be very slow on Xbox
            int viewportHeight = camera.Viewport.Height;
            int viewportWidth = camera.Viewport.Width;

            if (racer.racerType == RacerType.None)
                return;//No HUD when just viewing ship model.
            //Draw speed text //must be after mesh.draw

            int vOffset = camera.Viewport.Height - 60;

            //MainGame.graphics.GraphicsDevice.BlendState = BlendState.AlphaBlend;//Set display states

            int bleedHeight = (int)(viewportHeight * 0.1);
            int bleedWidth = (int)(viewportWidth * 0.1);

            if (racer.raceTiming.hasCompletedRace && GameLoop.raceComplete != true)
            {
                ////////////////////////
                ///// FINAL RESULTS ////
                ////////////////////////
                if (Race.currentRaceType.getRaceType().Equals(RaceType.LappedRace))
                {
                    //BeatShift.spriteBatch.Begin();//(SpriteSortMode.Immediate, BlendState.AlphaBlend);
                    //DrawMessage("Finished!", 325, vOffset / 2);
                    DrawMessageColour(BeatShift.newfont, "Finished!", viewportWidth / 4, viewportHeight / 2 + 40, 0.6f, Color.PapayaWhip);
                    //DrawMessage("Final Time: " + racer.raceTiming.getFinalTotalTime(), 300, vOffset / 2 + 40);
                }
                if (Race.currentRaceType.getRaceType().Equals(RaceType.EliminiationRace))
                {
                    BeatShift.spriteBatch.Draw(GameTextures.Eliminated, new Rectangle(viewportWidth / 2 - GameTextures.Eliminated.Width / 2, 3 * viewportHeight / 3, GameTextures.Eliminated.Width, GameTextures.Eliminated.Height), Color.PapayaWhip);
                    //DrawMessage("ELIMINATED!", 325, vOffset / 2);
                }
                if (Race.currentRaceType.getRaceType().Equals(RaceType.TimeTrialRace))
                {
                    //BeatShift.spriteBatch.Begin();
                    DrawMessageColour(BeatShift.newfont, "Best Lap: " + racer.raceTiming.getBestLapTime(), viewportWidth / 4, viewportHeight / 2, 0.5f, Color.PapayaWhip);
                    //DrawMessage("Best lap time: " + racer.raceTiming.getBestLapTime(), 325, vOffset / 2);
                }

            }
            else
            {
                //Draw messages to when points are given
                ////////////////////
                //// Points Msg ////
                ////////////////////
                racer.racerPoints.pointsPopupManager.Draw(new Vector2(80f, viewportHeight - 140));
                //DrawMessageColour(BeatShift.newfont, racer.racerPoints.getTotalPoints().ToString(), viewportWidth - 125, 195, 0.3f, Color.Goldenrod);

                //////////////////
                //// Messages ////
                //////////////////
                racer.messagePopupManager.Draw(new Vector2(180f, viewportHeight - 140));
                //DrawMessageColour(BeatShift.newfont, racer.racerPoints.getTotalPoints().ToString(),viewportWidth - 125, 195, 0.4f, Color.Goldenrod);

                /////////////////////
                ///// HUD BAR ///////
                /////////////////////
                int h = viewportWidth / (GameTextures.HudBar.Width / GameTextures.HudBar.Height);

                if (viewportWidth > 700)
                {
                    BeatShift.spriteBatch.Draw(GameTextures.HudBar, new Rectangle(0, viewportHeight - GameTextures.HudBar.Height, GameTextures.HudBar.Width, GameTextures.HudBar.Height), Color.White);
                }
                else
                {
                    BeatShift.spriteBatch.Draw(GameTextures.HudBarSmall, new Rectangle(0, viewportHeight - GameTextures.HudBarSmall.Height, GameTextures.HudBarSmall.Width, GameTextures.HudBarSmall.Height), Color.White);
                }
                ////////////////////////////
                ///// ORANGE BOOST BAR /////
                ////////////////////////////

                racer.raceTiming.previousBoost = MathHelper.Lerp(racer.raceTiming.previousBoost, (float)racer.racingControls.getBoostValue() / 100, 0.1f);
                racer.raceTiming.previousLapProgress = MathHelper.Lerp(racer.raceTiming.previousLapProgress, (float)racer.shipPhysics.getLapPercentage() / 100, 0.05f);

                var chosenLine = (viewportWidth > 700) ? GameTextures.BoostBarLine : GameTextures.BoostBarLineSmall;
                int srcWidth = (int)((chosenLine.Width) * racer.raceTiming.previousBoost);

                if (viewportWidth > 700)
                {
                    Rectangle orange_src2 = new Rectangle(chosenLine.Width - srcWidth, 0, chosenLine.Width, chosenLine.Height);
                    Rectangle orange_dest = new Rectangle(36, viewportHeight - chosenLine.Height, chosenLine.Width, chosenLine.Height);
                    BeatShift.spriteBatch.Draw(chosenLine, orange_dest, orange_src2, Color.White);
                }
                else
                {
                    Rectangle orange_src2 = new Rectangle(chosenLine.Width - srcWidth, 0, chosenLine.Width, chosenLine.Height);
                    Rectangle orange_dest = new Rectangle(21, viewportHeight - chosenLine.Height, chosenLine.Width, chosenLine.Height);
                    BeatShift.spriteBatch.Draw(chosenLine, orange_dest, orange_src2, Color.White);
                }

                /////////////////////////
                ///////// LEVEL /////////
                /////////////////////////

                if (viewportWidth > 700)
                {
                    DrawMessageColour(BeatShift.volterfont, "LEVEL", viewportWidth - 240, vOffset - 53, 0.5f, Color.PapayaWhip);
                    DrawMessageColour(BeatShift.volterfont, (racer.beatQueue.getLayer() + 1).ToString(), viewportWidth - 230, vOffset - 35, 1f, Color.PapayaWhip);
                }
                else
                {
                    DrawMessageColour(BeatShift.volterfont, "LEVEL", viewportWidth - 143, vOffset - 12, 0.4f, Color.PapayaWhip);
                    DrawMessageColour(BeatShift.volterfont, (racer.beatQueue.getLayer() + 1).ToString(), viewportWidth - 136, vOffset - 3, 0.8f, Color.PapayaWhip);
                }

                //////////////////////////
                /////// COMBO COUNT //////
                //////////////////////////

                //if (viewportWidth > 700)
                //{
                //    DrawMessageColour(BeatShift.volterfont, racer.beatQueue.getCombo().ToString()+"x", viewportWidth - 240, vOffset - 73, 3f, Color.Black);
                //}
                //else
                //{
                //    DrawMessageColour(BeatShift.volterfont, racer.beatQueue.getCombo().ToString() + "x", viewportWidth - 143, vOffset - 42, 2.4f, Color.Black);
                //}

                //DrawMessageColour(BeatShift.volterfont, GameDebugTools.ReflectionTracker.getTrackedAsString(), 0, 0, 1.2f, Color.Black);
                //DrawMessageColour(BeatShift.volterfont, "nextWaypoint: " + racer.shipPhysics.nextWaypoint.getIndex(), 0, 50, 1.5f, Color.Black);
                //DrawMessageColour(BeatShift.volterfont, "currentProgressWaypoint: " + racer.shipPhysics.currentProgressWaypoint.getIndex(), 0, 80, 1.5f, Color.Black);
                //DrawMessageColour(BeatShift.volterfont, "nearestMapPoint: " + racer.shipPhysics.nearestMapPoint.getIndex(), 0, 110, 1.5f, Color.Black);

                ////////////////////////
                /////// SPEED //////////
                ////////////////////////
                try
                {
                    racer.raceTiming.previousSpeed = MathHelper.Lerp(racer.raceTiming.previousSpeed, (Math.Abs((int)racer.shipPhysics.getForwardSpeed())), 0.05f);
                }
                catch (OverflowException e)
                {
                    racer.raceTiming.previousSpeed = 0;
                }
                racer.raceTiming.speedToDisplay = String.Format("{0:0000}", racer.raceTiming.previousSpeed);
                if (viewportWidth > 700)
                {
                    DrawMessageColour(BeatShift.volterfont, "MPH", viewportWidth - 126, vOffset - 42, 0.5f, Color.Black);
                    DrawMessageColour(BeatShift.newfont, racer.raceTiming.speedToDisplay, viewportWidth - 185, vOffset - 48, 0.4f, Color.Black);
                }
                else
                {
                    DrawMessageColour(BeatShift.volterfont, "MPH", viewportWidth - 75, vOffset - 14, 0.5f, Color.Black);
                    DrawMessageColour(BeatShift.newfont, racer.raceTiming.speedToDisplay, viewportWidth - 110, vOffset - 8, 0.4f, Color.Black);
                }

                //////////////////////////////
                /////// TOP RIGHT BOARD //////
                //////////////////////////////

                double scaleFactorHeight = (double)viewportHeight / 720;
                double scaleFactorWidth = scaleFactorHeight;// (double)viewportWidth / 1280;

                int newBoardWidth = (int)(GameTextures.TopRightBoard.Width * scaleFactorWidth);
                int newBoardHeight = (int)(GameTextures.TopRightBoard.Height * scaleFactorHeight);

                if (Race.currentRaceType.getRaceType().Equals(RaceType.EliminiationRace))
                {
                    {
                        Rectangle d = new Rectangle(viewportWidth - GameTextures.EliminationBar.Width, 0, GameTextures.EliminationBar.Width, GameTextures.EliminationBar.Height);
                        BeatShift.spriteBatch.Draw(GameTextures.EliminationBar, d, Color.White);

                        if ( racer.raceTiming.currentRanking == Race.currentRacers.Count)
                            DrawMessageColour(BeatShift.newfont, "DANGER!", viewportWidth - 190, 55, 0.75f, Color.White);
                        else
                            DrawMessageColour(BeatShift.newfont, "SAFE", viewportWidth - 180, 55, 0.75f, Color.White);

                        //if (racer.raceTiming.currentRanking == 1)
                        //{
                        //    DrawMessageColour(BeatShift.newfont, racer.raceTiming.currentRanking.ToString(), viewportWidth - 160, 55, 0.75f, Color.PapayaWhip);
                        //    DrawMessageColour(BeatShift.newfont, calculateRankSuffix(racer.raceTiming.currentRanking), viewportWidth - 140, 55, 0.75f, Color.PapayaWhip);
                        //}
                        //else
                        //{
                        //    DrawMessageColour(BeatShift.newfont, racer.raceTiming.currentRanking.ToString(), viewportWidth - 160, 55, 0.75f, Color.PapayaWhip);
                        //    DrawMessageColour(BeatShift.newfont, calculateRankSuffix(racer.raceTiming.currentRanking), viewportWidth - 135, 55, 0.75f, Color.PapayaWhip);
                        //}
                    }
                }
                else if (Race.currentRaceType.getRaceType().Equals(RaceType.PointsRace))
                {
                    if (viewportWidth > 700)
                    {
                        Rectangle d = new Rectangle(viewportWidth - GameTextures.PointsHUD.Width, 0, GameTextures.PointsHUD.Width, GameTextures.PointsHUD.Height);
                        BeatShift.spriteBatch.Draw(GameTextures.PointsHUD, d, Color.White);
                    }
                    else
                    {
                        Rectangle d = new Rectangle(viewportWidth - GameTextures.PointsHUD.Width, 0, GameTextures.PointsHUD.Width, GameTextures.PointsHUD.Height);
                        BeatShift.spriteBatch.Draw(GameTextures.PointsHUD, d, Color.White);
                    }
                }
                else
                {
                    if (viewportWidth > 700)
                    {
                        Rectangle d = new Rectangle(viewportWidth - GameTextures.TopRightBoard.Width, 0, GameTextures.TopRightBoard.Width, GameTextures.TopRightBoard.Height);
                        BeatShift.spriteBatch.Draw(GameTextures.TopRightBoard, d, Color.White);
                    }
                    else
                    {
                        Rectangle d = new Rectangle(viewportWidth - GameTextures.TopRightBoardSmall.Width, 0, GameTextures.TopRightBoardSmall.Width, GameTextures.TopRightBoardSmall.Height);
                        BeatShift.spriteBatch.Draw(GameTextures.TopRightBoardSmall, d, Color.White);
                    }
                }

                //////////////////////////////
                //////// TOTAL POINTS ////////
                //////////////////////////////

                if (Race.currentRaceType.displayTotalPoints)
                {
                    DrawMessageColour(BeatShift.newfont, racer.racerPoints.getTotalPoints().ToString(), viewportWidth - GameTextures.PointsHUD.Width/2 -65, 65, 1f, Color.PapayaWhip);
                }

                //////////////////////////////
                ////////// TOTAL LAPS ////////
                //////////////////////////////

                if (Race.currentRaceType.displayCurrentLapOutofTotalLaps)
                {
                    if (viewportWidth > 700)
                    {
                        if (racer.raceTiming.isRacing == true)
                            DrawMessageColour(BeatShift.newfont, (racer.raceTiming.currentLap + 1) + "/" + Race.currentRaceType.maxLaps, viewportWidth - 125, 33, 0.5f, Color.PapayaWhip);
                        else
                            DrawMessageColour(BeatShift.newfont, (racer.raceTiming.currentLap) + "/" + Race.currentRaceType.maxLaps, viewportWidth - 125, 33, 0.5f, Color.PapayaWhip);
                        DrawMessageColour(BeatShift.volterfont, "LAPS", viewportWidth - 74, 39, 1f, Color.DimGray);
                    }
                    else
                    {
                        if (racer.raceTiming.isRacing == true)
                            DrawMessageColour(BeatShift.volterfont, (racer.raceTiming.currentLap + 1) + "/" + Race.currentRaceType.maxLaps, viewportWidth - 82, 25, 0.5f, Color.PapayaWhip);
                        else
                            DrawMessageColour(BeatShift.volterfont, (racer.raceTiming.currentLap) + "/" + Race.currentRaceType.maxLaps, viewportWidth - 82, 25, 0.5f, Color.PapayaWhip);
                        DrawMessageColour(BeatShift.volterfont, "LAPS", viewportWidth - 54, 25, 0.5f, Color.PapayaWhip);
                    }
                }

                //////////////////////////////
                ///////// CURRENT LAP ////////
                //////////////////////////////

                if (Race.currentRaceType.displayCurrentLapTime)
                {
                    if (viewportWidth > 700)
                    {
                        DrawMessageColour(BeatShift.newfont, racer.raceTiming.getCurrentLapTime(), viewportWidth - 125, 70, 0.4f, Color.PapayaWhip);
                    }
                    else
                    {
                        DrawMessageColour(BeatShift.newfont, racer.raceTiming.getCurrentLapTime(), viewportWidth - 125, 36, 0.4f, Color.PapayaWhip);
                    }
                }
                /////////////////////////////
                ////// WRONG WAY SIGN ///////
                /////////////////////////////

                if (racer.shipPhysics.wrongWay == true)
                {
                    int newWarningWidth = (int)(GameTextures.WrongWaySign.Width * scaleFactorWidth);
                    int newWarningHeight = (int)(GameTextures.WrongWaySign.Height * scaleFactorHeight);
                    BeatShift.spriteBatch.Draw(GameTextures.WrongWaySign, new Rectangle(viewportWidth / 2 - newWarningWidth / 2, viewportHeight / 2 - newWarningHeight / 2, newWarningWidth, newWarningHeight), Color.White);
                }

                /////////////////////////////
                ////// RESETTING SIGN ///////
                /////////////////////////////

                if (racer.isRespawning && racer.shipPhysics.millisecsLeftTillReset < 2000)
                {
                    int newWarningWidth = (int)(GameTextures.ResettingSign.Width * scaleFactorWidth);
                    int newWarningHeight = (int)(GameTextures.ResettingSign.Height * scaleFactorHeight);
                    BeatShift.spriteBatch.Draw(GameTextures.ResettingSign, new Rectangle(viewportWidth / 2 - newWarningWidth / 2, viewportHeight / 2 - newWarningHeight / 2, newWarningWidth, newWarningHeight), Color.White);
                }

                /////////////////////////////
                ////// COUNTDOWN SIGN ///////
                /////////////////////////////

                if (Race.currentRaceType.countDownRunning)
                    BeatShift.spriteBatch.Draw(Race.currentRaceType.countdownState, new Vector2(viewportWidth / 2 - Race.currentRaceType.countdownState.Width / 2, viewportHeight / 2 - Race.currentRaceType.countdownState.Height / 2), Color.White);

                // Other info
                //DrawMessage("Progress: " + racer.getLapPercentage() + "%", 10, vOffset + 26);
                //DrawMessage("Accuracy: " + racer.racingControls.getLastPress(), 10, vOffset - 30);
                //DrawMessage("Dist from trac: " + racer.shipPhysics.shipRayToTrackTime, 10, vOffset - 30);
                //DrawNewMessage(" !\"#$%'()*+,-./0123456789:;<=>?@ABCDEFGHIJ", 0, 30);
                //DrawNewMessage("KLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrrstuvwxyz{|}~", 0, 90);

                //////////////////////////////
                ////////// BEST LAP //////////
                //////////////////////////////

                if (Race.currentRaceType.displayCurrentBestLap)
                {
                    if (viewportWidth > 700)
                    {
                        DrawMessageColour(BeatShift.newfont, racer.raceTiming.getBestLapTime(), viewportWidth - 125, 95, 0.4f, Color.Goldenrod);
                    }

                    //////////////////////////
                    ////////// RANK //////////
                    //////////////////////////

                    if (Race.currentRaceType.displayCurrentRank && racer.raceTiming.currentRanking == 0)
                    {
                        if (viewportWidth > 700)
                        {
                            DrawMessageColour(BeatShift.newfont, "-", viewportWidth - 190, 22, 0.75f, Color.PapayaWhip);
                        }
                        else
                        {
                            DrawMessageColour(BeatShift.newfont, "-", viewportWidth - 187, 22, 0.75f, Color.PapayaWhip);
                        }
                    }
                    else if (Race.currentRaceType.displayCurrentRank)
                    {
                        if (viewportWidth > 700)
                        {
                            DrawMessageColour(BeatShift.newfont, racer.raceTiming.currentRanking.ToString(), viewportWidth - 190, 22, 0.75f, Color.PapayaWhip);
                        }
                        else
                        {
                            DrawMessageColour(BeatShift.newfont, racer.raceTiming.currentRanking.ToString(), viewportWidth - 187, 22, 0.75f, Color.PapayaWhip);
                        }
                        //DrawMessage(BeatShift.newfont, calculateRankSuffix(racer.raceTiming.currentRanking), viewportWidth - 178 + extraSuffixOffset(racer.raceTiming.currentRanking), 26, 0.25f);
                    }
                }

            }
        }
Exemple #2
0
        void drawWithBShiftEffect(Model model, Matrix[] transforms, CameraWrapper camera)
        {
            Matrix view = camera.View;
            Matrix projectionMatrix = camera.Projection;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart mmPart in mesh.MeshParts)
                {
                    // mmPart.Effect = bshiftEffect;
                    Effect effect = mmPart.Effect;
                    Matrix worldTransform = transforms[mesh.ParentBone.Index];
                    effect.Parameters["world_Mx"].SetValue(worldTransform);
                    effect.Parameters["wvp_Mx"].SetValue(worldTransform * view * projectionMatrix);

                    //Matrix worldInverseTranspose = Matrix.Transpose(Matrix.Invert(worldTransform));
                    //effect.Parameters["wit_Mx"].SetValue(worldInverseTranspose);

                    Matrix viewInverse = Matrix.Invert(view);
                    effect.Parameters["viewInv_Mx"].SetValue(viewInverse);

                    effect.Parameters["useAmbient"].SetValue(Globals.useAmbient);
                    effect.Parameters["useLambert"].SetValue(Globals.useLambert);
                    effect.Parameters["useSpecular"].SetValue(Globals.useSpecular);
                    effect.Parameters["drawNormals"].SetValue(Globals.drawNormals);
                }
                mesh.Draw();
            }
        }
Exemple #3
0
 public RacerHuman(RacerId rID, int shipNumber, RacerType racer_Type, int viewportIndex, Boolean hasPhysics)
     : base(rID, shipNumber, racer_Type)
 {
     cameraIndex = viewportIndex;
     localCamera = new CameraWrapper(this);
 }
Exemple #4
0
        void drawTrackNormals(GameTime gameTime, CameraWrapper camera)
        {
            MapPoint point;
            for (int i = CurrentMapData.mapPoints.Count - 1; i >= 0; i--)
            {
                point = CurrentMapData.mapPoints[i];

                Vector3 drawPosition = point.position;
                DrawVector.drawArrow(camera, drawPosition, point.roadSurface * 9f, yellow);
                DrawVector.drawArrow(camera, drawPosition, point.tangent * 12f, blue);
                DrawVector.drawArrow(camera, drawPosition, point.trackUp * 12f, red);
            }
        }
Exemple #5
0
        void drawWithBasicEffect(FbxModel fbxModel, CameraWrapper camera)
        {
            Matrix viewMatrix = camera.View;
            Matrix projectionMatrix = camera.Projection;
            foreach (ModelMesh mesh in fbxModel.model.Meshes)
            {
                foreach (BasicEffect beffect in mesh.Effects)
                {
                    beffect.View = viewMatrix;
                    beffect.Projection = projectionMatrix;
                    beffect.World = fbxModel.transforms[mesh.ParentBone.Index];

                    beffect.EnableDefaultLighting();
                    beffect.PreferPerPixelLighting = true;
                }
                mesh.Draw();
            }
        }
Exemple #6
0
        void drawModel(FbxModel modelObject, GameTime gameTime, CameraWrapper camera)
        {
            //Don't draw invisible things
            if (modelObject.category == ModelCategory.InvisibleWall) return;
            if (modelObject.category == ModelCategory.GlowScenery) return;
            //Don't draw when settings turn scenery display off
            if ((!Globals.DisplayScenery) && (modelObject.category.Equals(ModelCategory.SceneryFx)||modelObject.category.Equals(ModelCategory.SceneryBasic)) ) return;//If scenery should not be displayed, don't draw scenry

            //Draw both sides of track by changing cull mode
            if (modelObject.category == ModelCategory.Track) BeatShift.graphics.GraphicsDevice.RasterizerState = RasterizerState.CullNone;

            if (modelObject.category==ModelCategory.SceneryBasic)
            {
                drawWithBasicEffect(modelObject, camera);
            }
            else
            {
                drawWithBShiftEffect(modelObject.model, modelObject.transforms, camera);
            }
            if (modelObject.category == ModelCategory.Track) BeatShift.graphics.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
        }
Exemple #7
0
        void drawSpheresOnSingleCamera(GameTime gameTime, CameraWrapper camera)
        {
            //MainGame.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            //MainGame.graphics.GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

            Matrix viewMatrix = camera.View;
            Matrix projectionMatrix = camera.Projection;
            foreach (ModelMesh mesh in sphere.model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    //boxEffect = new BasicEffect(BeatShift.graphics.GraphicsDevice);
                    effect.View = viewMatrix;
                    effect.Projection = projectionMatrix;
                    effect.World = sphere.transforms[mesh.ParentBone.Index];

                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;

                    effect.DiffuseColor = Color.OrangeRed.ToVector3();
                    effect.Alpha = 0.2f;

                    MapPoint point;
                    for (int i = CurrentMapData.mapPoints.Count - 1; i >= 0; i--)//draw in reverse order so transparency works when going the right way round the track
                    {
                        point = CurrentMapData.mapPoints[i];
                        effect.World = Matrix.CreateScale(point.getWidth()) * Matrix.CreateTranslation(point.position);
                        effect.DiffuseColor = point.getColour();
                        mesh.Draw();
                    }
                }
            }
        }
Exemple #8
0
 public void drawSpheres(GameTime gameTime, CameraWrapper camera)
 {
     BeatShift.graphics.GraphicsDevice.Viewport = camera.Viewport;
     drawSpheresOnSingleCamera(gameTime, camera);
 }
Exemple #9
0
        public void DrawSkybox(GameTime gameTime, CameraWrapper camera)
        {
            BeatShift.graphics.GraphicsDevice.Viewport = camera.Viewport;

            if (!Globals.DisplaySkybox) return;

            Matrix scale = Matrix.CreateScale(7f);
            Matrix[] skyboxTransforms = new Matrix[skyboxModel.Bones.Count];
            skyboxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms);
            Matrix viewMatrix = camera.View;
            Matrix projectionMatrix = camera.Projection;
            //Vector3 upMovement = new Vector3(0f, 50f, 0f);

            foreach (ModelMesh mesh in skyboxModel.Meshes)
            {
                foreach (BasicEffect currentEffect in mesh.Effects)
                {
                    Matrix translation = Matrix.CreateTranslation(camera.racer.shipPhysics.ShipPosition);//+upMovement);
                    currentEffect.View = viewMatrix;
                    currentEffect.Projection = projectionMatrix;

                    currentEffect.World = scale * skyboxTransforms[mesh.ParentBone.Index] * translation;//transforms;
                }

                mesh.Draw();
            }
        }
Exemple #10
0
        public void DrawGlow(GameTime gameTime, CameraWrapper camera)
        {
            BeatShift.graphics.GraphicsDevice.Viewport = camera.Viewport;

            foreach (FbxModel modelObject in modelList)
            {
                if (modelObject.mapName == currentMapName || modelObject.mapName == MapName.All)
                {
                    if(modelObject.category.Equals(ModelCategory.GlowScenery) )
                    {
                        drawWithBShiftEffect(modelObject.model, modelObject.transforms, camera);
                    }
                }
            }
        }
Exemple #11
0
        public void Draw(GameTime gameTime, CameraWrapper camera)
        {
            BeatShift.graphics.GraphicsDevice.Viewport = camera.Viewport;

            if (Options.DrawTrackNormals) //Draw track normals.
            {
                drawTrackNormals(gameTime, camera);
            }

            //DrawMap
            BeatShift.graphics.GraphicsDevice.BlendState = BlendState.Opaque;
            foreach (FbxModel modelObject in modelList)
            {
                if (modelObject.mapName == currentMapName || modelObject.mapName == MapName.All)
                {
                    drawModel(modelObject, gameTime, camera);
                }
            }
        }
Exemple #12
0
 public void DrawAiHUD(CameraWrapper camera, GameTime gameTime)
 {
     String message = "AI-HUD:\nAcceleration: " + accelVal + "\n  -closerBy: " + closerBy + "\n  -cB_Fraction: " + closerByFraction + "\n\nTurn: " + turnVal + "\n  -randInaccuracy: " + randInaccuracy + "\n  -fTrack3: " + fTrack3 + "\n  -fTrack5: " + fTrack5 + "\n  -sideWalls: " + sideWalls + "\n  -frontWalls: " + frontWalls;
     BeatShift.spriteBatch.DrawString(BeatShift.newfont, message, hudPosition, Color.White, 0f, Vector2.Zero, 0.65f, SpriteEffects.None, 1);
     BeatShift.spriteBatch.DrawString(BeatShift.newfont, message, hudPosition2, Color.Black, 0f, Vector2.Zero, 0.65f, SpriteEffects.None, 1);
 }