public void draw(FirstPersonCamera cam) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = transforms[mesh.ParentBone.Index] * getWorld(); effect.View = cam.getView(); effect.Projection = cam.projection; } mesh.Draw(); } }
private void drawMatrix(FirstPersonCamera cam, Matrix world) { effect.EnableDefaultLighting(); effect.LightingEnabled = true; effect.World = world; effect.View = cam.getView(); effect.Projection = cam.projection; effect.Texture = texture; effect.TextureEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); effect.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; effect.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2); } }