Lighting bugfixes, setting camera position to character on shift start
This commit is contained in:
@@ -148,6 +148,8 @@ namespace Barotrauma.Lights
|
||||
cachedShadows.Clear();
|
||||
|
||||
vertices = points;
|
||||
|
||||
CalculateDimensions();
|
||||
}
|
||||
|
||||
public bool Intersects(Rectangle rect)
|
||||
@@ -307,6 +309,7 @@ namespace Barotrauma.Lights
|
||||
else
|
||||
{
|
||||
cachedShadow = new CachedShadow(shadowVertices, penumbraVertices, light.Position, shadowVertexCount, 0);
|
||||
cachedShadows.Remove(light);
|
||||
cachedShadows.Add(light, cachedShadow);
|
||||
}
|
||||
}
|
||||
@@ -350,7 +353,7 @@ namespace Barotrauma.Lights
|
||||
else
|
||||
{
|
||||
shadowEffect.CurrentTechnique.Passes[0].Apply();
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, shadowVertexCount);
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, shadowVertexCount*2 - 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace Barotrauma.Lights
|
||||
|
||||
public Entity Submarine;
|
||||
|
||||
//what was the range of the light when HullsInRange were last updated
|
||||
private float prevHullUpdateRange;
|
||||
|
||||
private Vector2 position;
|
||||
public Vector2 Position
|
||||
{
|
||||
@@ -64,11 +67,11 @@ namespace Barotrauma.Lights
|
||||
set
|
||||
{
|
||||
|
||||
float prevRange = range;
|
||||
range = MathHelper.Clamp(value, 0.0f, 2048.0f);
|
||||
if (Math.Abs(prevRange - range)<5.0f) return;
|
||||
if (Math.Abs(prevHullUpdateRange - range)>5.0f) return;
|
||||
|
||||
UpdateHullsInRange();
|
||||
prevHullUpdateRange = range;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,10 @@ namespace Barotrauma
|
||||
|
||||
public static Body PickBody(Vector2 rayStart, Vector2 rayEnd, List<Body> ignoredBodies = null, Category? collisionCategory = null)
|
||||
{
|
||||
if (Vector2.DistanceSquared(rayStart, rayEnd) < 0.0f) return null;
|
||||
if (Vector2.DistanceSquared(rayStart, rayEnd) < 0.00001f)
|
||||
{
|
||||
rayEnd += Vector2.UnitX * 0.001f;
|
||||
}
|
||||
|
||||
float closestFraction = 1.0f;
|
||||
Body closestBody = null;
|
||||
|
||||
@@ -55,12 +55,12 @@ namespace Barotrauma
|
||||
|
||||
GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration);
|
||||
|
||||
cam.Translate((cameraPos - cam.Position) * CoroutineManager.DeltaTime);
|
||||
cam.Translate((cameraPos - cam.Position) * CoroutineManager.DeltaTime*10.0f);
|
||||
|
||||
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.DeltaTime * 0.1f);
|
||||
sub.ApplyForce((Vector2.Normalize(diff) * targetSpeed - sub.Velocity) * 500.0f);
|
||||
|
||||
timer -= CoroutineManager.DeltaTime;
|
||||
timer += CoroutineManager.DeltaTime;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user