示例#1
0
		protected override void Initialize ()
		{
			floorVerts = new VertexPositionNormalTexture[6];

			floorVerts [0].Position = new Vector3 (-20, -20, 0);
			floorVerts [1].Position = new Vector3 (-20, 20, 0);
			floorVerts [2].Position = new Vector3 (20, -20, 0);

			floorVerts [3].Position = floorVerts [1].Position;
			floorVerts [4].Position = new Vector3 (20, 20, 0);
			floorVerts [5].Position = floorVerts [2].Position;

			int repetitions = 20;

			floorVerts [0].TextureCoordinate = new Vector2 (0, 0);
			floorVerts [1].TextureCoordinate = new Vector2 (0, repetitions);
			floorVerts [2].TextureCoordinate = new Vector2 (repetitions, 0);

			floorVerts [3].TextureCoordinate = floorVerts [1].TextureCoordinate;
			floorVerts [4].TextureCoordinate = new Vector2 (repetitions, repetitions);
			floorVerts [5].TextureCoordinate = floorVerts [2].TextureCoordinate;

			effect = new BasicEffect (graphics.GraphicsDevice);

			robot = new Robot ();
			robot.Initialize (Content);

			// New camera code
			camera = new Camera (graphics.GraphicsDevice);

			base.Initialize ();
		}
示例#2
0
		public void Draw (Camera camera)
		{
			foreach (var mesh in model.Meshes)
			{
				foreach (BasicEffect effect in mesh.Effects)
				{
					effect.EnableDefaultLighting ();
					effect.PreferPerPixelLighting = true;

					effect.World = GetWorldMatrix ();
					effect.View = camera.ViewMatrix;
					effect.Projection = camera.ProjectionMatrix;
				}

				mesh.Draw ();
			}
		}