|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html>
|
| 3 | + |
3 | 4 | <head>
|
4 | 5 | <meta charset="UTF-8">
|
5 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14 | 15 |
|
15 | 16 | <body>
|
16 | 17 | <canvas id="canvas" style="position: absolute; width: 100%; height: 100%;"></canvas>
|
| 18 | + <span id="isPma" style="position: absolute; color: #22cc22"></span> |
17 | 19 | <script>
|
| 20 | + const pma = true; |
| 21 | + document.querySelector("#isPma").innerText = "PMA: " + pma; |
18 | 22 | class App {
|
19 | 23 | constructor() {
|
20 | 24 | this.skeleton = null;
|
|
23 | 27 |
|
24 | 28 | loadAssets(canvas) {
|
25 | 29 | // Load the skeleton file.
|
26 |
| - canvas.assetManager.loadJson("assets/orange.json"); |
| 30 | + canvas.assetManager.loadJson(`assets/orange${pma ? "-pma" : ""}.json`); |
27 | 31 | // Load the atlas and its pages.
|
28 |
| - canvas.assetManager.loadTextureAtlas("assets/orange.atlas"); |
| 32 | + canvas.assetManager.loadTextureAtlas(`assets/orange${pma ? "-pma" : ""}.atlas`); |
29 | 33 | }
|
30 | 34 |
|
31 | 35 | initialize(canvas) {
|
32 | 36 | let assetManager = canvas.assetManager;
|
33 | 37 |
|
34 | 38 | // Create the texture atlas.
|
35 |
| - var atlas = assetManager.require("assets/orange.atlas"); |
| 39 | + var atlas = assetManager.require(`assets/orange${pma ? "-pma" : ""}.atlas`); |
36 | 40 |
|
37 | 41 | // Create a AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
|
38 | 42 | var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
|
|
42 | 46 |
|
43 | 47 | // Set the scale to apply during parsing, parse the file, and create a new skeleton.
|
44 | 48 | skeletonBinary.scale = 8;
|
45 |
| - var skeletonData = skeletonBinary.readSkeletonData(assetManager.require("assets/orange.json")); |
| 49 | + var skeletonData = skeletonBinary.readSkeletonData(assetManager.require(`assets/orange${pma ? "-pma" : ""}.json`)); |
46 | 50 | this.skeleton = new spine.Skeleton(skeletonData);
|
47 | 51 |
|
48 | 52 | // Create an AnimationState, and set the "cape-follow-example" animation in looping mode.
|
|
72 | 76 | // Begin rendering.
|
73 | 77 | renderer.begin();
|
74 | 78 | // Draw the skeleton
|
75 |
| - renderer.drawSkeleton(this.skeleton, true); |
| 79 | + renderer.drawSkeleton(this.skeleton, pma); |
76 | 80 | // Complete rendering.
|
77 | 81 | renderer.end();
|
78 | 82 | }
|
|
0 commit comments