public Map() { MapContent = new ContentManager(BeatShift.singleton.Services); MapContent.RootDirectory = "Content"; //load map content (specific to each map) LoadContent(); //load common things for all maps sphere = new FbxModel("Sphere", MapContent, MapName.All, ModelCategory.SceneryBasic); //Order the modelList so transparency is drawn in correct order modelList = modelList.OrderBy((m) => m.category).ToList(); }
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(); } }
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; } }
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; }