Unstable 1.8.4.0
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -24,22 +23,47 @@ namespace Barotrauma
|
||||
Matrix.CreateTranslation(new Vector3(ConvertUnits.ToDisplayUnits(Body.Position), 0.0f));
|
||||
}
|
||||
|
||||
public void SetWallVertices(VertexPositionTexture[] wallVertices, VertexPositionTexture[] wallEdgeVertices, Texture2D wallTexture, Texture2D edgeTexture, Color color)
|
||||
public void SetWallVertices(
|
||||
VertexPositionColorTexture[] wallVertices, VertexPositionColorTexture[] wallEdgeVertices,
|
||||
Texture2D wallTexture, Texture2D edgeTexture)
|
||||
{
|
||||
if (VertexBuffer != null && !VertexBuffer.IsDisposed) { VertexBuffer.Dispose(); }
|
||||
VertexBuffer = new LevelWallVertexBuffer(wallVertices, wallEdgeVertices, wallTexture, edgeTexture, color);
|
||||
VertexBuffer = new LevelWallVertexBuffer(wallVertices, wallEdgeVertices, wallInnerVertices: null, wallTexture, edgeTexture);
|
||||
}
|
||||
|
||||
public void GenerateVertices()
|
||||
{
|
||||
float zCoord = this is DestructibleLevelWall ? Rand.Range(0.9f, 1.0f) : 0.9f;
|
||||
List<VertexPositionTexture> wallVertices = CaveGenerator.GenerateWallVertices(triangles, level.GenerationParams, zCoord);
|
||||
var nonTexturedWallVerts =
|
||||
CaveGenerator.GenerateWallVertices(triangles, color, zCoord: 0.9f).ToArray();
|
||||
var wallVerts = CaveGenerator.ConvertToTextured(nonTexturedWallVerts, level.GenerationParams.WallTextureSize);
|
||||
SetWallVertices(
|
||||
wallVertices.ToArray(),
|
||||
CaveGenerator.GenerateWallEdgeVertices(Cells, level, zCoord).ToArray(),
|
||||
wallVertices: wallVerts,
|
||||
wallEdgeVertices: CaveGenerator.GenerateWallEdgeVertices(Cells,
|
||||
level.GenerationParams.WallEdgeExpandOutwardsAmount, level.GenerationParams.WallEdgeExpandInwardsAmount,
|
||||
outerColor: color, innerColor: color,
|
||||
level, zCoord)
|
||||
.ToArray(),
|
||||
level.GenerationParams.WallSprite.Texture,
|
||||
level.GenerationParams.WallEdgeSprite.Texture,
|
||||
color);
|
||||
level.GenerationParams.WallEdgeSprite.Texture);
|
||||
}
|
||||
|
||||
public bool IsVisible(Rectangle worldView)
|
||||
{
|
||||
RectangleF worldViewInSimUnits = new RectangleF(
|
||||
ConvertUnits.ToSimUnits(worldView.Location.ToVector2()),
|
||||
ConvertUnits.ToSimUnits(worldView.Size.ToVector2()));
|
||||
|
||||
foreach (var fixture in Body.FixtureList)
|
||||
{
|
||||
fixture.GetAABB(out var aabb, 0);
|
||||
Vector2 lowerBound = aabb.LowerBound + Body.Position;
|
||||
if (lowerBound.X > worldViewInSimUnits.Right || lowerBound.Y > worldViewInSimUnits.Y) { continue; }
|
||||
Vector2 upperBound = aabb.UpperBound + Body.Position;
|
||||
if (upperBound.X < worldViewInSimUnits.X || upperBound.Y < worldViewInSimUnits.Y - worldViewInSimUnits.Height) { continue; }
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user