[csharp] Fixed bug in triangulator, closes #937.

This commit is contained in:
badlogic 2017-07-21 16:46:45 +02:00
parent d950da644f
commit 1535906511
7 changed files with 9 additions and 3975 deletions

View File

@ -84,6 +84,7 @@ namespace Spine {
} }
break; break;
} }
outer:
if (next == 0) { if (next == 0) {
do { do {
@ -97,7 +98,6 @@ namespace Spine {
i = next; i = next;
next = (next + 1) % vertexCount; next = (next + 1) % vertexCount;
} }
outer:
// Cut ear tip. // Cut ear tip.
triangles.Add(indices[(vertexCount + i - 1) % vertexCount]); triangles.Add(indices[(vertexCount + i - 1) % vertexCount]);

View File

@ -1,13 +0,0 @@
skeleton.png
size: 256,256
format: RGBA8888
filter: Linear,Linear
repeat: none
body
rotate: false
xy: 2, 2
size: 192, 129
orig: 192, 129
offset: 0, 0
index: -1

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -122,24 +122,18 @@
<None Include="data\coin-pro.skel"> <None Include="data\coin-pro.skel">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="data\goblins-mesh.atlas">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="data\goblins.png"> <None Include="data\goblins.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="data\raptor.png"> <None Include="data\raptor.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="data\skeleton.atlas">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="data\skeleton.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="data\spineboy.png"> <None Include="data\spineboy.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<Content Include="data\skeleton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="data\tank.png"> <Content Include="data\tank.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -204,9 +198,6 @@
<None Include="data\coin-pro.json"> <None Include="data\coin-pro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="data\goblins-mesh.atlas">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\goblins-pro.json"> <None Include="data\goblins-pro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>

View File

@ -83,15 +83,14 @@ namespace Spine {
skeletonDebugRenderer = new SkeletonDebugRenderer(GraphicsDevice); skeletonDebugRenderer = new SkeletonDebugRenderer(GraphicsDevice);
skeletonDebugRenderer.DisableAll(); skeletonDebugRenderer.DisableAll();
skeletonDebugRenderer.DrawClipping = true; skeletonDebugRenderer.DrawClipping = true;
skeletonDebugRenderer.DrawClippingDecomposed = true;
// String name = "spineboy-ess"; // String name = "spineboy-ess";
// String name = "goblins-pro"; String name = "goblins-pro";
// String name = "raptor-pro"; // String name = "raptor-pro";
// String name = "tank-pro"; // String name = "tank-pro";
// String name = "coin-pro"; // String name = "coin-pro";
String name = "skeleton";
String atlasName = name.Replace("-pro", "").Replace("-ess", ""); String atlasName = name.Replace("-pro", "").Replace("-ess", "");
if (name == "goblins-pro") atlasName = "goblins-mesh";
bool binaryData = false; bool binaryData = false;
Atlas atlas = new Atlas(assetsFolder + atlasName + ".atlas", new XnaTextureLoader(GraphicsDevice)); Atlas atlas = new Atlas(assetsFolder + atlasName + ".atlas", new XnaTextureLoader(GraphicsDevice));
@ -145,18 +144,12 @@ namespace Spine {
skeleton.X += 300; skeleton.X += 300;
state.SetAnimation(0, "drive", true); state.SetAnimation(0, "drive", true);
} }
else if (name == "skeleton") {
skeleton.SetSkin("Pig_Normal");
skeleton.FlipY = true;
// skeleton.Y -= 200;
// state.SetAnimation(0, "BattleIdle", true);
}
else { else {
state.SetAnimation(0, "walk", true); state.SetAnimation(0, "walk", true);
} }
// skeleton.X += 400; skeleton.X += 400;
// skeleton.Y += GraphicsDevice.Viewport.Height; skeleton.Y += GraphicsDevice.Viewport.Height;
skeleton.UpdateWorldTransform(); skeleton.UpdateWorldTransform();
headSlot = skeleton.FindSlot("head"); headSlot = skeleton.FindSlot("head");

View File

@ -154,6 +154,7 @@ namespace Spine {
} }
public void End() { public void End() {
if (vertices.Count == 0) return;
var verticesArray = vertices.ToArray(); var verticesArray = vertices.ToArray();
foreach (EffectPass pass in effect.CurrentTechnique.Passes) { foreach (EffectPass pass in effect.CurrentTechnique.Passes) {