修复包围盒并集错误
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpineRuntime21;
|
using SpineRuntime21;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -237,15 +238,13 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
float[] _ = [];
|
||||||
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
tmpSkeleton.Update(delta);
|
tmpSkeleton.Update(delta);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpineRuntime36;
|
using SpineRuntime36;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -237,16 +238,13 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
tmpSkeleton.Update(delta);
|
tmpSkeleton.Update(delta);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpineRuntime37;
|
using SpineRuntime37;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -208,16 +209,13 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
tmpSkeleton.Update(delta);
|
tmpSkeleton.Update(delta);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using SpineRuntime38;
|
using SpineRuntime38;
|
||||||
using SpineRuntime38.Attachments;
|
using SpineRuntime38.Attachments;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -209,16 +210,13 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
tmpSkeleton.Update(delta);
|
tmpSkeleton.Update(delta);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpineRuntime40;
|
using SpineRuntime40;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -204,16 +205,13 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
tmpSkeleton.Update(delta);
|
tmpSkeleton.Update(delta);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpineRuntime41;
|
using SpineRuntime41;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -204,19 +205,15 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
//tmpSkeleton.Update(0);
|
//tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
//tmpSkeleton.Update(delta);
|
|
||||||
tmpSkeleton.UpdateWorldTransform();
|
tmpSkeleton.UpdateWorldTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpineRuntime42;
|
using SpineRuntime42;
|
||||||
|
using SpineViewer.Extensions;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
|
|
||||||
namespace SpineViewer.Spine.Implementations.SpineObject
|
namespace SpineViewer.Spine.Implementations.SpineObject
|
||||||
@@ -204,16 +205,13 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
tmpSkeleton.Update(0);
|
tmpSkeleton.Update(0);
|
||||||
tmpSkeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
tmpSkeleton.UpdateWorldTransform(Skeleton.Physics.Update);
|
||||||
|
|
||||||
// 切成 100 帧获取边界最大值
|
// 按 10 帧每秒计算边框
|
||||||
var bounds = getCurrentBounds();
|
var bounds = getCurrentBounds();
|
||||||
float[] _ = [];
|
float[] _ = [];
|
||||||
for (float tick = 0, delta = maxDuration / 100; tick < maxDuration; tick += delta)
|
for (float tick = 0, delta = 0.1f; tick < maxDuration; tick += delta)
|
||||||
{
|
{
|
||||||
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
tmpSkeleton.GetBounds(out var x, out var y, out var w, out var h, ref _);
|
||||||
if (x < bounds.X) bounds.X = x;
|
bounds = bounds.Union(new(x, y, w, h));
|
||||||
if (y < bounds.Y) bounds.Y = y;
|
|
||||||
if (w > bounds.Width) bounds.Width = w;
|
|
||||||
if (h > bounds.Height) bounds.Height = h;
|
|
||||||
tmpAnimationState.Update(delta);
|
tmpAnimationState.Update(delta);
|
||||||
tmpAnimationState.Apply(tmpSkeleton);
|
tmpAnimationState.Apply(tmpSkeleton);
|
||||||
tmpSkeleton.Update(delta);
|
tmpSkeleton.Update(delta);
|
||||||
|
|||||||
Reference in New Issue
Block a user