From 53c29ab95a974e3f9ab16f8df42f2ba8e1e50636 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Wed, 2 Dec 2020 11:42:02 -0800 Subject: [PATCH] Added SkeletonAssetManagerTest. --- .../assets/spineboy/spineboy-pro.json | 376 ++++++++++-------- .../spine/SkeletonAssetManagerTest.java | 130 ++++++ 2 files changed, 347 insertions(+), 159 deletions(-) create mode 100644 spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAssetManagerTest.java diff --git a/spine-libgdx/spine-libgdx-tests/assets/spineboy/spineboy-pro.json b/spine-libgdx/spine-libgdx-tests/assets/spineboy/spineboy-pro.json index 41d803283..bcab27058 100644 --- a/spine-libgdx/spine-libgdx-tests/assets/spineboy/spineboy-pro.json +++ b/spine-libgdx/spine-libgdx-tests/assets/spineboy/spineboy-pro.json @@ -1,11 +1,11 @@ { "skeleton": { - "hash": "97I2+5rUsUE", - "spine": "4.0.05-beta", - "x": -188.63, + "hash": "VweBgQ4PoC4", + "spine": "4.0.36-beta", + "x": -145.14, "y": -7.94, - "width": 418.45, - "height": 686.2, + "width": 374.95, + "height": 686.43, "images": "./images/", "audio": "" }, @@ -182,7 +182,7 @@ "name": "head", "parent": "neck", "length": 131.79, - "rotation": 26.1, + "rotation": 4.89, "x": 27.66, "y": -0.26, "color": "e0da19ff" @@ -275,7 +275,7 @@ { "name": "rear-thigh", "bone": "rear-thigh", "attachment": "rear-thigh" }, { "name": "rear-shin", "bone": "rear-shin", "attachment": "rear-shin" }, { "name": "neck", "bone": "neck", "attachment": "neck" }, - { "name": "torso", "bone": "torso", "attachment": "torso" }, + { "name": "torso", "bone": "torso", "dark": "000000", "attachment": "torso" }, { "name": "front-upper-arm", "bone": "front-upper-arm", "attachment": "front-upper-arm" }, { "name": "head", "bone": "head", "attachment": "head" }, { "name": "eye", "bone": "head", "attachment": "eye-indifferent" }, @@ -283,7 +283,7 @@ { "name": "front-foot", "bone": "front-foot", "attachment": "front-foot" }, { "name": "front-shin", "bone": "front-shin", "attachment": "front-shin" }, { "name": "mouth", "bone": "head", "attachment": "mouth-smile" }, - { "name": "goggles", "bone": "head", "attachment": "goggles" }, + { "name": "goggles", "bone": "head", "dark": "000000", "attachment": "goggles" }, { "name": "front-bracer", "bone": "front-bracer", "attachment": "front-bracer" }, { "name": "front-fist", "bone": "front-fist", "attachment": "front-fist-closed" }, { "name": "muzzle", "bone": "muzzle" }, @@ -356,10 +356,12 @@ "bones": [ "front-upper-arm" ], "target": "aim-constraint-target", "rotation": -180, - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "aim-head-transform", @@ -367,10 +369,12 @@ "bones": [ "head" ], "target": "aim-constraint-target", "rotation": 84.3, - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "aim-rear-arm-transform", @@ -379,10 +383,12 @@ "target": "aim-constraint-target", "x": 57.7, "y": 56.4, - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "aim-torso-transform", @@ -391,10 +397,12 @@ "target": "aim-constraint-target", "rotation": 69.5, "shearY": -36, - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "front-foot-board-transform", @@ -403,10 +411,12 @@ "target": "hoverboard-controller", "x": -69.8, "y": 20.7, - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "rear-foot-board-transform", @@ -415,10 +425,12 @@ "target": "hoverboard-controller", "x": 86.6, "y": 21.3, - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "shoulder", @@ -426,20 +438,24 @@ "target": "front-shoulder", "x": 40.17, "y": -1.66, - "rotateMix": 0, - "translateMix": -1, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": -1, + "mixY": -1, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 }, { "name": "toes-board", "order": 14, "bones": [ "front-foot-tip", "back-foot-tip" ], "target": "hoverboard-controller", - "rotateMix": 0, - "translateMix": 0, - "scaleMix": 0, - "shearMix": 0 + "mixRotate": 0, + "mixX": 0, + "mixY": 0, + "mixScaleX": 0, + "mixScaleY": 0, + "mixShearY": 0 } ], "skins": [ @@ -861,16 +877,28 @@ }, "transform": { "aim-front-arm-transform": [ - { "rotateMix": 0.784, "translateMix": 0, "scaleMix": 0, "shearMix": 0 } + { "mixRotate": 0.784, "mixX": 0, "mixScaleX": 0, "mixShearY": 0 } ], "aim-head-transform": [ - { "rotateMix": 0.659, "translateMix": 0, "scaleMix": 0, "shearMix": 0 } + { "mixRotate": 0.659, "mixX": 0, "mixScaleX": 0, "mixShearY": 0 } ], "aim-torso-transform": [ - { "rotateMix": 0.423, "translateMix": 0, "scaleMix": 0, "shearMix": 0 } + { "mixRotate": 0.423, "mixX": 0, "mixScaleX": 0, "mixShearY": 0 } ] } }, + "asd": { + "bones": { + "head": { + "rotate": [ + { + "curve": [ 0.2, 43.23, 0.4, 86.46 ] + }, + { "time": 0.6, "value": 129.69 } + ] + } + } + }, "death": { "slots": { "eye": { @@ -969,19 +997,19 @@ "scale": [ { "time": 0.4667, - "curve": [ 0.469, 1, 0.492, 1.07, 0.475, 1.02, 0.492, 0.94 ] + "curve": [ 0.469, 1.005, 0.492, 1.065, 0.475, 1.018, 0.492, 0.94 ] }, { "time": 0.5, "x": 1.065, "y": 0.94, - "curve": [ 0.517, 1.07, 0.541, 0.99, 0.517, 0.94, 0.542, 1.03 ] + "curve": [ 0.517, 1.065, 0.541, 0.991, 0.517, 0.94, 0.542, 1.026 ] }, { "time": 0.5667, "x": 0.99, "y": 1.025, - "curve": [ 0.593, 0.99, 0.609, 1, 0.595, 1.02, 0.607, 1 ] + "curve": [ 0.593, 0.988, 0.609, 1.002, 0.595, 1.024, 0.607, 1.001 ] }, { "time": 0.6333 } ] @@ -2481,48 +2509,48 @@ { "x": 1.593, "y": 0.964, - "curve": [ 0.033, 1.59, 0.1, 1, 0.033, 0.96, 0.1, 0.71 ] + "curve": [ 0.033, 1.593, 0.1, 1, 0.033, 0.964, 0.1, 0.713 ] }, { "time": 0.1333, "y": 0.713, - "curve": [ 0.15, 1, 0.183, 1.77, 0.15, 0.71, 0.183, 0.88 ] + "curve": [ 0.15, 1, 0.183, 1.774, 0.15, 0.713, 0.183, 0.883 ] }, { "time": 0.2, "x": 1.774, "y": 0.883, - "curve": [ 0.242, 1.77, 0.325, 1.18, 0.242, 0.88, 0.325, 0.65 ] + "curve": [ 0.242, 1.774, 0.325, 1.181, 0.242, 0.883, 0.325, 0.649 ] }, { "time": 0.3667, "x": 1.181, "y": 0.649, - "curve": [ 0.408, 1.18, 0.492, 1.89, 0.408, 0.65, 0.492, 0.82 ] + "curve": [ 0.408, 1.181, 0.492, 1.893, 0.408, 0.649, 0.492, 0.819 ] }, { "time": 0.5333, "x": 1.893, "y": 0.819, - "curve": [ 0.558, 1.89, 0.608, 1.18, 0.558, 0.82, 0.608, 0.69 ] + "curve": [ 0.558, 1.893, 0.608, 1.18, 0.558, 0.819, 0.608, 0.686 ] }, { "time": 0.6333, "x": 1.18, "y": 0.686, - "curve": [ 0.658, 1.18, 0.708, 1.9, 0.658, 0.69, 0.708, 0.86 ] + "curve": [ 0.658, 1.18, 0.708, 1.903, 0.658, 0.686, 0.708, 0.855 ] }, { "time": 0.7333, "x": 1.903, "y": 0.855, - "curve": [ 0.767, 1.9, 0.833, 1.31, 0.767, 0.86, 0.833, 0.62 ] + "curve": [ 0.767, 1.903, 0.833, 1.311, 0.767, 0.855, 0.833, 0.622 ] }, { "time": 0.8667, "x": 1.311, "y": 0.622, - "curve": [ 0.9, 1.31, 0.967, 1.59, 0.9, 0.62, 0.967, 0.96 ] + "curve": [ 0.9, 1.311, 0.967, 1.593, 0.9, 0.622, 0.967, 0.964 ] }, { "time": 1, "x": 1.593, "y": 0.964 } ] @@ -2532,48 +2560,48 @@ { "x": 1.88, "y": 0.832, - "curve": [ 0.025, 1.88, 0.075, 1.31, 0.025, 0.83, 0.075, 0.69 ] + "curve": [ 0.025, 1.88, 0.075, 1.311, 0.025, 0.832, 0.075, 0.686 ] }, { "time": 0.1, "x": 1.311, "y": 0.686, - "curve": [ 0.133, 1.31, 0.2, 2.01, 0.133, 0.69, 0.208, 0.74 ] + "curve": [ 0.133, 1.311, 0.2, 2.01, 0.133, 0.686, 0.208, 0.736 ] }, { "time": 0.2333, "x": 2.01, "y": 0.769, - "curve": [ 0.267, 2.01, 0.333, 1, 0.282, 0.83, 0.333, 0.91 ] + "curve": [ 0.267, 2.01, 0.333, 1, 0.282, 0.831, 0.333, 0.91 ] }, { "time": 0.3667, "y": 0.91, - "curve": [ 0.4, 1, 0.467, 1.7, 0.4, 0.91, 0.474, 0.89 ] + "curve": [ 0.4, 1, 0.467, 1.699, 0.4, 0.91, 0.474, 0.891 ] }, { "time": 0.5, "x": 1.699, "y": 0.86, - "curve": [ 0.517, 1.7, 0.55, 1.18, 0.54, 0.81, 0.55, 0.71 ] + "curve": [ 0.517, 1.699, 0.55, 1.181, 0.54, 0.813, 0.55, 0.713 ] }, { "time": 0.5667, "x": 1.181, "y": 0.713, - "curve": [ 0.617, 1.18, 0.717, 1.88, 0.617, 0.71, 0.717, 0.8 ] + "curve": [ 0.617, 1.181, 0.717, 1.881, 0.617, 0.713, 0.717, 0.796 ] }, { "time": 0.7667, "x": 1.881, "y": 0.796, - "curve": [ 0.8, 1.88, 0.867, 1.3, 0.8, 0.8, 0.867, 0.65 ] + "curve": [ 0.8, 1.881, 0.867, 1.3, 0.8, 0.796, 0.867, 0.649 ] }, { "time": 0.9, "x": 1.3, "y": 0.649, - "curve": [ 0.925, 1.3, 0.975, 1.88, 0.925, 0.65, 0.975, 0.83 ] + "curve": [ 0.925, 1.3, 0.975, 1.88, 0.925, 0.649, 0.975, 0.832 ] }, { "time": 1, "x": 1.88, "y": 0.832 } ] @@ -2596,79 +2624,79 @@ { "x": 0.849, "y": 1.764, - "curve": [ 0.017, 0.85, 0.05, 0.83, 0.017, 1.76, 0.05, 2.03 ] + "curve": [ 0.017, 0.849, 0.05, 0.835, 0.017, 1.764, 0.05, 2.033 ] }, { "time": 0.0667, "x": 0.835, "y": 2.033, - "curve": [ 0.092, 0.83, 0.142, 0.75, 0.092, 2.03, 0.142, 1.58 ] + "curve": [ 0.092, 0.835, 0.142, 0.752, 0.092, 2.033, 0.142, 1.584 ] }, { "time": 0.1667, "x": 0.752, "y": 1.584, - "curve": [ 0.183, 0.75, 0.217, 0.81, 0.183, 1.58, 0.217, 1.71 ] + "curve": [ 0.183, 0.752, 0.217, 0.809, 0.183, 1.584, 0.217, 1.71 ] }, { "time": 0.2333, "x": 0.809, "y": 1.71, - "curve": [ 0.25, 0.81, 0.283, 0.72, 0.25, 1.71, 0.283, 1.45 ] + "curve": [ 0.25, 0.809, 0.283, 0.717, 0.25, 1.71, 0.283, 1.45 ] }, { "time": 0.3, "x": 0.717, "y": 1.45, - "curve": [ 0.317, 0.72, 0.35, 0.78, 0.317, 1.45, 0.35, 1.7 ] + "curve": [ 0.317, 0.717, 0.35, 0.777, 0.317, 1.45, 0.35, 1.698 ] }, { "time": 0.3667, "x": 0.777, "y": 1.698, - "curve": [ 0.4, 0.78, 0.45, 0.68, 0.375, 1.7, 0.45, 1.17 ] + "curve": [ 0.4, 0.781, 0.45, 0.685, 0.375, 1.698, 0.45, 1.173 ] }, { "time": 0.4667, "x": 0.685, "y": 1.173, - "curve": [ 0.492, 0.68, 0.542, 0.83, 0.492, 1.17, 0.542, 1.57 ] + "curve": [ 0.492, 0.685, 0.542, 0.825, 0.492, 1.173, 0.542, 1.572 ] }, { "time": 0.5667, "x": 0.825, "y": 1.572, - "curve": [ 0.611, 0.82, 0.63, 0.73, 0.611, 1.58, 0.606, 1.25 ] + "curve": [ 0.611, 0.816, 0.63, 0.727, 0.611, 1.577, 0.606, 1.255 ] }, { "time": 0.6667, "x": 0.725, "y": 1.241, - "curve": [ 0.692, 0.72, 0.742, 0.9, 0.692, 1.24, 0.749, 1.8 ] + "curve": [ 0.692, 0.725, 0.742, 0.895, 0.692, 1.241, 0.749, 1.799 ] }, { "time": 0.7667, "x": 0.895, "y": 1.857, - "curve": [ 0.783, 0.9, 0.796, 0.89, 0.796, 1.96, 0.817, 1.96 ] + "curve": [ 0.783, 0.895, 0.796, 0.892, 0.796, 1.955, 0.817, 1.962 ] }, { "time": 0.8333, "x": 0.845, "y": 1.962, - "curve": [ 0.845, 0.83, 0.883, 0.8, 0.85, 1.96, 0.872, 1.7 ] + "curve": [ 0.845, 0.831, 0.883, 0.802, 0.85, 1.962, 0.872, 1.704 ] }, { "time": 0.9, "x": 0.802, "y": 1.491, - "curve": [ 0.917, 0.8, 0.95, 0.84, 0.907, 1.44, 0.936, 1.51 ] + "curve": [ 0.917, 0.802, 0.95, 0.845, 0.907, 1.441, 0.936, 1.508 ] }, { "time": 0.9667, "x": 0.845, "y": 1.627, - "curve": [ 0.975, 0.84, 0.992, 0.85, 0.973, 1.65, 0.992, 1.76 ] + "curve": [ 0.975, 0.845, 0.992, 0.849, 0.973, 1.652, 0.992, 1.764 ] }, { "time": 1, "x": 0.849, "y": 1.764 } ] @@ -2691,61 +2719,61 @@ { "x": 0.845, "y": 1.31, - "curve": [ 0.017, 0.84, 0.117, 0.9, 0.017, 1.31, 0.117, 2.03 ] + "curve": [ 0.017, 0.845, 0.117, 0.899, 0.017, 1.31, 0.117, 2.033 ] }, { "time": 0.1333, "x": 0.899, "y": 2.033, - "curve": [ 0.15, 0.9, 0.183, 0.75, 0.15, 2.03, 0.183, 1.57 ] + "curve": [ 0.15, 0.899, 0.183, 0.752, 0.15, 2.033, 0.183, 1.574 ] }, { "time": 0.2, "x": 0.752, "y": 1.574, - "curve": [ 0.225, 0.75, 0.275, 0.81, 0.225, 1.57, 0.275, 1.71 ] + "curve": [ 0.225, 0.752, 0.275, 0.809, 0.225, 1.574, 0.275, 1.71 ] }, { "time": 0.3, "x": 0.809, "y": 1.71, - "curve": [ 0.317, 0.81, 0.35, 0.72, 0.317, 1.71, 0.35, 1.4 ] + "curve": [ 0.317, 0.809, 0.35, 0.717, 0.317, 1.71, 0.35, 1.397 ] }, { "time": 0.3667, "x": 0.717, "y": 1.397, - "curve": [ 0.383, 0.72, 0.417, 0.78, 0.383, 1.4, 0.417, 1.45 ] + "curve": [ 0.383, 0.717, 0.417, 0.777, 0.383, 1.397, 0.417, 1.45 ] }, { "time": 0.4333, "x": 0.777, "y": 1.45, - "curve": [ 0.45, 0.78, 0.496, 0.69, 0.45, 1.45, 0.481, 1.17 ] + "curve": [ 0.45, 0.777, 0.496, 0.689, 0.45, 1.45, 0.481, 1.168 ] }, { "time": 0.5333, "x": 0.685, "y": 1.173, - "curve": [ 0.565, 0.68, 0.617, 0.76, 0.575, 1.18, 0.617, 1.3 ] + "curve": [ 0.565, 0.682, 0.617, 0.758, 0.575, 1.177, 0.617, 1.297 ] }, { "time": 0.6333, "x": 0.758, "y": 1.297, - "curve": [ 0.658, 0.76, 0.708, 0.72, 0.658, 1.3, 0.708, 1.24 ] + "curve": [ 0.658, 0.758, 0.708, 0.725, 0.658, 1.297, 0.708, 1.241 ] }, { "time": 0.7333, "x": 0.725, "y": 1.241, - "curve": [ 0.772, 0.73, 0.796, 0.89, 0.782, 1.24, 0.778, 1.85 ] + "curve": [ 0.772, 0.732, 0.796, 0.893, 0.782, 1.238, 0.778, 1.854 ] }, { "time": 0.8333, "x": 0.895, "y": 1.857, - "curve": [ 0.878, 0.9, 0.992, 0.84, 0.88, 1.86, 0.992, 1.31 ] + "curve": [ 0.878, 0.9, 0.992, 0.845, 0.88, 1.86, 0.992, 1.31 ] }, { "time": 1, "x": 0.845, "y": 1.31 } ] @@ -2900,49 +2928,49 @@ { "x": 1.882, "y": 0.81, - "curve": [ 0.017, 1.88, 0.167, 1.3, 0.017, 0.81, 0.167, 0.65 ] + "curve": [ 0.017, 1.882, 0.167, 1.3, 0.017, 0.81, 0.167, 0.649 ] }, { "time": 0.2, "x": 1.3, "y": 0.649, - "curve": [ 0.225, 1.3, 0.275, 2.05, 0.225, 0.65, 0.275, 0.98 ] + "curve": [ 0.225, 1.3, 0.275, 2.051, 0.225, 0.649, 0.275, 0.984 ] }, { "time": 0.3, "x": 2.051, "y": 0.984, - "curve": [ 0.325, 2.05, 0.375, 1.31, 0.325, 0.98, 0.384, 0.72 ] + "curve": [ 0.325, 2.051, 0.375, 1.311, 0.325, 0.984, 0.384, 0.715 ] }, { "time": 0.4, "x": 1.311, "y": 0.686, - "curve": [ 0.433, 1.31, 0.5, 1.86, 0.426, 0.64, 0.5, 0.54 ] + "curve": [ 0.433, 1.311, 0.5, 1.86, 0.426, 0.638, 0.5, 0.537 ] }, { "time": 0.5333, "x": 1.86, "y": 0.537, - "curve": [ 0.567, 1.86, 0.633, 1.19, 0.567, 0.54, 0.604, 0.85 ] + "curve": [ 0.567, 1.86, 0.633, 1.187, 0.567, 0.537, 0.604, 0.854 ] }, { "time": 0.6667, "x": 1.187, "y": 0.854, - "curve": [ 0.7, 1.19, 0.767, 1.55, 0.707, 0.85, 0.774, 0.78 ] + "curve": [ 0.7, 1.187, 0.767, 1.549, 0.707, 0.854, 0.774, 0.775 ] }, { "time": 0.8, "x": 1.549, "y": 0.746, - "curve": [ 0.817, 1.55, 0.85, 1.18, 0.815, 0.73, 0.85, 0.71 ] + "curve": [ 0.817, 1.549, 0.85, 1.181, 0.815, 0.729, 0.85, 0.713 ] }, { "time": 0.8667, "x": 1.181, "y": 0.713, - "curve": [ 0.9, 1.18, 0.967, 1.88, 0.9, 0.71, 0.967, 0.81 ] + "curve": [ 0.9, 1.181, 0.967, 1.882, 0.9, 0.713, 0.967, 0.81 ] }, { "time": 1, "x": 1.882, "y": 0.81 } ] @@ -3458,13 +3486,13 @@ }, "transform": { "front-foot-board-transform": [ - { "rotateMix": 0.997 } + { "mixRotate": 0.997 } ], "rear-foot-board-transform": [ {} ], "toes-board": [ - { "translateMix": 0, "scaleMix": 0, "shearMix": 0 } + { "mixX": 0, "mixScaleX": 0, "mixShearY": 0 } ] }, "deform": { @@ -4009,13 +4037,13 @@ "scale": [ { "x": 0.94, - "curve": [ 0, 0.96, 0.024, 1.24, 0, 1, 0.026, 0.95 ] + "curve": [ 0, 0.962, 0.024, 1.237, 0, 1, 0.026, 0.947 ] }, { "time": 0.0667, "x": 1.236, "y": 0.947, - "curve": [ 0.117, 1.24, 0.189, 1, 0.117, 0.95, 0.189, 1 ] + "curve": [ 0.117, 1.235, 0.189, 1, 0.117, 0.947, 0.189, 1 ] }, { "time": 0.2667 } ] @@ -4578,31 +4606,31 @@ ], "scale": [ { - "curve": [ 0.041, 1, 0.052, 0.96, 0.041, 1, 0.052, 1.14 ] + "curve": [ 0.041, 1, 0.052, 0.962, 0.041, 1, 0.052, 1.137 ] }, { "time": 0.1, "x": 0.954, "y": 1.137, - "curve": [ 0.202, 0.96, 0.318, 1, 0.202, 1.14, 0.252, 1 ] + "curve": [ 0.202, 0.962, 0.318, 1, 0.202, 1.137, 0.252, 1.002 ] }, { "time": 0.4667 }, { "time": 1.0667, "x": 1.002, - "curve": [ 1.092, 1, 1.126, 1.14, 1.092, 1, 1.128, 0.97 ] + "curve": [ 1.092, 1.002, 1.126, 1.143, 1.092, 1, 1.128, 0.975 ] }, { "time": 1.1667, "x": 1.144, "y": 0.973, - "curve": [ 1.204, 1.14, 1.233, 0.96, 1.206, 0.97, 1.227, 1.06 ] + "curve": [ 1.204, 1.145, 1.233, 0.959, 1.206, 0.972, 1.227, 1.062 ] }, { "time": 1.2667, "x": 0.958, "y": 1.063, - "curve": [ 1.284, 0.96, 1.292, 1, 1.288, 1.06, 1.288, 1 ] + "curve": [ 1.284, 0.958, 1.292, 1.001, 1.288, 1.063, 1.288, 1.001 ] }, { "time": 1.3333 } ] @@ -5323,55 +5351,55 @@ { "x": 0.003, "y": 0.006, - "curve": [ 0.329, 0.04, 0.347, 0.12, 0.329, 0.1, 0.37, 0.25 ] + "curve": [ 0.329, 0.044, 0.347, 0.117, 0.329, 0.097, 0.37, 0.249 ] }, { "time": 0.4, "x": 0.175, "y": 0.387, - "curve": [ 0.63, 0.62, 0.663, 0.72, 0.609, 1.34, 0.645, 1.52 ] + "curve": [ 0.63, 0.619, 0.663, 0.723, 0.609, 1.338, 0.645, 1.524 ] }, { "time": 0.7333, "x": 0.724, "y": 1.52, - "curve": [ 0.798, 0.72, 0.907, 0.65, 0.797, 1.52, 0.895, 1.42 ] + "curve": [ 0.798, 0.725, 0.907, 0.647, 0.797, 1.517, 0.895, 1.424 ] }, { "time": 1, "x": 0.645, "y": 1.426, - "curve": [ 1.095, 0.64, 1.139, 0.69, 1.089, 1.43, 1.115, 1.51 ] + "curve": [ 1.095, 0.643, 1.139, 0.688, 1.089, 1.428, 1.115, 1.513 ] }, { "time": 1.2333, "x": 0.685, "y": 1.516, - "curve": [ 1.325, 0.68, 1.508, 0.64, 1.343, 1.52, 1.467, 1.4 ] + "curve": [ 1.325, 0.683, 1.508, 0.636, 1.343, 1.518, 1.467, 1.4 ] }, { "time": 1.6, "x": 0.634, "y": 1.401, - "curve": [ 1.728, 0.63, 1.946, 0.69, 1.722, 1.4, 1.924, 1.52 ] + "curve": [ 1.728, 0.631, 1.946, 0.687, 1.722, 1.402, 1.924, 1.522 ] }, { "time": 2.0667, "x": 0.688, "y": 1.522, - "curve": [ 2.189, 0.69, 2.289, 0.65, 2.142, 1.52, 2.265, 1.42 ] + "curve": [ 2.189, 0.69, 2.289, 0.649, 2.142, 1.522, 2.265, 1.417 ] }, { "time": 2.4, "x": 0.65, "y": 1.426, - "curve": [ 2.494, 0.65, 2.504, 0.77, 2.508, 1.43, 2.543, 1.57 ] + "curve": [ 2.494, 0.651, 2.504, 0.766, 2.508, 1.434, 2.543, 1.566 ] }, { "time": 2.6, "x": 0.766, "y": 1.568, - "curve": [ 2.73, 0.76, 3.006, 0.1, 2.767, 1.56, 2.997, 0.1 ] + "curve": [ 2.73, 0.765, 3.006, 0.098, 2.767, 1.564, 2.997, 0.1 ] }, { "time": 3.0333, "x": 0.007, "y": 0.015 } ] @@ -5420,19 +5448,19 @@ ], "scale": [ { - "curve": [ 0.167, 1, 0.5, 1.05, 0.167, 1, 0.5, 1.05 ] + "curve": [ 0.167, 1, 0.5, 1.053, 0.167, 1, 0.5, 1.053 ] }, { "time": 0.6667, "x": 1.053, "y": 1.053, - "curve": [ 0.833, 1.05, 1.167, 0.99, 0.833, 1.05, 1.167, 0.99 ] + "curve": [ 0.833, 1.053, 1.167, 0.986, 0.833, 1.053, 1.167, 0.986 ] }, { "time": 1.3333, "x": 0.986, "y": 0.986, - "curve": [ 1.5, 0.99, 1.833, 1.05, 1.5, 0.99, 1.833, 1.05 ] + "curve": [ 1.5, 0.986, 1.833, 1.053, 1.5, 0.986, 1.833, 1.053 ] }, { "time": 2, "x": 1.053, "y": 1.053 } ] @@ -5451,25 +5479,25 @@ { "x": 1.014, "y": 1.014, - "curve": [ 0.229, 0.91, 0.501, 0.76, 0.242, 0.89, 0.502, 0.77 ] + "curve": [ 0.229, 0.909, 0.501, 0.755, 0.242, 0.892, 0.502, 0.768 ] }, { "time": 0.8667, "x": 0.745, "y": 0.745, - "curve": [ 1.282, 0.73, 2.021, 0.7, 1.27, 0.72, 2.071, 0.71 ] + "curve": [ 1.282, 0.733, 2.021, 0.699, 1.27, 0.719, 2.071, 0.709 ] }, { "time": 2.2, "x": 0.7, "y": 0.704, - "curve": [ 2.315, 0.7, 2.421, 0.79, 2.311, 0.7, 2.485, 0.8 ] + "curve": [ 2.315, 0.7, 2.421, 0.794, 2.311, 0.701, 2.485, 0.797 ] }, { "time": 2.5667, "x": 0.794, "y": 0.794, - "curve": [ 2.734, 0.79, 2.99, 0.32, 2.714, 0.79, 3.019, 0.34 ] + "curve": [ 2.734, 0.794, 2.99, 0.323, 2.714, 0.789, 3.019, 0.341 ] }, { "time": 3.1667, "x": 0, "y": 0 } ] @@ -5759,19 +5787,19 @@ "scale": [ { "time": 1.3333, - "curve": [ 1.392, 1, 1.526, 1, 1.392, 1, 1.508, 1.04 ] + "curve": [ 1.392, 1, 1.526, 1, 1.392, 1, 1.508, 1.043 ] }, { "time": 1.5667, "x": 0.992, "y": 1.043, - "curve": [ 1.598, 0.99, 1.676, 0.95, 1.584, 1.04, 1.672, 1.04 ] + "curve": [ 1.598, 0.985, 1.676, 0.955, 1.584, 1.043, 1.672, 1.04 ] }, { "time": 1.7333, "x": 0.954, "y": 1.029, - "curve": [ 1.843, 0.95, 1.933, 1, 1.825, 1.01, 1.933, 1 ] + "curve": [ 1.843, 0.954, 1.933, 1, 1.825, 1.013, 1.933, 1 ] }, { "time": 2 } ] @@ -6205,25 +6233,25 @@ "time": 1.1, "x": 0.805, "y": 0.805, - "curve": [ 1.119, 0.76, 1.16, 1.16, 1.117, 0.81, 1.15, 0.61 ] + "curve": [ 1.119, 0.763, 1.16, 1.162, 1.117, 0.805, 1.15, 0.605 ] }, { "time": 1.1667, "x": 1.279, "y": 0.605, - "curve": [ 1.177, 1.47, 1.192, 2.15, 1.175, 0.61, 1.192, 0.91 ] + "curve": [ 1.177, 1.47, 1.192, 2.151, 1.175, 0.605, 1.192, 0.911 ] }, { "time": 1.2, "x": 2.151, "y": 0.911, - "curve": [ 1.208, 2.15, 1.231, 1.67, 1.208, 0.91, 1.227, 0.84 ] + "curve": [ 1.208, 2.151, 1.231, 1.668, 1.208, 0.911, 1.227, 0.844 ] }, { "time": 1.2333, "x": 1.608, "y": 0.805, - "curve": [ 1.249, 1.2, 1.283, 0.55, 1.254, 0.69, 1.283, 0.42 ] + "curve": [ 1.249, 1.205, 1.283, 0.547, 1.254, 0.685, 1.283, 0.416 ] }, { "time": 1.3, "x": 0.547, "y": 0.416 } ], @@ -6819,35 +6847,35 @@ ], "scale": [ { - "curve": [ 0.014, 1, 0.068, 0.99, 0.027, 1.01, 0.083, 1.01 ] + "curve": [ 0.014, 0.996, 0.068, 0.991, 0.027, 1.005, 0.083, 1.012 ] }, { "time": 0.1, "x": 0.991, "y": 1.012, - "curve": [ 0.128, 0.99, 0.205, 1.02, 0.128, 1.01, 0.197, 0.99 ] + "curve": [ 0.128, 0.991, 0.205, 1.018, 0.128, 1.012, 0.197, 0.988 ] }, { "time": 0.2333, "x": 1.018, "y": 0.988, - "curve": [ 0.272, 1.02, 0.305, 1.01, 0.262, 0.99, 0.311, 0.99 ] + "curve": [ 0.272, 1.018, 0.305, 1.008, 0.262, 0.988, 0.311, 0.995 ] }, { "time": 0.3333, - "curve": [ 0.351, 1, 0.417, 0.99, 0.359, 1.01, 0.417, 1.01 ] + "curve": [ 0.351, 0.995, 0.417, 0.987, 0.359, 1.006, 0.417, 1.013 ] }, { "time": 0.4333, "x": 0.987, "y": 1.013, - "curve": [ 0.467, 0.99, 0.533, 1.02, 0.467, 1.01, 0.533, 0.99 ] + "curve": [ 0.467, 0.987, 0.533, 1.02, 0.467, 1.013, 0.533, 0.989 ] }, { "time": 0.5667, "x": 1.02, "y": 0.989, - "curve": [ 0.592, 1.02, 0.652, 1, 0.592, 0.99, 0.644, 1 ] + "curve": [ 0.592, 1.02, 0.652, 1.004, 0.592, 0.989, 0.644, 0.996 ] }, { "time": 0.6667 } ] @@ -7518,7 +7546,7 @@ "scale": [ { "x": 0.844, - "curve": [ 0.067, 0.84, 0.2, 1, 0.067, 1, 0.2, 1 ] + "curve": [ 0.067, 0.844, 0.2, 1, 0.067, 1, 0.2, 1 ] }, { "time": 0.2667 } ] @@ -7563,7 +7591,7 @@ { "x": 0.963, "y": 1.074, - "curve": [ 0.067, 0.96, 0.132, 1, 0.067, 1.07, 0.132, 1 ] + "curve": [ 0.067, 0.963, 0.132, 1, 0.067, 1.074, 0.132, 1 ] }, { "time": 0.2667 } ] @@ -7674,7 +7702,7 @@ "shoot": { "slots": { "muzzle": { - "color": [ + "rgba": [ { "time": 0.1333, "color": "ffffffff" }, { "time": 0.2, "color": "ffffff62" } ], @@ -7688,7 +7716,7 @@ ] }, "muzzle-glow": { - "color": [ + "rgba": [ { "color": "ff0c0c00" }, { "time": 0.0333, @@ -7703,7 +7731,7 @@ ] }, "muzzle-ring": { - "color": [ + "rgba": [ { "time": 0.0333, "color": "d8baffff", @@ -7717,7 +7745,7 @@ ] }, "muzzle-ring2": { - "color": [ + "rgba": [ { "time": 0.0333, "color": "d8baffff", @@ -7731,7 +7759,7 @@ ] }, "muzzle-ring3": { - "color": [ + "rgba": [ { "time": 0.0333, "color": "d8baffff", @@ -7745,7 +7773,7 @@ ] }, "muzzle-ring4": { - "color": [ + "rgba": [ { "time": 0.0333, "color": "d8baffff", @@ -7859,29 +7887,45 @@ } }, "walk": { + "slots": { + "goggles": { + "rgb2": [ + { "light": "ffffffff", "dark": "000000" } + ] + }, + "neck": { + "alpha": [ + { "value": 0.70425653 } + ] + }, + "torso": { + "rgba2": [ + { "light": "ffffffff", "dark": "000000" } + ] + } + }, "bones": { "rear-foot-target": { "rotate": [ { "value": -32.82, - "curve": [ 0.035, -42.69, 0.057, -70.49 ] + "curve": [ 0.035, -42.69, 0.151, -81.58 ] }, { - "time": 0.1, + "time": 0.2, "value": -70.59, - "curve": [ 0.236, -70.78, 0.335, -9.87 ] + "curve": [ 0.26, -57.2, 0.29, -46.41 ] }, { "time": 0.3667, - "value": -1.56, - "curve": [ 0.393, 5.5, 0.477, 13.96 ] + "value": -32.82, + "curve": [ 0.419, -23.57, 0.522, -8 ] }, { - "time": 0.5, - "value": 13.96, - "curve": [ 0.519, 13.96, 0.508, 0.13 ] + "time": 0.5667, + "value": -8, + "curve": [ 0.586, -8, 0.678, -0.42 ] }, - { "time": 0.5667, "value": -0.28 }, { "time": 0.7333, "value": -0.28, @@ -8143,35 +8187,35 @@ ], "scale": [ { - "curve": [ 0.039, 1, 0.084, 0.99, 0.039, 1, 0.084, 1.02 ] + "curve": [ 0.039, 1, 0.084, 0.991, 0.039, 1, 0.084, 1.019 ] }, { "time": 0.1333, "x": 0.991, "y": 1.019, - "curve": [ 0.205, 0.99, 0.318, 1.02, 0.205, 1.02, 0.337, 0.99 ] + "curve": [ 0.205, 0.991, 0.318, 1.019, 0.205, 1.019, 0.337, 0.992 ] }, { "time": 0.4, "x": 1.019, "y": 0.992, - "curve": [ 0.456, 1.02, 0.494, 1, 0.483, 0.99, 0.493, 1 ] + "curve": [ 0.456, 1.019, 0.494, 1.001, 0.483, 0.991, 0.493, 0.999 ] }, { "time": 0.5, - "curve": [ 0.508, 1, 0.584, 0.99, 0.51, 1, 0.584, 1.02 ] + "curve": [ 0.508, 0.998, 0.584, 0.991, 0.51, 1.002, 0.584, 1.019 ] }, { "time": 0.6333, "x": 0.991, "y": 1.019, - "curve": [ 0.705, 0.99, 0.818, 1.02, 0.705, 1.02, 0.837, 0.99 ] + "curve": [ 0.705, 0.991, 0.818, 1.019, 0.705, 1.019, 0.837, 0.992 ] }, { "time": 0.9, "x": 1.019, "y": 0.992, - "curve": [ 0.956, 1.02, 0.955, 1, 0.983, 0.99, 0.955, 1 ] + "curve": [ 0.956, 1.019, 0.955, 1, 0.983, 0.991, 0.955, 1 ] }, { "time": 1 } ] @@ -8563,11 +8607,6 @@ { "time": 1 } ] }, - "crosshair": { - "rotate": [ - { "time": 0.2333, "value": 0.11 } - ] - }, "gun-tip": { "rotate": [ { "time": 0.2333, "value": 0.11 } @@ -8683,6 +8722,25 @@ { "time": 1, "softness": 5, "bendPositive": false } ] }, + "deform": { + "default": { + "head": { + "head": [ + { + "time": 0.0333, + "offset": 110, + "vertices": [ 18.03424, 70.80995 ], + "curve": [ 0.144, 0, 0.256, 1 ] + }, + { + "time": 0.3667, + "offset": 112, + "vertices": [ 54.05032, 20.34738, 32.97116, 47.4165, 54.05035, 20.34744 ] + } + ] + } + } + }, "events": [ { "name": "footstep" }, { "time": 0.5, "name": "footstep" } diff --git a/spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAssetManagerTest.java b/spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAssetManagerTest.java new file mode 100644 index 000000000..85eb6137b --- /dev/null +++ b/spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/SkeletonAssetManagerTest.java @@ -0,0 +1,130 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated January 1, 2020. Replaces all prior versions. + * + * Copyright (c) 2013-2020, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, + * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +package com.esotericsoftware.spine; + +import com.badlogic.gdx.ApplicationAdapter; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.assets.AssetManager; +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; + +import com.esotericsoftware.spine.utils.SkeletonDataLoader; +import com.esotericsoftware.spine.utils.SkeletonDataLoader.SkeletonDataParameter; + +/** Like {@link SimpleTest1}, but using {@link AssetManager} to load the atlas and skeleton data. */ +public class SkeletonAssetManagerTest extends ApplicationAdapter { + OrthographicCamera camera; + PolygonSpriteBatch batch; + SkeletonRenderer renderer; + SkeletonRendererDebug debugRenderer; + + AssetManager assetManager; + TextureAtlas atlas; + Skeleton skeleton; + AnimationState state; + + public void create () { + camera = new OrthographicCamera(); + batch = new PolygonSpriteBatch(); + renderer = new SkeletonRenderer(); + renderer.setPremultipliedAlpha(true); // PMA results in correct blending without outlines. + debugRenderer = new SkeletonRendererDebug(); + debugRenderer.setBoundingBoxes(false); + debugRenderer.setRegionAttachments(false); + + assetManager = new AssetManager(); + assetManager.setLoader(SkeletonData.class, new SkeletonDataLoader(assetManager.getFileHandleResolver())); + + float scale = 0.6f; + assetManager.load("spineboy/spineboy-pro.json", SkeletonData.class, + new SkeletonDataParameter("spineboy/spineboy-pma.atlas", scale)); + } + + public void render () { + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + + if (skeleton == null) { + // Not loaded yet. + assetManager.update(); + // System.out.println(assetManager.getDiagnostics()); + if (!assetManager.isFinished()) return; + + // Assets are ready, set things up using them. + SkeletonData skeletonData = assetManager.get("spineboy/spineboy-pro.json"); + + skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc). + skeleton.setPosition(250, 20); + + AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines mixing (crossfading) between + // animations. + stateData.setMix("run", "jump", 0.2f); + stateData.setMix("jump", "run", 0.2f); + + state = new AnimationState(stateData); // Holds the animation state for a skeleton (current animation, time, etc). + state.setTimeScale(0.5f); // Slow all animations down to 50% speed. + + // Queue animations on track 0. + state.setAnimation(0, "run", true); + state.addAnimation(0, "jump", false, 2); // Jump after 2 seconds. + state.addAnimation(0, "run", true, 0); // Run after the jump. + } + + state.update(Gdx.graphics.getDeltaTime()); // Update the animation time. + + state.apply(skeleton); // Poses skeleton using current animations. This sets the bones' local SRT. + skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT. + + // Configure the camera, SpriteBatch, and SkeletonRendererDebug. + camera.update(); + batch.getProjectionMatrix().set(camera.combined); + debugRenderer.getShapeRenderer().setProjectionMatrix(camera.combined); + + batch.begin(); + renderer.draw(batch, skeleton); // Draw the skeleton images. + batch.end(); + + debugRenderer.draw(skeleton); // Draw debug lines. + } + + public void resize (int width, int height) { + camera.setToOrtho(false); // Update camera with new size. + } + + public void dispose () { + assetManager.dispose(); + } + + public static void main (String[] args) throws Exception { + new LwjglApplication(new SkeletonAssetManagerTest()); + } +}