Replace Matrix3 with System.Numerics.Matrix3x2 (#27443)
Replace Matrix3 with Matrix3x2
This commit is contained in:
@@ -67,7 +67,7 @@ public sealed partial class DungeonSystem
|
||||
bool clearExisting = false,
|
||||
bool rotation = false)
|
||||
{
|
||||
var originTransform = Matrix3.CreateTranslation(origin);
|
||||
var originTransform = Matrix3Helpers.CreateTranslation(origin.X, origin.Y);
|
||||
var roomRotation = Angle.Zero;
|
||||
|
||||
if (rotation)
|
||||
@@ -75,8 +75,8 @@ public sealed partial class DungeonSystem
|
||||
roomRotation = GetRoomRotation(room, random);
|
||||
}
|
||||
|
||||
var roomTransform = Matrix3.CreateTransform((Vector2) room.Size / 2f, roomRotation);
|
||||
Matrix3.Multiply(roomTransform, originTransform, out var finalTransform);
|
||||
var roomTransform = Matrix3Helpers.CreateTransform((Vector2) room.Size / 2f, roomRotation);
|
||||
var finalTransform = Matrix3x2.Multiply(roomTransform, originTransform);
|
||||
|
||||
SpawnRoom(gridUid, grid, finalTransform, room, clearExisting);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public sealed partial class DungeonSystem
|
||||
public void SpawnRoom(
|
||||
EntityUid gridUid,
|
||||
MapGridComponent grid,
|
||||
Matrix3 roomTransform,
|
||||
Matrix3x2 roomTransform,
|
||||
DungeonRoomPrototype room,
|
||||
bool clearExisting = false)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public sealed partial class DungeonSystem
|
||||
// go BRRNNTTT on existing stuff
|
||||
if (clearExisting)
|
||||
{
|
||||
var gridBounds = new Box2(roomTransform.Transform(Vector2.Zero), roomTransform.Transform(room.Size));
|
||||
var gridBounds = new Box2(Vector2.Transform(Vector2.Zero, roomTransform), Vector2.Transform(room.Size, roomTransform));
|
||||
_entitySet.Clear();
|
||||
// Polygon skin moment
|
||||
gridBounds = gridBounds.Enlarged(-0.05f);
|
||||
@@ -148,7 +148,7 @@ public sealed partial class DungeonSystem
|
||||
var indices = new Vector2i(x + room.Offset.X, y + room.Offset.Y);
|
||||
var tileRef = _maps.GetTileRef(templateMapUid, templateGrid, indices);
|
||||
|
||||
var tilePos = roomTransform.Transform(indices + tileOffset);
|
||||
var tilePos = Vector2.Transform(indices + tileOffset, roomTransform);
|
||||
var rounded = tilePos.Floored();
|
||||
_tiles.Add((rounded, tileRef.Tile));
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public sealed partial class DungeonSystem
|
||||
foreach (var templateEnt in _lookup.GetEntitiesIntersecting(templateMapUid, bounds, LookupFlags.Uncontained))
|
||||
{
|
||||
var templateXform = _xformQuery.GetComponent(templateEnt);
|
||||
var childPos = roomTransform.Transform(templateXform.LocalPosition - roomCenter);
|
||||
var childPos = Vector2.Transform(templateXform.LocalPosition - roomCenter, roomTransform);
|
||||
var childRot = templateXform.LocalRotation + finalRoomRotation;
|
||||
var protoId = _metaQuery.GetComponent(templateEnt).EntityPrototype?.ID;
|
||||
|
||||
@@ -192,7 +192,7 @@ public sealed partial class DungeonSystem
|
||||
// Offset by 0.5 because decals are offset from bot-left corner
|
||||
// So we convert it to center of tile then convert it back again after transform.
|
||||
// Do these shenanigans because 32x32 decals assume as they are centered on bottom-left of tiles.
|
||||
var position = roomTransform.Transform(decal.Coordinates + Vector2Helpers.Half - roomCenter);
|
||||
var position = Vector2.Transform(decal.Coordinates + Vector2Helpers.Half - roomCenter, roomTransform);
|
||||
position -= Vector2Helpers.Half;
|
||||
|
||||
// Umm uhh I love decals so uhhhh idk what to do about this
|
||||
|
||||
Reference in New Issue
Block a user