コード例 #1
0
ファイル: TerrainViewer.cs プロジェクト: remixod/netServer
		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize()
		{
			// reset mouse, so we don't suddenly pan off to the sides
			Form.Activated += (sender, args) => RecenterMouse();

			IsMouseVisible = true;
			_graphics.PreferredBackBufferWidth = 1024;
			_graphics.PreferredBackBufferHeight = 768;
			_graphics.IsFullScreen = false;

			var device = _graphics.GraphicsDevice;
			device.RasterizerState = solidRasterizerState =
				new RasterizerState()
				{
					CullMode = CullMode.None,
					FillMode = FillMode.Solid
				};

			frameRasterizerState = new RasterizerState()
				{
					CullMode = CullMode.None,
					FillMode = FillMode.WireFrame
				};

			device.DepthStencilState = defaultStencilState;

			_graphics.ApplyChanges();

			//_graphics.GraphicsDevice.RenderState.AlphaBlendEnable = true;
			//_graphics.GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.InverseSourceAlpha;
			//_graphics.GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.InverseSourceAlpha;

			//_graphics.GraphicsDevice.RenderState.SourceBlend = Blend.One;
			//_graphics.GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha; 

			InitializeEffect();


			Components.Add(new AxisRenderer(this));
			Components.Add(new EnvironmentRenderer(this));

			if (Tile.NavMesh != null)
			{
				Components.Add(new WireframeNavMeshRenderer(this));
				Components.Add(new SolidNavMeshRenderer(this));
			}
			Components.Add(LiquidRenderer = new LiquidRenderer(this));

			Components.Add(TriangleSelectionRenderer = new GenericRenderer(this));
			Components.Add(LineSelectionRenderer = new GenericRenderer(this));

			InitGUI();

			base.Initialize();
		}
コード例 #2
0
ファイル: TerrainViewer.cs プロジェクト: KroneckerX/WCell
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // reset mouse, so we don't suddenly pan off to the sides
            Form.GotFocus += (sender, args) => RecenterMouse();

            IsMouseVisible = true;
            _graphics.PreferredBackBufferWidth = 1024;
            _graphics.PreferredBackBufferHeight = 768;
            _graphics.IsFullScreen = false;

            _graphics.GraphicsDevice.RasterizerState = solidRasterizerState;
            _graphics.GraphicsDevice.DepthStencilState = defaultStencilState;
            _graphics.GraphicsDevice.BlendState = BlendState.Opaque;
            _graphics.ApplyChanges();

            effect = new BasicEffect(_graphics.GraphicsDevice);
            InitializeEffect();

            Components.Add(AxisRenderer = new AxisRenderer(this));
            Components.Add(TriangleSelectionRenderer = new GenericRenderer(this));
            Components.Add(LineSelectionRenderer = new GenericRenderer(this));

            // Add Active tile to display
            DisplayTile(InitialTile);

            // Add a whole bunch more tiles to display
            var tile = InitialTile;
            LoadAndDisplayNeighbors(tile);

            InitGUI();

            base.Initialize();
        }
コード例 #3
0
ファイル: TerrainViewer.cs プロジェクト: primax/WCell
		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize()
		{
            // reset mouse, so we don't suddenly pan off to the sides
			Form.Activated += (sender, args) => RecenterMouse();
            
			IsMouseVisible = true;
			_graphics.PreferredBackBufferWidth = 1024;
			_graphics.PreferredBackBufferHeight = 768;
			_graphics.IsFullScreen = false;

			_graphics.GraphicsDevice.RasterizerState = solidRasterizerState;
            _graphics.GraphicsDevice.DepthStencilState = defaultStencilState;
		    _graphics.GraphicsDevice.BlendState = BlendState.Opaque;
			_graphics.ApplyChanges();

			effect = new BasicEffect(_graphics.GraphicsDevice);
            InitializeEffect();


			Components.Add(AxisRenderer = new AxisRenderer(this));
            Components.Add(TriangleSelectionRenderer = new GenericRenderer(this));
			Components.Add(LineSelectionRenderer = new GenericRenderer(this));

		    var tileRenderer = new TileRenderer(this, ActiveTile);
            TileRenderers.Add(ActiveTile.TileId, tileRenderer);
            Components.Add(tileRenderer);

			InitGUI();

            base.Initialize();
		}