(3ffde5103) Disabled alpha premultiplication on a bunch of non-transparent textures (-> minor loading time reduction)

This commit is contained in:
Joonas Rikkonen
2019-04-03 16:24:48 +03:00
parent fd0e394827
commit 4685121eee
6 changed files with 36 additions and 9 deletions

View File

@@ -701,6 +701,25 @@ namespace Barotrauma
}
};
//spacing
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
TextManager.Get("Cancel"), style: "GUIButtonLarge")
{
IgnoreLayoutGroups = true,
OnClicked = (x, y) =>
{
if (UnsavedSettings)
{
LoadPlayerConfig();
}
if (Screen.Selected == GameMain.MainMenuScreen) GameMain.MainMenuScreen.ReturnToMainMenu(null, null);
GUI.SettingsMenuOpen = false;
return true;
}
};
applyButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight),
TextManager.Get("ApplySettingsButton"), style: "GUIButtonLarge")
{

View File

@@ -78,9 +78,8 @@ namespace Barotrauma.Lights
AmbientLight = new Color(20, 20, 20, 255);
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
highlightRaster = Sprite.LoadTexture("Content/UI/HighlightRaster.png");
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png", preMultiplyAlpha: false);
highlightRaster = Sprite.LoadTexture("Content/UI/HighlightRaster.png", preMultiplyAlpha: false);
CreateRenderTargets(graphics);
GameMain.Instance.OnResolutionChanged += () =>
@@ -292,6 +291,11 @@ namespace Barotrauma.Lights
spriteBatch.Draw(HighlightMap, Vector2.Zero, Color.White);
spriteBatch.End();
}
GameMain.ParticleManager.Draw(spriteBatch, true, null, Particles.ParticleBlendState.Additive);
spriteBatch.End();
//draw a black rectangle on hulls to hide background lights behind subs
//---------------------------------------------------------------------------------------------------
//draw characters to obstruct the highlighted items/characters and light sprites
//---------------------------------------------------------------------------------------------------

View File

@@ -91,7 +91,7 @@ namespace Barotrauma.Lights
}
break;
case "lighttexture":
OverrideLightTexture = new Sprite(subElement);
OverrideLightTexture = new Sprite(subElement, preMultiplyAlpha: false);
break;
}
}
@@ -211,7 +211,7 @@ namespace Barotrauma.Lights
{
if (lightTexture == null)
{
lightTexture = TextureLoader.FromFile("Content/Lights/pointlight_bright.png");
lightTexture = TextureLoader.FromFile("Content/Lights/pointlight_bright.png", preMultiplyAlpha: false);
}
return lightTexture;

View File

@@ -47,12 +47,12 @@ namespace Barotrauma
postProcessEffect = content.Load<Effect>("Effects/postprocess");
#endif
damageStencil = TextureLoader.FromFile("Content/Map/walldamage.png");
damageStencil = TextureLoader.FromFile("Content/Map/walldamage.png", preMultiplyAlpha: false);
damageEffect.Parameters["xStencil"].SetValue(damageStencil);
damageEffect.Parameters["aMultiplier"].SetValue(50.0f);
damageEffect.Parameters["cMultiplier"].SetValue(200.0f);
distortTexture = TextureLoader.FromFile("Content/Effects/distortnormals.png");
distortTexture = TextureLoader.FromFile("Content/Effects/distortnormals.png", preMultiplyAlpha: false);
postProcessEffect.Parameters["xDistortTexture"].SetValue(distortTexture);
}

View File

@@ -26,6 +26,10 @@ namespace Barotrauma.Items.Components
private float blinkTimer;
private bool itemLoaded;
private float blinkTimer;
public PhysicsBody ParentBody;
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]

View File

@@ -99,7 +99,7 @@ namespace Barotrauma
partial void LoadTexture(ref Vector4 sourceVector, ref bool shouldReturn, bool premultiplyAlpha = true);
partial void CalculateSourceRect();
public Sprite(XElement element, string path = "", string file = "")
public Sprite(XElement element, string path = "", string file = "", bool? preMultiplyAlpha = null)
{
SourceElement = element;
if (file == "")
@@ -124,7 +124,7 @@ namespace Barotrauma
Name = SourceElement.GetAttributeString("name", null);
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
bool shouldReturn = false;
LoadTexture(ref sourceVector, ref shouldReturn, SourceElement.GetAttributeBool("premultiplyalpha", true));
LoadTexture(ref sourceVector, ref shouldReturn, preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true));
if (shouldReturn) return;
sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
size = SourceElement.GetAttributeVector2("size", Vector2.One);