Esempio n. 1
0
        public TileRenderer(Game game, TerrainTile tile) : base(game)
        {
            environs = new EnvironmentRenderer(game, tile);
            normals = new WireframeNormalRenderer(game, environs);
            liquids = new LiquidRenderer(game, tile);
            solidNavMesh = new SolidNavMeshRenderer(game, tile);
            wiredNavMesh = new WireframeNavMeshRenderer(game, tile);

            Game.Components.Add(environs);
            Game.Components.Add(normals);
            Game.Components.Add(liquids);
            Game.Components.Add(solidNavMesh);
            Game.Components.Add(wiredNavMesh);
            
            Disposed += (sender, args) => Cleanup();
            EnabledChanged += (sender, args) => EnabledToggled();
        }
Esempio n. 2
0
        public TileRenderer(Game game, TerrainTile tile) : base(game)
        {
            environs     = new EnvironmentRenderer(game, tile);
            normals      = new WireframeNormalRenderer(game, environs);
            liquids      = new LiquidRenderer(game, tile);
            solidNavMesh = new SolidNavMeshRenderer(game, tile);
            wiredNavMesh = new WireframeNavMeshRenderer(game, tile);

            Game.Components.Add(environs);
            Game.Components.Add(normals);
            Game.Components.Add(liquids);
            Game.Components.Add(solidNavMesh);
            Game.Components.Add(wiredNavMesh);

            Disposed       += (sender, args) => Cleanup();
            EnabledChanged += (sender, args) => EnabledToggled();
        }
Esempio n. 3
0
		/// <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();
		}