public void RenderFloor(GraphicsDevice gd, Camera camera) { BuildFloor(); effect.TextureEnabled = true; buffer = new VertexBuffer(gd, VertexPositionNormalTexture.SizeInBytes * verticies.Length, BufferUsage.WriteOnly); buffer.SetData(verticies); gd.Vertices[0].SetSource(buffer, 0, VertexPositionNormalTexture.SizeInBytes); gd.VertexDeclaration = new VertexDeclaration( gd, VertexPositionNormalTexture.VertexElements); gd.DrawPrimitives(PrimitiveType.TriangleList, 0, triangles); }
public void Draw(GraphicsDevice gd, Camera camera) { effect = new BasicEffect(gd, null); effect.Begin(); effect.World = Matrix.Identity; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); effect.Texture = texture; RenderFloor(gd, camera); pass.End(); } effect.End(); }
public void Draw(Camera camera) { 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.Projection = camera.projection; effect.View = camera.view; effect.World = Matrix.CreateScale(scale) * world * mesh.ParentBone.Transform; effect.Alpha = alpha; effect.TextureEnabled = true; effect.Texture = texture; effect.DiffuseColor = color; } mesh.Draw(); } }
public void Draw(Camera camera) { foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.Begin(); effect.EnableDefaultLighting(); effect.Projection = camera.projection; effect.View = camera.view; effect.World = Matrix.CreateScale(10.0f) * world * mesh.ParentBone.Transform; effect.TextureEnabled = true; effect.Alpha = alpha; effect.Texture = texture; effect.DiffuseColor = color; effect.End(); } mesh.Draw(); } }
/// <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() { // TODO: Add your initialization logic here this.IsMouseVisible = true; // Initialize camera camera = new Camera(this, new Vector3(20.0f, 50.0f, 40.0f), Vector3.Zero, Vector3.Up); Components.Add(camera); //Set the color to white color = new Vector3(1.0f, 1.0f, 1.0f); //initialize dialog box dialogBox = new DialogBox(this); base.Initialize(); }