mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[android] Fix multiply blend mode, fix sequence attachments in renderer
can't fetch the region from an attachment before calling computeWorldVertices. Doing it manually now.
This commit is contained in:
parent
63681d86af
commit
70fc30cbc0
Binary file not shown.
|
Before Width: | Height: | Size: 799 KiB |
@ -1,7 +1,6 @@
|
|||||||
celestial-circus-pma.png
|
celestial-circus.png
|
||||||
size: 1024, 1024
|
size: 1024, 1024
|
||||||
filter: Linear, Linear
|
filter: Linear, Linear
|
||||||
pma: true
|
|
||||||
scale: 0.4
|
scale: 0.4
|
||||||
arm-back-down
|
arm-back-down
|
||||||
bounds: 324, 401, 38, 82
|
bounds: 324, 401, 38, 82
|
||||||
BIN
spine-android/app/src/main/assets/celestial-circus.png
Normal file
BIN
spine-android/app/src/main/assets/celestial-circus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 790 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 369 KiB |
@ -1,7 +1,6 @@
|
|||||||
mix-and-match-pma.png
|
mix-and-match.png
|
||||||
size: 1024, 512
|
size: 1024, 512
|
||||||
filter: Linear, Linear
|
filter: Linear, Linear
|
||||||
pma: true
|
|
||||||
scale: 0.5
|
scale: 0.5
|
||||||
base-head
|
base-head
|
||||||
bounds: 118, 70, 95, 73
|
bounds: 118, 70, 95, 73
|
||||||
BIN
spine-android/app/src/main/assets/mix-and-match.png
Normal file
BIN
spine-android/app/src/main/assets/mix-and-match.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 341 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 71 KiB |
File diff suppressed because it is too large
Load Diff
@ -50,7 +50,7 @@ fun DressUp(nav: NavHostController) {
|
|||||||
|
|
||||||
val drawable = remember {
|
val drawable = remember {
|
||||||
AndroidSkeletonDrawable.fromAsset(
|
AndroidSkeletonDrawable.fromAsset(
|
||||||
"mix-and-match-pma.atlas",
|
"mix-and-match.atlas",
|
||||||
"mix-and-match-pro.skel",
|
"mix-and-match-pro.skel",
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
|
|||||||
@ -102,6 +102,10 @@ fun Physics(nav: NavHostController) {
|
|||||||
invertedYDragPosition
|
invertedYDragPosition
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
onDragEnd = { ->
|
||||||
|
mousePosition.value = null;
|
||||||
|
lastMousePosition.value = null;
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
@ -109,7 +113,7 @@ fun Physics(nav: NavHostController) {
|
|||||||
factory = { ctx ->
|
factory = { ctx ->
|
||||||
SpineView(ctx).apply {
|
SpineView(ctx).apply {
|
||||||
loadFromAsset(
|
loadFromAsset(
|
||||||
"celestial-circus-pma.atlas",
|
"celestial-circus.atlas",
|
||||||
"celestial-circus-pro.skel",
|
"celestial-circus-pro.skel",
|
||||||
controller
|
controller
|
||||||
)
|
)
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class AndroidTexture extends Texture {
|
|||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||||
break;
|
break;
|
||||||
case multiply:
|
case multiply:
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||||
break;
|
break;
|
||||||
case additive:
|
case additive:
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
|
||||||
|
|||||||
@ -102,12 +102,13 @@ public class SkeletonRenderer {
|
|||||||
if (attachment == null) {
|
if (attachment == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachment instanceof RegionAttachment) {
|
if (attachment instanceof RegionAttachment) {
|
||||||
RegionAttachment region = (RegionAttachment)attachment;
|
RegionAttachment region = (RegionAttachment)attachment;
|
||||||
verticesLength = vertexSize << 2;
|
verticesLength = vertexSize << 2;
|
||||||
|
if (region.getSequence() != null) region.getSequence().apply(slot, region);
|
||||||
AndroidTexture texture = (AndroidTexture)region.getRegion().getTexture();
|
AndroidTexture texture = (AndroidTexture)region.getRegion().getTexture();
|
||||||
BlendMode blendMode = slot.getData().getBlendMode();
|
BlendMode blendMode = slot.getData().getBlendMode();
|
||||||
|
|
||||||
if (command.blendMode == null && command.texture == null) {
|
if (command.blendMode == null && command.texture == null) {
|
||||||
command.blendMode = blendMode;
|
command.blendMode = blendMode;
|
||||||
command.texture = texture;
|
command.texture = texture;
|
||||||
@ -126,10 +127,10 @@ public class SkeletonRenderer {
|
|||||||
uvs = region.getUVs();
|
uvs = region.getUVs();
|
||||||
indices = quadTriangles;
|
indices = quadTriangles;
|
||||||
color = region.getColor();
|
color = region.getColor();
|
||||||
|
|
||||||
} else if (attachment instanceof MeshAttachment) {
|
} else if (attachment instanceof MeshAttachment) {
|
||||||
MeshAttachment mesh = (MeshAttachment)attachment;
|
MeshAttachment mesh = (MeshAttachment)attachment;
|
||||||
verticesLength = mesh.getWorldVerticesLength();
|
verticesLength = mesh.getWorldVerticesLength();
|
||||||
|
if (mesh.getSequence() != null) mesh.getSequence().apply(slot, mesh);
|
||||||
AndroidTexture texture = (AndroidTexture)mesh.getRegion().getTexture();
|
AndroidTexture texture = (AndroidTexture)mesh.getRegion().getTexture();
|
||||||
BlendMode blendMode = slot.getData().getBlendMode();
|
BlendMode blendMode = slot.getData().getBlendMode();
|
||||||
|
|
||||||
@ -208,12 +209,6 @@ public class SkeletonRenderer {
|
|||||||
public void render (Canvas canvas, Array<RenderCommand> commands) {
|
public void render (Canvas canvas, Array<RenderCommand> commands) {
|
||||||
for (int i = 0; i < commands.size; i++) {
|
for (int i = 0; i < commands.size; i++) {
|
||||||
RenderCommand command = commands.get(i);
|
RenderCommand command = commands.get(i);
|
||||||
|
|
||||||
// TODO Fix issue with dressup rendering
|
|
||||||
if (command.blendMode == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
canvas.drawVertices(Canvas.VertexMode.TRIANGLES, command.vertices.size, command.vertices.items, 0, command.uvs.items, 0,
|
canvas.drawVertices(Canvas.VertexMode.TRIANGLES, command.vertices.size, command.vertices.items, 0, command.uvs.items, 0,
|
||||||
command.colors.items, 0, command.indices.items, 0, command.indices.size, command.texture.getPaint(command.blendMode));
|
command.colors.items, 0, command.indices.items, 0, command.indices.size, command.texture.getPaint(command.blendMode));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user