Remove unneccesary casts on bounds
This commit is contained in:
parent
c0666a5404
commit
e7e9c300fd
|
@ -375,7 +375,7 @@ public partial class Mission : Node3D
|
||||||
lmImages.Resize(lmLayerCount);
|
lmImages.Resize(lmLayerCount);
|
||||||
for (var i = 0; i < lmLayerCount; i++)
|
for (var i = 0; i < lmLayerCount; i++)
|
||||||
{
|
{
|
||||||
lmImages[i] = Image.CreateEmpty((int)bounds.Width, (int)bounds.Height, false, lightmapFormat);
|
lmImages[i] = Image.CreateEmpty(bounds.Width, bounds.Height, false, lightmapFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var rect in packingRects)
|
foreach (var rect in packingRects)
|
||||||
|
@ -391,7 +391,7 @@ public partial class Mission : Node3D
|
||||||
var height = lightmap.Height;
|
var height = lightmap.Height;
|
||||||
var layerCount = lightmap.Layers;
|
var layerCount = lightmap.Layers;
|
||||||
var srcRect = new Rect2I(0, 0, width, height);
|
var srcRect = new Rect2I(0, 0, width, height);
|
||||||
var dst = new Vector2I((int)rect.X, (int)rect.Y);
|
var dst = new Vector2I(rect.X, rect.Y);
|
||||||
for (var i = 0; i < layerCount; i++)
|
for (var i = 0; i < layerCount; i++)
|
||||||
{
|
{
|
||||||
var cellLm = Image.CreateFromData(width, height, false, lightmapFormat, lightmap.AsBytesRgba(i));
|
var cellLm = Image.CreateFromData(width, height, false, lightmapFormat, lightmap.AsBytesRgba(i));
|
||||||
|
@ -411,8 +411,8 @@ public partial class Mission : Node3D
|
||||||
if (v < 0) v = Math.Abs(v);
|
if (v < 0) v = Math.Abs(v);
|
||||||
|
|
||||||
// Transform!
|
// Transform!
|
||||||
u = (rect.X + rect.Width * u) / (int)bounds.Width;
|
u = (rect.X + rect.Width * u) / bounds.Width;
|
||||||
v = (rect.Y + rect.Height * v) / (int)bounds.Height;
|
v = (rect.Y + rect.Height * v) / bounds.Height;
|
||||||
return new Vector2(u, v);
|
return new Vector2(u, v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue