Exemple #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;
        }
Exemple #2
0
	    private void OnGraphicsControlUnloadContent(object sender, GraphicsDeviceEventArgs e)
	    {
			_texture.Dispose();
            foreach (var primitive in _geometricPrimitives)
		        primitive.Dispose();
		    _basicEffect.Dispose();
	    }
Exemple #3
0
        protected virtual void RaiseUnloadContent(GraphicsDeviceEventArgs args)
        {
            var handler = UnloadContent;

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