v1.0.21.0 (summer patch hotfix)
This commit is contained in:
@@ -561,7 +561,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
if (IsSegmentFacing(losVertices[0].Pos, losVertices[1].Pos, lightSourcePos))
|
||||
{
|
||||
Array.Reverse(ShadowVertices);
|
||||
Array.Reverse(ShadowVertices, 0, ShadowVertexCount);
|
||||
}
|
||||
|
||||
CalculateLosPenumbraVertices(lightSourcePos);
|
||||
|
||||
@@ -482,7 +482,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
foreach (MapEntity e in (Submarine.VisibleEntities ?? MapEntity.mapEntityList))
|
||||
{
|
||||
if (e is Item item && item.GetComponent<Wire>() is Wire wire)
|
||||
if (e is Item item && !item.HiddenInGame && item.GetComponent<Wire>() is Wire wire)
|
||||
{
|
||||
wire.DebugDraw(spriteBatch, alpha: 0.4f);
|
||||
}
|
||||
@@ -719,6 +719,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
foreach (var ch in convexHulls)
|
||||
{
|
||||
if (!ch.Enabled) { continue; }
|
||||
Vector2 currentViewPos = pos;
|
||||
Vector2 defaultViewPos = ViewTarget.DrawPosition;
|
||||
if (ch.ParentEntity?.Submarine != null)
|
||||
@@ -742,10 +743,13 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
if (!convexHull.Enabled || !convexHull.Intersects(camView)) { continue; }
|
||||
|
||||
Vector2 relativeLightPos = pos;
|
||||
if (convexHull.ParentEntity?.Submarine != null) { relativeLightPos -= convexHull.ParentEntity.Submarine.Position; }
|
||||
Vector2 relativeViewPos = pos;
|
||||
if (convexHull.ParentEntity?.Submarine != null)
|
||||
{
|
||||
relativeViewPos -= convexHull.ParentEntity.Submarine.DrawPosition;
|
||||
}
|
||||
|
||||
convexHull.CalculateLosVertices(relativeLightPos);
|
||||
convexHull.CalculateLosVertices(relativeViewPos);
|
||||
|
||||
for (int i = 0; i < convexHull.ShadowVertexCount; i++)
|
||||
{
|
||||
|
||||
@@ -206,6 +206,8 @@ namespace Barotrauma.Lights
|
||||
|
||||
private readonly List<ConvexHullList> convexHullsInRange;
|
||||
|
||||
private readonly HashSet<ConvexHull> visibleConvexHulls = new HashSet<ConvexHull>();
|
||||
|
||||
public Texture2D texture;
|
||||
|
||||
public SpriteEffects LightSpriteEffect;
|
||||
@@ -717,6 +719,8 @@ namespace Barotrauma.Lights
|
||||
|
||||
public void RayCastTask(Vector2 drawPos, float rotation)
|
||||
{
|
||||
visibleConvexHulls.Clear();
|
||||
|
||||
Vector2 drawOffset = Vector2.Zero;
|
||||
float boundsExtended = TextureRange;
|
||||
if (OverrideLightTexture != null)
|
||||
@@ -904,17 +908,12 @@ namespace Barotrauma.Lights
|
||||
bool isPoint1 = MathUtils.LineToPointDistanceSquared(seg1.Start.WorldPos, seg1.End.WorldPos, p.WorldPos) < 25.0f;
|
||||
bool isPoint2 = MathUtils.LineToPointDistanceSquared(seg2.Start.WorldPos, seg2.End.WorldPos, p.WorldPos) < 25.0f;
|
||||
|
||||
bool markAsVisible = false;
|
||||
if (isPoint1 && isPoint2)
|
||||
{
|
||||
//hit at the current segmentpoint -> place the segmentpoint into the list
|
||||
verts.Add(p.WorldPos);
|
||||
|
||||
foreach (ConvexHullList hullList in convexHullsInRange)
|
||||
{
|
||||
hullList.IsHidden.Remove(p.ConvexHull);
|
||||
hullList.IsHidden.Remove(seg1.ConvexHull);
|
||||
hullList.IsHidden.Remove(seg2.ConvexHull);
|
||||
}
|
||||
markAsVisible = true;
|
||||
}
|
||||
else if (intersection1.index != intersection2.index)
|
||||
{
|
||||
@@ -922,13 +921,13 @@ namespace Barotrauma.Lights
|
||||
//we definitely want to generate new geometry here
|
||||
verts.Add(isPoint1 ? p.WorldPos : intersection1.pos);
|
||||
verts.Add(isPoint2 ? p.WorldPos : intersection2.pos);
|
||||
|
||||
foreach (ConvexHullList hullList in convexHullsInRange)
|
||||
{
|
||||
hullList.IsHidden.Remove(p.ConvexHull);
|
||||
hullList.IsHidden.Remove(seg1.ConvexHull);
|
||||
hullList.IsHidden.Remove(seg2.ConvexHull);
|
||||
}
|
||||
markAsVisible = true;
|
||||
}
|
||||
if (markAsVisible)
|
||||
{
|
||||
visibleConvexHulls.Add(p.ConvexHull);
|
||||
visibleConvexHulls.Add(seg1.ConvexHull);
|
||||
visibleConvexHulls.Add(seg2.ConvexHull);
|
||||
}
|
||||
//if neither of the conditions above are met, we just assume
|
||||
//that the raycasts both resulted on the same segment
|
||||
@@ -1396,6 +1395,14 @@ namespace Barotrauma.Lights
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var visibleConvexHull in visibleConvexHulls)
|
||||
{
|
||||
foreach (var convexHullList in convexHullsInRange)
|
||||
{
|
||||
convexHullList.IsHidden.Remove(visibleConvexHull);
|
||||
}
|
||||
}
|
||||
|
||||
CalculateLightVertices(verts);
|
||||
|
||||
LastRecalculationTime = (float)Timing.TotalTime;
|
||||
|
||||
Reference in New Issue
Block a user