mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 17:18:44 +08:00
Merge remote-tracking branch 'origin/3.6' into 3.6
This commit is contained in:
commit
5f03186b36
@ -25,6 +25,7 @@
|
||||
* Added support for clipping.
|
||||
* Added support for rotated regions in texture atlas loaded via StarlingAtlasAttachmentLoader.
|
||||
* Added support for vertex effects. See `RaptorExample.as`
|
||||
* Added 'getTexture()' method to 'StarlingTextureAtlasAttachmentLoader'
|
||||
|
||||
## C
|
||||
* **Breaking changes**
|
||||
@ -63,6 +64,7 @@
|
||||
* SkeletonRenderer now combines the displayed color of the Node (cascaded from all parents) with the skeleton color for tinting.
|
||||
* Added support for vertex effects. See `RaptorExample.cpp`.
|
||||
* Added ETC1 alpha support, thanks @halx99! Does not work when two color tint is enabled.
|
||||
* Added `spAtlasPage_setCustomTextureLoader()` which let's you do texture loading manually. Thanks @jareguo.
|
||||
|
||||
### Cocos2d-Objc
|
||||
* Fixed renderer to work with 3.6 changes
|
||||
@ -145,7 +147,9 @@
|
||||
* Removed `RegionBatcher` and `SkeletonRegionRenderer`, renamed `SkeletonMeshRenderer` to `SkeletonRenderer`
|
||||
* Added support for two color tint. For it to work, you need to add the `SpineEffect.fx` file to your content project, then load it via `var effect = Content.Load<Effect>("SpineEffect");`, and set it on the `SkeletonRenderer`. See the example project for code.
|
||||
* Added support for any `Effect` to be used by `SkeletonRenderer`
|
||||
* Added support for `IVertexEffect` to modify vertices of skeletons on the CPU. `IVertexEffect` instances can be set on the `SkeletonRenderer`. See example project.
|
||||
* Added `SkeletonDebugRenderer`
|
||||
* Made `MeshBatcher` of SkeletonRenderer accessible via a getter. Allows user to batch their own geometry together with skeleton meshes for maximum batching instead of using XNA SpriteBatcher.
|
||||
|
||||
## Java
|
||||
* **Breaking changes**
|
||||
|
||||
@ -84,7 +84,8 @@ struct spTrackEntry {
|
||||
timelineData(0),
|
||||
timelineDipMix(0),
|
||||
timelinesRotation(0),
|
||||
timelinesRotationCount(0) {
|
||||
timelinesRotationCount(0),
|
||||
rendererObject(0), userData(0) {
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@ -102,6 +103,7 @@ struct spAnimationState {
|
||||
spTrackEntryArray* mixingTo;
|
||||
|
||||
void* rendererObject;
|
||||
void* userData;
|
||||
|
||||
#ifdef __cplusplus
|
||||
spAnimationState() :
|
||||
@ -111,7 +113,8 @@ struct spAnimationState {
|
||||
listener(0),
|
||||
timeScale(0),
|
||||
mixingTo(0),
|
||||
rendererObject(0) {
|
||||
rendererObject(0),
|
||||
userData(0) {
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -31,6 +31,13 @@
|
||||
#include <spine/spine-cocos2dx.h>
|
||||
#include <spine/extension.h>
|
||||
|
||||
namespace spine {
|
||||
static CustomTextureLoader _customTextureLoader = nullptr;
|
||||
void spAtlasPage_setCustomTextureLoader (CustomTextureLoader texLoader) {
|
||||
_customTextureLoader = texLoader;
|
||||
}
|
||||
}
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
GLuint wrap (spAtlasWrap wrap) {
|
||||
@ -60,7 +67,13 @@ GLuint filter (spAtlasFilter filter) {
|
||||
}
|
||||
|
||||
void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) {
|
||||
Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(path);
|
||||
Texture2D* texture = nullptr;
|
||||
if (spine::_customTextureLoader) {
|
||||
texture = spine::_customTextureLoader(path);
|
||||
}
|
||||
if (!texture) {
|
||||
texture = Director::getInstance()->getTextureCache()->addImage(path);
|
||||
}
|
||||
CCASSERT(texture != nullptr, "Invalid image");
|
||||
texture->retain();
|
||||
|
||||
|
||||
@ -38,4 +38,10 @@
|
||||
#include <spine/SkeletonAnimation.h>
|
||||
#include <spine/SkeletonBatch.h>
|
||||
|
||||
namespace spine {
|
||||
typedef cocos2d::Texture2D* (*CustomTextureLoader)(const char* path);
|
||||
// set custom texture loader for _spAtlasPage_createTexture
|
||||
void spAtlasPage_setCustomTextureLoader(CustomTextureLoader texLoader);
|
||||
}
|
||||
|
||||
#endif /* SPINE_COCOS2DX_H_ */
|
||||
|
||||
@ -258,7 +258,7 @@ namespace Spine {
|
||||
return clipped;
|
||||
}
|
||||
|
||||
static void MakeClockwise (ExposedList<float> polygon) {
|
||||
public static void MakeClockwise (ExposedList<float> polygon) {
|
||||
float[] vertices = polygon.Items;
|
||||
int verticeslength = polygon.Count;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
using System;
|
||||
|
||||
namespace Spine {
|
||||
internal class Triangulator {
|
||||
public class Triangulator {
|
||||
private readonly ExposedList<ExposedList<float>> convexPolygons = new ExposedList<ExposedList<float>>();
|
||||
private readonly ExposedList<ExposedList<int>> convexPolygonsIndices = new ExposedList<ExposedList<int>>();
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
|
||||
float alpha = texColor.a * input.Color.a;
|
||||
float4 output;
|
||||
output.a = alpha;
|
||||
output.rgb = (1.0 - texColor.rgb) * input.Color2.rgb * alpha + texColor.rgb * input.Color.rgb;
|
||||
output.rgb = ((texColor.a - 1.0) * input.Color2.a + 1.0 - texColor.rgb) * input.Color2.rgb + texColor.rgb * input.Color.rgb;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
BIN
spine-ue4/Content/Test/Blueprints/Cube_Blueprint.uasset
Normal file
BIN
spine-ue4/Content/Test/Blueprints/Cube_Blueprint.uasset
Normal file
Binary file not shown.
BIN
spine-ue4/Content/Test/Blueprints/TouchClick.uasset
Normal file
BIN
spine-ue4/Content/Test/Blueprints/TouchClick.uasset
Normal file
Binary file not shown.
BIN
spine-ue4/Content/Test/Blueprints/TouchPlayer.uasset
Normal file
BIN
spine-ue4/Content/Test/Blueprints/TouchPlayer.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -178,7 +178,7 @@ void USpineSkeletonRendererComponent::Flush (int &Idx, TArray<FVector> &Vertices
|
||||
verts.Add(FRuntimeMeshVertexTripleUV(Vertices[i], FVector(), FVector(), Colors[i], Uvs[i], FVector2D(Colors2[i].X, Colors2[i].Y), FVector2D(Colors2[i].Z, 0)));
|
||||
}
|
||||
|
||||
CreateMeshSection(Idx, verts, Indices);
|
||||
CreateMeshSection(Idx, verts, Indices, true);
|
||||
|
||||
// CreateMeshSection(Idx, Vertices, Indices, TArray<FVector>(), Uvs, darkRG, Colors, TArray<FRuntimeMeshTangent>(), false);
|
||||
Vertices.SetNum(0);
|
||||
|
||||
@ -42,7 +42,7 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
|
||||
float alpha = texColor.a * input.Color.a;
|
||||
float4 output;
|
||||
output.a = alpha;
|
||||
output.rgb = (1.0 - texColor.rgb) * input.Color2.rgb * alpha + texColor.rgb * input.Color.rgb;
|
||||
output.rgb = ((texColor.a - 1.0) * input.Color2.a + 1.0 - texColor.rgb) * input.Color2.rgb + texColor.rgb * input.Color.rgb;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -85,10 +85,10 @@ namespace Spine {
|
||||
skeletonDebugRenderer.DrawClipping = true;
|
||||
|
||||
// String name = "spineboy-ess";
|
||||
String name = "goblins-pro";
|
||||
// String name = "goblins-pro";
|
||||
// String name = "raptor-pro";
|
||||
// String name = "tank-pro";
|
||||
// String name = "coin-pro";
|
||||
String name = "coin-pro";
|
||||
String atlasName = name.Replace("-pro", "").Replace("-ess", "");
|
||||
if (name == "goblins-pro") atlasName = "goblins-mesh";
|
||||
bool binaryData = false;
|
||||
|
||||
@ -45,6 +45,7 @@ namespace Spine {
|
||||
SkeletonClipping clipper = new SkeletonClipping();
|
||||
GraphicsDevice device;
|
||||
MeshBatcher batcher;
|
||||
public MeshBatcher Batcher { get { return batcher; } }
|
||||
RasterizerState rasterizerState;
|
||||
float[] vertices = new float[8];
|
||||
int[] quadTriangles = { 0, 1, 2, 2, 3, 0 };
|
||||
@ -163,8 +164,13 @@ namespace Spine {
|
||||
|
||||
Color darkColor = new Color();
|
||||
if (slot.HasSecondColor) {
|
||||
darkColor = new Color(slot.R2, slot.G2, slot.B2);
|
||||
if (premultipliedAlpha) {
|
||||
darkColor = new Color(slot.R2 * a, slot.G2 * a, slot.B2 * a);
|
||||
} else {
|
||||
darkColor = new Color(slot.R2 * a, slot.G2 * a, slot.B2 * a);
|
||||
}
|
||||
}
|
||||
darkColor.A = premultipliedAlpha ? (byte)255 : (byte)0;
|
||||
|
||||
// clip
|
||||
if (clipper.IsClipping()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user