示例#1
0
        /// <summary>
        /// Invoked after either control has created its graphics device.
        /// </summary>
        protected override void RaiseLoadContent(GraphicsDeviceEventArgs args)
        {
            // Create our 3D cube object
            Primitive.Initialize(args.GraphicsDevice);

            base.RaiseLoadContent(args);
        }
示例#2
0
        protected virtual void RaiseRenderXna(GraphicsDeviceEventArgs args)
        {
            var handler = RenderXna;

            if (handler != null)
            {
                handler(this, args);
            }
        }
示例#3
0
        protected virtual void RaiseLoadContent(GraphicsDeviceEventArgs args)
        {
            var handler = LoadContent;

            if (handler != null)
            {
                handler(this, args);
            }
        }
示例#4
0
        /// <summary>
        /// Invoked when our second control is ready to render.
        /// </summary>
        protected override void RaiseRenderXna(GraphicsDeviceEventArgs args)
        {
            args.GraphicsDevice.Clear(Color.LightGreen);

            if (Primitive != null)
            {
                // Create the world-view-projection matrices for the cube and camera
                Matrix world = Matrix.CreateFromYawPitchRoll(_yaw, _pitch, 0f);
                Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 2.5f), Vector3.Zero, Vector3.Up);
                Matrix projection = Matrix.CreatePerspectiveFieldOfView(1, args.GraphicsDevice.Viewport.AspectRatio, 1, 10);

                // Draw a cube
                Primitive.Draw(world, view, projection, Color);
            }

            base.RaiseRenderXna(args);
        }
示例#5
0
 protected virtual void RaiseRenderXna(GraphicsDeviceEventArgs args)
 {
     var handler = RenderXna;
     if (handler != null)
         handler(this, args);
 }
示例#6
0
 protected virtual void RaiseLoadContent(GraphicsDeviceEventArgs args)
 {
     var handler = LoadContent;
     if (handler != null)
         handler(this, args);
 }
示例#7
0
 /// <summary>
 /// Invoked after either control has created its graphics device.
 /// </summary>
 private void OnGraphicsControlLoadContent(object sender, GraphicsDeviceEventArgs e)
 {
     // Create our 3D cube object
     _cube.Initialize(e.GraphicsDevice);
 }