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
|
||||
filter: Linear, Linear
|
||||
pma: true
|
||||
scale: 0.4
|
||||
arm-back-down
|
||||
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
|
||||
filter: Linear, Linear
|
||||
pma: true
|
||||
scale: 0.5
|
||||
base-head
|
||||
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 {
|
||||
AndroidSkeletonDrawable.fromAsset(
|
||||
"mix-and-match-pma.atlas",
|
||||
"mix-and-match.atlas",
|
||||
"mix-and-match-pro.skel",
|
||||
context
|
||||
)
|
||||
|
||||
@ -102,6 +102,10 @@ fun Physics(nav: NavHostController) {
|
||||
invertedYDragPosition
|
||||
)
|
||||
},
|
||||
onDragEnd = { ->
|
||||
mousePosition.value = null;
|
||||
lastMousePosition.value = null;
|
||||
}
|
||||
)
|
||||
}
|
||||
) {
|
||||
@ -109,7 +113,7 @@ fun Physics(nav: NavHostController) {
|
||||
factory = { ctx ->
|
||||
SpineView(ctx).apply {
|
||||
loadFromAsset(
|
||||
"celestial-circus-pma.atlas",
|
||||
"celestial-circus.atlas",
|
||||
"celestial-circus-pro.skel",
|
||||
controller
|
||||
)
|
||||
|
||||
@ -57,7 +57,7 @@ public class AndroidTexture extends Texture {
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||
break;
|
||||
case multiply:
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||
break;
|
||||
case additive:
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
|
||||
|
||||
@ -102,12 +102,13 @@ public class SkeletonRenderer {
|
||||
if (attachment == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (attachment instanceof RegionAttachment) {
|
||||
RegionAttachment region = (RegionAttachment)attachment;
|
||||
verticesLength = vertexSize << 2;
|
||||
if (region.getSequence() != null) region.getSequence().apply(slot, region);
|
||||
AndroidTexture texture = (AndroidTexture)region.getRegion().getTexture();
|
||||
BlendMode blendMode = slot.getData().getBlendMode();
|
||||
|
||||
if (command.blendMode == null && command.texture == null) {
|
||||
command.blendMode = blendMode;
|
||||
command.texture = texture;
|
||||
@ -126,10 +127,10 @@ public class SkeletonRenderer {
|
||||
uvs = region.getUVs();
|
||||
indices = quadTriangles;
|
||||
color = region.getColor();
|
||||
|
||||
} else if (attachment instanceof MeshAttachment) {
|
||||
MeshAttachment mesh = (MeshAttachment)attachment;
|
||||
verticesLength = mesh.getWorldVerticesLength();
|
||||
if (mesh.getSequence() != null) mesh.getSequence().apply(slot, mesh);
|
||||
AndroidTexture texture = (AndroidTexture)mesh.getRegion().getTexture();
|
||||
BlendMode blendMode = slot.getData().getBlendMode();
|
||||
|
||||
@ -208,12 +209,6 @@ public class SkeletonRenderer {
|
||||
public void render (Canvas canvas, Array<RenderCommand> commands) {
|
||||
for (int i = 0; i < commands.size; 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,
|
||||
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