public virtual void Draw(Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.PreferPerPixelLighting = true; be.Projection = camera.projection; be.View = camera.view; be.World = mesh.ParentBone.Transform * GetWorld(); } mesh.Draw(); } }
/// <summary> /// method for arrow to draw itself /// </summary> /// <param name="camera"></param> public override void Draw(Camera camera) { Matrix worldMatrix = Matrix.CreateTranslation(-2*Vector3.UnitY) * Matrix.CreateRotationZ(MathHelper.Pi) * arrowRotation * Matrix.CreateTranslation(position); Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.PreferPerPixelLighting = true; be.Projection = camera.projection; be.View = camera.view; be.World = mesh.ParentBone.Transform * worldMatrix; } mesh.Draw(); } //this causes us to get two arrows, one of which isn't orienting toward the goal //base.Draw(camera); }
/// <summary> /// draw method for the ship /// </summary> /// <param name="camera">need's the camera to draw</param> /// <param name="gd">graphics device, need to adjust Cull types</param> public void Draw(Camera camera, GraphicsDevice gd) { objectiveArrow.Draw(camera); Matrix worldMatrix = Matrix.CreateRotationY(MathHelper.Pi) * shipRotation * Matrix.CreateTranslation(position); Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.PreferPerPixelLighting = true; be.Projection = camera.projection; be.View = camera.view; be.World = mesh.ParentBone.Transform * worldMatrix; } gd.RasterizerState = RasterizerState.CullNone; mesh.Draw(); gd.RasterizerState = RasterizerState.CullCounterClockwise; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); camera = new Camera(this, new Vector3(5, -5, 15), Vector3.Zero, Vector3.Up, _fov); Components.Add(camera); menu = new Menus(this); Components.Add(menu); modelManager = new ModelManager(this); Components.Add(modelManager); hud = new HUD(this); Components.Add(hud); skyBox = new SkyBox(this); Components.Add(skyBox); currentGameState = GameState.StartUp; base.Initialize(); }
public void Draw(Camera camera, GraphicsDevice gd) { Matrix worldMatrix = Matrix.CreateRotationX(xRotation) * Matrix.CreateRotationY(yRotation) * Matrix.CreateRotationZ(zRotation) * Matrix.CreateTranslation(position); Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.PreferPerPixelLighting = true; be.Projection = camera.projection; be.View = camera.view; be.World = mesh.ParentBone.Transform * worldMatrix; } mesh.Draw(); } }