Fixed LOS effect on Windows, fixed SharpDX reference, rebuilt damageshader_opengl

This commit is contained in:
Juan Pablo Arce
2017-12-31 17:45:05 -03:00
parent 7d2b701784
commit 904052390c
15 changed files with 115 additions and 70 deletions
@@ -43,12 +43,7 @@ namespace Barotrauma
waterEffect.Parameters["xWaveWidth"].SetValue(0.05f);
waterEffect.Parameters["xWaveHeight"].SetValue(0.05f);
#if WINDOWS
//waterEffect.Parameters["xTexture"].SetValue(waterTexture);
#endif
#if LINUX
waterEffect.Parameters["xWaterBumpMap"].SetValue(waterTexture);
#endif
if (basicEffect == null)
{
@@ -68,13 +63,13 @@ namespace Barotrauma
waterEffect.Parameters["xBlurDistance"].SetValue(blurAmount);
//waterEffect.CurrentTechnique.Passes[0].Apply();
#if WINDOWS
//#if WINDOWS
waterEffect.Parameters["xTexture"].SetValue(texture);
spriteBatch.Draw(waterTexture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
#elif LINUX
spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
#endif
//#elif LINUX
// spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
//#endif
spriteBatch.End();
}
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using System.Collections.Generic;
using System.Linq;
@@ -36,6 +37,11 @@ namespace Barotrauma.Lights
}
BasicEffect lightEffect;
public Effect losEffect
{
get; private set;
}
private static Texture2D alphaClearTexture;
@@ -55,7 +61,7 @@ namespace Barotrauma.Lights
private float ambientLightUpdateTimer;
public LightManager(GraphicsDevice graphics)
public LightManager(GraphicsDevice graphics, ContentManager content)
{
lights = new List<LightSource>();
@@ -71,12 +77,18 @@ namespace Barotrauma.Lights
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
RenderTargetUsage.DiscardContents);
losTexture = new RenderTarget2D(graphics, (int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false, SurfaceFormat.Alpha8, DepthFormat.None);
losTexture = new RenderTarget2D(graphics, (int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false, SurfaceFormat.Color, DepthFormat.None);
losSource = new LightSource(Vector2.Zero, GameMain.GraphicsWidth, Color.White, null, false);
losSource.texture = new Texture2D(graphics, 1, 1);
losSource.texture.SetData(new Color[] { Color.White });// fill the texture with white
#if WINDOWS
losEffect = content.Load<Effect>("losshader");
#else
losEffect = content.Load<Effect>("losshader_opengl");
#endif
if (lightEffect == null)
{
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);