mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[libgdx] Fixed RGB2Timeline and loading skeleton data data.
This commit is contained in:
parent
ceb3402627
commit
6e709a160f
@ -1444,7 +1444,7 @@ public class Animation {
|
||||
/** Changes the RGB for a slot's {@link Slot#getColor()} and {@link Slot#getDarkColor()} for two color tinting. */
|
||||
static public class RGB2Timeline extends CurveTimeline implements SlotTimeline {
|
||||
static public final int ENTRIES = 7;
|
||||
static private final int R = 1, G = 2, B = 3, R2 = 5, G2 = 6, B2 = 7;
|
||||
static private final int R = 1, G = 2, B = 3, R2 = 4, G2 = 5, B2 = 6;
|
||||
|
||||
final int slotIndex;
|
||||
|
||||
|
||||
@ -106,9 +106,9 @@ public class SkeletonBinary extends SkeletonLoader {
|
||||
static public final int SLOT_ATTACHMENT = 0;
|
||||
static public final int SLOT_RGBA = 1;
|
||||
static public final int SLOT_RGB = 2;
|
||||
static public final int SLOT_ALPHA = 3;
|
||||
static public final int SLOT_RGBA2 = 4;
|
||||
static public final int SLOT_RGB2 = 5;
|
||||
static public final int SLOT_RGBA2 = 3;
|
||||
static public final int SLOT_RGB2 = 4;
|
||||
static public final int SLOT_ALPHA = 5;
|
||||
|
||||
static public final int PATH_POSITION = 0;
|
||||
static public final int PATH_SPACING = 1;
|
||||
@ -621,9 +621,6 @@ public class SkeletonBinary extends SkeletonLoader {
|
||||
timelines.add(timeline);
|
||||
break;
|
||||
}
|
||||
case SLOT_ALPHA:
|
||||
timelines.add(readTimeline(input, new AlphaTimeline(frameCount, input.readInt(true), input.readInt(true)), 1));
|
||||
break;
|
||||
case SLOT_RGB: {
|
||||
RGBTimeline timeline = new RGBTimeline(frameCount, input.readInt(true), slotIndex);
|
||||
float time = input.readFloat();
|
||||
@ -688,7 +685,7 @@ public class SkeletonBinary extends SkeletonLoader {
|
||||
timelines.add(timeline);
|
||||
break;
|
||||
}
|
||||
case SLOT_RGB2:
|
||||
case SLOT_RGB2: {
|
||||
RGB2Timeline timeline = new RGB2Timeline(frameCount, input.readInt(true), slotIndex);
|
||||
float time = input.readFloat();
|
||||
float r = input.read() / 255f, g = input.read() / 255f, b = input.read() / 255f;
|
||||
@ -722,6 +719,27 @@ public class SkeletonBinary extends SkeletonLoader {
|
||||
timelines.add(timeline);
|
||||
break;
|
||||
}
|
||||
case SLOT_ALPHA:
|
||||
AlphaTimeline timeline = new AlphaTimeline(frameCount, input.readInt(true), slotIndex);
|
||||
float time = input.readFloat(), a = input.read() / 255f;
|
||||
for (int frame = 0, bezier = 0;; frame++) {
|
||||
timeline.setFrame(frame, time, a);
|
||||
if (frame == frameLast) break;
|
||||
float time2 = input.readFloat();
|
||||
float a2 = input.read() / 255f;
|
||||
switch (input.readByte()) {
|
||||
case CURVE_STEPPED:
|
||||
timeline.setStepped(frame);
|
||||
break;
|
||||
case CURVE_BEZIER:
|
||||
setBezier(input, timeline, bezier++, frame, 0, time, time2, a, a2, 1);
|
||||
}
|
||||
time = time2;
|
||||
a = a2;
|
||||
}
|
||||
timelines.add(timeline);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -513,7 +513,7 @@ public class SkeletonJson extends SkeletonLoader {
|
||||
} else if (timelineName.equals("rgba")) {
|
||||
RGBATimeline timeline = new RGBATimeline(timelineMap.size, timelineMap.size << 2, slot.index);
|
||||
float time = keyMap.getFloat("time", 0);
|
||||
String color = keyMap.getString("rgba");
|
||||
String color = keyMap.getString("color");
|
||||
float r = Integer.parseInt(color.substring(0, 2), 16) / 255f;
|
||||
float g = Integer.parseInt(color.substring(2, 4), 16) / 255f;
|
||||
float b = Integer.parseInt(color.substring(4, 6), 16) / 255f;
|
||||
@ -526,7 +526,7 @@ public class SkeletonJson extends SkeletonLoader {
|
||||
break;
|
||||
}
|
||||
float time2 = nextMap.getFloat("time", 0);
|
||||
color = nextMap.getString("rgba");
|
||||
color = nextMap.getString("color");
|
||||
float nr = Integer.parseInt(color.substring(0, 2), 16) / 255f;
|
||||
float ng = Integer.parseInt(color.substring(2, 4), 16) / 255f;
|
||||
float nb = Integer.parseInt(color.substring(4, 6), 16) / 255f;
|
||||
@ -550,7 +550,7 @@ public class SkeletonJson extends SkeletonLoader {
|
||||
} else if (timelineName.equals("rgb")) {
|
||||
RGBTimeline timeline = new RGBTimeline(timelineMap.size, timelineMap.size * 3, slot.index);
|
||||
float time = keyMap.getFloat("time", 0);
|
||||
String color = keyMap.getString("rgb");
|
||||
String color = keyMap.getString("color");
|
||||
float r = Integer.parseInt(color.substring(0, 2), 16) / 255f;
|
||||
float g = Integer.parseInt(color.substring(2, 4), 16) / 255f;
|
||||
float b = Integer.parseInt(color.substring(4, 6), 16) / 255f;
|
||||
@ -562,7 +562,7 @@ public class SkeletonJson extends SkeletonLoader {
|
||||
break;
|
||||
}
|
||||
float time2 = nextMap.getFloat("time", 0);
|
||||
color = nextMap.getString("rgb");
|
||||
color = nextMap.getString("color");
|
||||
float nr = Integer.parseInt(color.substring(0, 2), 16) / 255f;
|
||||
float ng = Integer.parseInt(color.substring(2, 4), 16) / 255f;
|
||||
float nb = Integer.parseInt(color.substring(4, 6), 16) / 255f;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user