コード例 #1
0
ファイル: SceneView.xaml.cs プロジェクト: 4ux-nbIx/gemini
        /// <summary>
        /// Invoked when our second control is ready to render.
        /// </summary>
        private void OnGraphicsControlDraw(object sender, DrawEventArgs e)
        {
            e.GraphicsDevice.Clear(Color.CornflowerBlue);

            // Create the world-view-projection matrices for the cube and camera
            var position = ((SceneViewModel) DataContext).Position;
            Matrix world = Matrix.CreateFromYawPitchRoll(_yaw, _pitch, 0f) * Matrix.CreateTranslation(position);
            Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 2.5f), Vector3.Zero, Vector3.Up);
            Matrix projection = Matrix.CreatePerspectiveFieldOfView(1, e.GraphicsDevice.Viewport.AspectRatio, 1, 10);

            // Draw a cube
            _cube.Draw(world, view, projection, Color.LightGreen);
        }
コード例 #2
0
ファイル: DrawingSurface.cs プロジェクト: 4ux-nbIx/gemini
 protected virtual void RaiseDraw(DrawEventArgs args)
 {
     var handler = Draw;
     if (handler != null)
         handler(this, args);
 }