예제 #1
0
        /// <summary>
        /// Invoked after either control has created its graphics device.
        /// </summary>
        private void OnGraphicsControlLoadContent(object sender, GraphicsDeviceEventArgs e)
        {
            _basicEffect = new BasicEffect(e.GraphicsDevice)
            {
                View = Matrix.LookAtRH(new Vector3(0, 0, 3), new Vector3(0, 0, 0), Vector3.UnitY),
                World = Matrix.Identity,
                PreferPerPixelLighting = true
            };
            _basicEffect.EnableDefaultLighting();

            _geometricPrimitives = new[]
            {
                GeometricPrimitive.Cube.New(e.GraphicsDevice),
                GeometricPrimitive.Cylinder.New(e.GraphicsDevice),
                GeometricPrimitive.GeoSphere.New(e.GraphicsDevice),
                GeometricPrimitive.Teapot.New(e.GraphicsDevice),
                GeometricPrimitive.Torus.New(e.GraphicsDevice)
            };
            _primitiveIndex = 0;

            _texture = Texture2D.Load(e.GraphicsDevice, "Modules/SharpDXSceneViewer/Resources/tile_aqua.png");
            _basicEffect.Texture = _texture;
            _basicEffect.TextureEnabled = true;

            _yaw = 0.5f;
            _pitch = 0.3f;
        }
예제 #2
0
	    private void OnGraphicsControlUnloadContent(object sender, GraphicsDeviceEventArgs e)
	    {
			_texture.Dispose();
            foreach (var primitive in _geometricPrimitives)
		        primitive.Dispose();
		    _basicEffect.Dispose();
	    }
예제 #3
0
        protected virtual void RaiseUnloadContent(GraphicsDeviceEventArgs args)
        {
            var handler = UnloadContent;

            if (handler != null)
            {
                handler(this, args);
            }
        }
예제 #4
0
		protected virtual void RaiseUnloadContent(GraphicsDeviceEventArgs args)
		{
			var handler = UnloadContent;
			if (handler != null)
				handler(this, args);
		}