(61d00a474) v0.9.7.1
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using MonoGame.Utilities;
|
||||
|
||||
|
||||
@@ -353,6 +353,15 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
_bufferBindingInfos = new BufferBindingInfo[_maxVertexBufferSlots];
|
||||
for (int i = 0; i < _bufferBindingInfos.Length; i++)
|
||||
_bufferBindingInfos[i] = new BufferBindingInfo(null, IntPtr.Zero, 0, -1);
|
||||
|
||||
Clear(Color.Black);
|
||||
PlatformPresent();
|
||||
}
|
||||
|
||||
partial void PlatformReset()
|
||||
{
|
||||
Clear(Color.Black);
|
||||
PlatformPresent();
|
||||
}
|
||||
|
||||
private DepthStencilState clearDepthStencilState = new DepthStencilState { StencilEnable = true };
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
private bool _blendStateDirty;
|
||||
|
||||
private BlendState _blendStateAdditive;
|
||||
private BlendState _blendStateAlphaBlend;
|
||||
//private BlendState _blendStateAlphaBlend;
|
||||
private BlendState _blendStateNonPremultiplied;
|
||||
private BlendState _blendStateOpaque;
|
||||
|
||||
@@ -74,7 +74,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
// Despite XNA4 using Purple here, we use black (in Release) to avoid
|
||||
// performance warnings on Intel/Mesa
|
||||
#if DEBUG
|
||||
private static readonly Color DiscardColor = new Color(68, 34, 136, 255);
|
||||
// Replicating XNA behavior stopped mattering ages ago
|
||||
private static readonly Color DiscardColor = new Color(0, 0, 0, 255); //new Color(68, 34, 136, 255);
|
||||
#else
|
||||
private static readonly Color DiscardColor = new Color(0, 0, 0, 255);
|
||||
#endif
|
||||
@@ -252,7 +253,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
SamplerStates = new SamplerStateCollection(this, MaxTextureSlots, false);
|
||||
|
||||
_blendStateAdditive = BlendState.Additive.Clone();
|
||||
_blendStateAlphaBlend = BlendState.AlphaBlend.Clone();
|
||||
//_blendStateAlphaBlend = BlendState.AlphaBlend.Clone();
|
||||
_blendStateNonPremultiplied = BlendState.NonPremultiplied.Clone();
|
||||
_blendStateOpaque = BlendState.Opaque.Clone();
|
||||
|
||||
@@ -414,8 +415,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
var newBlendState = _blendState;
|
||||
if (ReferenceEquals(_blendState, BlendState.Additive))
|
||||
newBlendState = _blendStateAdditive;
|
||||
else if (ReferenceEquals(_blendState, BlendState.AlphaBlend))
|
||||
newBlendState = _blendStateAlphaBlend;
|
||||
/*else if (ReferenceEquals(_blendState, BlendState.AlphaBlend))
|
||||
newBlendState = _blendStateAlphaBlend;*/
|
||||
else if (ReferenceEquals(_blendState, BlendState.NonPremultiplied))
|
||||
newBlendState = _blendStateNonPremultiplied;
|
||||
else if (ReferenceEquals(_blendState, BlendState.Opaque))
|
||||
@@ -549,7 +550,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
_blendState = null;
|
||||
_actualBlendState = null;
|
||||
_blendStateAdditive.Dispose();
|
||||
_blendStateAlphaBlend.Dispose();
|
||||
//_blendStateAlphaBlend.Dispose();
|
||||
_blendStateNonPremultiplied.Dispose();
|
||||
_blendStateOpaque.Dispose();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
/// Begins a new sprite and text batch with the specified render state.
|
||||
/// </summary>
|
||||
/// <param name="sortMode">The drawing order for sprite and text drawing. <see cref="SpriteSortMode.Deferred"/> by default.</param>
|
||||
/// <param name="blendState">State of the blending. Uses <see cref="BlendState.AlphaBlend"/> if null.</param>
|
||||
/// <param name="blendState">State of the blending. Uses <see cref="BlendState.NonPremultiplied"/> if null.</param>
|
||||
/// <param name="samplerState">State of the sampler. Uses <see cref="SamplerState.LinearClamp"/> if null.</param>
|
||||
/// <param name="depthStencilState">State of the depth-stencil buffer. Uses <see cref="DepthStencilState.None"/> if null.</param>
|
||||
/// <param name="rasterizerState">State of the rasterization. Uses <see cref="RasterizerState.CullCounterClockwise"/> if null.</param>
|
||||
@@ -90,7 +90,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
|
||||
// defaults
|
||||
_sortMode = sortMode;
|
||||
_blendState = blendState ?? BlendState.AlphaBlend;
|
||||
_blendState = blendState ?? BlendState.NonPremultiplied;
|
||||
_samplerState = samplerState ?? SamplerState.LinearClamp;
|
||||
_depthStencilState = depthStencilState ?? DepthStencilState.None;
|
||||
_rasterizerState = rasterizerState ?? RasterizerState.CullCounterClockwise;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
/// <summary>
|
||||
/// No options specified.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Render the sprite reversed along the X axis.
|
||||
/// </summary>
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
|
||||
|
||||
public static readonly BlendState Additive;
|
||||
public static readonly BlendState AlphaBlend;
|
||||
//public static readonly BlendState AlphaBlend;
|
||||
public static readonly BlendState NonPremultiplied;
|
||||
public static readonly BlendState Opaque;
|
||||
|
||||
@@ -204,14 +204,14 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
_independentBlendEnable = false;
|
||||
}
|
||||
|
||||
private BlendState(string name, Blend sourceBlend, Blend destinationBlend)
|
||||
private BlendState(string name, Blend sourceBlend, Blend destinationBlend, Blend? srcAlphaBlend = null, Blend? destAlphaBlend = null)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ColorSourceBlend = sourceBlend;
|
||||
AlphaSourceBlend = sourceBlend;
|
||||
AlphaSourceBlend = srcAlphaBlend ?? sourceBlend;
|
||||
ColorDestinationBlend = destinationBlend;
|
||||
AlphaDestinationBlend = destinationBlend;
|
||||
AlphaDestinationBlend = destAlphaBlend ?? destinationBlend;
|
||||
_defaultStateObject = true;
|
||||
}
|
||||
|
||||
@@ -233,8 +233,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
static BlendState()
|
||||
{
|
||||
Additive = new BlendState("BlendState.Additive", Blend.SourceAlpha, Blend.One);
|
||||
AlphaBlend = new BlendState("BlendState.AlphaBlend", Blend.One, Blend.InverseSourceAlpha);
|
||||
NonPremultiplied = new BlendState("BlendState.NonPremultiplied", Blend.SourceAlpha, Blend.InverseSourceAlpha);
|
||||
//AlphaBlend = new BlendState("BlendState.AlphaBlend", Blend.One, Blend.InverseSourceAlpha);
|
||||
NonPremultiplied = new BlendState("BlendState.NonPremultiplied", Blend.SourceAlpha, Blend.InverseSourceAlpha, Blend.One, Blend.InverseSourceAlpha);
|
||||
Opaque = new BlendState("BlendState.Opaque", Blend.One, Blend.Zero);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user