Merge branch '3.8' into 3.9-beta

This commit is contained in:
badlogic 2019-09-23 14:38:43 +02:00
commit 81938c65c0
20 changed files with 51 additions and 35 deletions

View File

@ -164,6 +164,7 @@
### Cocos2d-x
* Updated to cocos2d-x 3.17.1
* Added mix-and-match example to demonstrate the new Skin API.
* Exmaple project requires Visual Studio 2019 on Windows
### SFML
* Added mix-and-match example to demonstrate the new Skin API.

View File

@ -33,15 +33,16 @@ The setup for cocos2d-x differs from most other Spine Runtimes because the cocos
The Spine cocos2d-x example works on Windows, Mac OS X, iOS and Android.
### Windows
1. Install [Visual Studio 2015 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
1. Install [Visual Studio 2019 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
2. Install CMake via the [Windows installer package](https://cmake.org/download/).
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
4. Run CMake GUI from the start menu
5. Click `Browse Source` and select the directory `spine-runtimes`
6. Click `Browse Build` and select the `spine-runtimes/spine-cocos2dx/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
7. Click `Configure`. This will download the cocos2d-x dependency and wire it up with the example source code in `spine-runtimes/spine-cocos2dx/example`. The download is 400mb, so get yourself a cup of tea.
7. Click `Configure`. Check `SPINE_COCOS2D_X`
8. Click `Configure` again. This will download the cocos2d-x dependency and wire it up with the example source code in `spine-runtimes/spine-cocos2dx/example`. The download is 400mb, so get yourself a cup of tea.
7. Open the file `spine-cocos2dx\example\cocos2d\cocos\2d\cocos2dx.props` and remove the `libSpine.lib` entry from the `<AdditionalDependencies>` tag.
8. Open the `spine-runtimes/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.sln` file in Visual Studio 2015. Visual Studio may ask you to install the Windows XP/7 SDK, which you should install.
8. Open the `spine-runtimes/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.sln` file in Visual Studio 2019. Visual Studio may ask you to install the Windows XP/7 SDK, which you should install.
9. Expand `References` of the libcocos2d sub project, and remove the entry for `libSpine`, which should be marked with an error.
9. Right click the `spine-cocos2d-x` project in the solution explorer and select `Set as Startup Project` from the context menu
10. Click `Local Windows Debugger` to run the example

View File

@ -99,7 +99,7 @@
<ItemDefinitionGroup>
<CustomBuildStep>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources" /D /E /I /F /Y
</Command>
<Outputs>$(TargetName).cab</Outputs>
<Inputs>$(TargetFileName)</Inputs>

View File

@ -38,6 +38,8 @@
#include <spine/ContainerUtil.h>
#include <stdint.h>
using namespace spine;
Animation::Animation(const String &name, Vector<Timeline *> &timelines, float duration) :

View File

@ -162,6 +162,11 @@ namespace Spine {
copy.regionOriginalHeight = regionOriginalHeight;
copy.RegionRotate = RegionRotate;
copy.RegionDegrees = RegionDegrees;
copy.RegionU = RegionU;
copy.RegionV = RegionV;
copy.RegionU2 = RegionU2;
copy.RegionV2 = RegionV2;
copy.Path = Path;
copy.r = r;
copy.g = g;
@ -199,12 +204,17 @@ namespace Spine {
mesh.regionOriginalHeight = regionOriginalHeight;
mesh.RegionDegrees = RegionDegrees;
mesh.RegionRotate = RegionRotate;
mesh.RegionU = RegionU;
mesh.RegionV = RegionV;
mesh.RegionU2 = RegionU2;
mesh.RegionV2 = RegionV2;
mesh.Path = Path;
mesh.r = r;
mesh.g = g;
mesh.b = b;
mesh.a = a;
mesh.deformAttachment = deformAttachment;
mesh.ParentMesh = parentMesh != null ? parentMesh : this;
mesh.UpdateUVs();

View File

@ -1515,14 +1515,14 @@ var spine;
var alpha = 0;
switch (timelineMode[i] & (AnimationState.NOT_LAST - 1)) {
case AnimationState.SUBSEQUENT:
timelineBlend = blend;
if (!attachments && timeline instanceof spine.AttachmentTimeline) {
if ((timelineMode[i] & AnimationState.NOT_LAST) == AnimationState.NOT_LAST)
continue;
blend = spine.MixBlend.setup;
timelineBlend = spine.MixBlend.setup;
}
if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
continue;
timelineBlend = blend;
alpha = alphaMix;
break;
case AnimationState.FIRST:
@ -10945,7 +10945,7 @@ var spine;
this.restorables = new Array();
if (canvasOrContext instanceof HTMLCanvasElement) {
var canvas_1 = canvasOrContext;
this.gl = (canvas_1.getContext("webgl", contextConfig) || canvas_1.getContext("experimental-webgl", contextConfig));
this.gl = (canvas_1.getContext("webgl2", contextConfig)) || (canvas_1.getContext("webgl", contextConfig) || canvas_1.getContext("experimental-webgl", contextConfig));
this.canvas = canvas_1;
canvas_1.addEventListener("webglcontextlost", function (e) {
var event = e;

File diff suppressed because one or more lines are too long

View File

@ -1515,14 +1515,14 @@ var spine;
var alpha = 0;
switch (timelineMode[i] & (AnimationState.NOT_LAST - 1)) {
case AnimationState.SUBSEQUENT:
timelineBlend = blend;
if (!attachments && timeline instanceof spine.AttachmentTimeline) {
if ((timelineMode[i] & AnimationState.NOT_LAST) == AnimationState.NOT_LAST)
continue;
blend = spine.MixBlend.setup;
timelineBlend = spine.MixBlend.setup;
}
if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
continue;
timelineBlend = blend;
alpha = alphaMix;
break;
case AnimationState.FIRST:

File diff suppressed because one or more lines are too long

View File

@ -1515,14 +1515,14 @@ var spine;
var alpha = 0;
switch (timelineMode[i] & (AnimationState.NOT_LAST - 1)) {
case AnimationState.SUBSEQUENT:
timelineBlend = blend;
if (!attachments && timeline instanceof spine.AttachmentTimeline) {
if ((timelineMode[i] & AnimationState.NOT_LAST) == AnimationState.NOT_LAST)
continue;
blend = spine.MixBlend.setup;
timelineBlend = spine.MixBlend.setup;
}
if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
continue;
timelineBlend = blend;
alpha = alphaMix;
break;
case AnimationState.FIRST:

File diff suppressed because one or more lines are too long

View File

@ -1515,14 +1515,14 @@ var spine;
var alpha = 0;
switch (timelineMode[i] & (AnimationState.NOT_LAST - 1)) {
case AnimationState.SUBSEQUENT:
timelineBlend = blend;
if (!attachments && timeline instanceof spine.AttachmentTimeline) {
if ((timelineMode[i] & AnimationState.NOT_LAST) == AnimationState.NOT_LAST)
continue;
blend = spine.MixBlend.setup;
timelineBlend = spine.MixBlend.setup;
}
if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
continue;
timelineBlend = blend;
alpha = alphaMix;
break;
case AnimationState.FIRST:
@ -10677,7 +10677,7 @@ var spine;
this.restorables = new Array();
if (canvasOrContext instanceof HTMLCanvasElement) {
var canvas = canvasOrContext;
this.gl = (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
this.gl = (canvas.getContext("webgl2", contextConfig)) || (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
this.canvas = canvas;
canvas.addEventListener("webglcontextlost", function (e) {
var event = e;

File diff suppressed because one or more lines are too long

View File

@ -1515,14 +1515,14 @@ var spine;
var alpha = 0;
switch (timelineMode[i] & (AnimationState.NOT_LAST - 1)) {
case AnimationState.SUBSEQUENT:
timelineBlend = blend;
if (!attachments && timeline instanceof spine.AttachmentTimeline) {
if ((timelineMode[i] & AnimationState.NOT_LAST) == AnimationState.NOT_LAST)
continue;
blend = spine.MixBlend.setup;
timelineBlend = spine.MixBlend.setup;
}
if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
continue;
timelineBlend = blend;
alpha = alphaMix;
break;
case AnimationState.FIRST:

File diff suppressed because one or more lines are too long

View File

@ -1515,14 +1515,14 @@ var spine;
var alpha = 0;
switch (timelineMode[i] & (AnimationState.NOT_LAST - 1)) {
case AnimationState.SUBSEQUENT:
timelineBlend = blend;
if (!attachments && timeline instanceof spine.AttachmentTimeline) {
if ((timelineMode[i] & AnimationState.NOT_LAST) == AnimationState.NOT_LAST)
continue;
blend = spine.MixBlend.setup;
timelineBlend = spine.MixBlend.setup;
}
if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
continue;
timelineBlend = blend;
alpha = alphaMix;
break;
case AnimationState.FIRST:
@ -10677,7 +10677,7 @@ var spine;
this.restorables = new Array();
if (canvasOrContext instanceof HTMLCanvasElement) {
var canvas = canvasOrContext;
this.gl = (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
this.gl = (canvas.getContext("webgl2", contextConfig)) || (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
this.canvas = canvas;
canvas.addEventListener("webglcontextlost", function (e) {
var event = e;

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ module spine.webgl {
constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext, contextConfig: any = { alpha: "true" }) {
if (canvasOrContext instanceof HTMLCanvasElement) {
let canvas = canvasOrContext;
this.gl = <WebGLRenderingContext> (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
this.gl = <WebGLRenderingContext> (canvas.getContext("webgl2", contextConfig)) || (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
this.canvas = canvas;
canvas.addEventListener("webglcontextlost", (e: any) => {
let event = <WebGLContextEvent>e;

View File

@ -313,7 +313,7 @@ namespace Spine.Unity {
var mesh = smartMesh.mesh;
meshGenerator.FillVertexData(mesh);
if (updateTriangles) meshGenerator.FillTrianglesSingle(mesh);
if (updateTriangles) meshGenerator.FillTriangles(mesh);
meshGenerator.FillLateVertexData(mesh);
canvasRenderer.SetMesh(mesh);

View File

@ -148,7 +148,6 @@ namespace Spine.Unity {
// Clear last state of attachments and submeshes
instructionOutput.Clear(); // submeshInstructions.Clear(); attachments.Clear();
var workingSubmeshInstructions = instructionOutput.submeshInstructions;
workingSubmeshInstructions.Resize(1);
#if SPINE_TRIANGLECHECK
instructionOutput.attachments.Resize(drawOrderCount);
@ -206,11 +205,12 @@ namespace Spine.Unity {
current.rawVertexCount += attachmentVertexCount;
totalRawVertexCount += attachmentVertexCount;
}
#if !SPINE_TK2D
if (material == null)
if (material == null && rendererObject != null)
current.material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
#else
if (material == null)
if (material == null && rendererObject != null)
current.material = (rendererObject is Material) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
#endif
@ -218,7 +218,13 @@ namespace Spine.Unity {
instructionOutput.rawVertexCount = totalRawVertexCount;
#endif
workingSubmeshInstructions.Items[0] = current;
if (totalRawVertexCount > 0) {
workingSubmeshInstructions.Resize(1);
workingSubmeshInstructions.Items[0] = current;
}
else {
workingSubmeshInstructions.Resize(0);
}
}
public static void GenerateSkeletonRendererInstruction (SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Dictionary<Slot, Material> customSlotMaterials, List<Slot> separatorSlots, bool generateMeshOverride, bool immutableTriangles = false) {
@ -1045,10 +1051,6 @@ namespace Spine.Unity {
for (int i = 0; i < submeshCount; i++)
mesh.SetTriangles(submeshesItems[i].Items, i, false);
}
public void FillTrianglesSingle (Mesh mesh) {
mesh.SetTriangles(submeshes.Items[0].Items, 0, false);
}
#endregion
public void EnsureVertexCapacity (int minimumVertexCount, bool inlcudeTintBlack = false, bool includeTangents = false, bool includeNormals = false) {