コード例 #1
0
ファイル: AWViewport.cs プロジェクト: vvnurmi/assaultwing
 /// <summary>
 /// Called when graphics resources need to be unloaded.
 /// </summary>
 public virtual void UnloadContent()
 {
     foreach (var component in _overlayComponents) component.UnloadContent();
     if (_postprocessor != null)
     {
         _postprocessor.Dispose();
         _postprocessor = null;
     }
     if (_effect != null)
     {
         _effect.Dispose();
         _effect = null;
     }
 }
コード例 #2
0
ファイル: AWViewport.cs プロジェクト: vvnurmi/assaultwing
 /// <summary>
 /// Called when graphics resources need to be loaded.
 /// </summary>
 public void LoadContent()
 {
     Action<ICollection<Effect>> effectContainerUpdater = container =>
     {
         container.Clear();
         foreach (var name in _getPostprocessEffectNames())
             container.Add(AssaultWingCore.Instance.Content.Load<Effect>(name));
     };
     _postprocessor = new TexturePostprocessor(AssaultWingCore.Instance, RenderGameWorld, effectContainerUpdater);
     _effect = new BasicEffect(AssaultWingCore.Instance.GraphicsDeviceService.GraphicsDevice);
     _effect.World = Matrix.Identity;
     _effect.Projection = Matrix.Identity;
     _effect.View = Matrix.Identity;
     _effect.TextureEnabled = true;
     _effect.LightingEnabled = false;
     _effect.FogEnabled = false;
     _effect.VertexColorEnabled = false;
     _vertexData = new[]
     {
         new VertexPositionTexture(new Vector3(-1, -1, 1), Vector2.UnitY),
         new VertexPositionTexture(new Vector3(-1, 1, 1), Vector2.Zero),
         new VertexPositionTexture(new Vector3(1, -1, 1), Vector2.One),
         new VertexPositionTexture(new Vector3(1, 1, 1), Vector2.UnitX)
     };
     foreach (var component in _overlayComponents) component.LoadContent();
 }