@urso/core 0.9.5-dev → 0.9.6-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.9.5-dev",
3
+ "version": "0.9.6-dev",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -39,12 +39,15 @@ class LibCache {
39
39
  const atlas = atlases[key];
40
40
  const page = new spine.TextureAtlasPage(key);
41
41
  const { w, h } = atlas.data.meta.size;
42
- const scale = (parseFloat(atlas.data.meta.scale) || 1);
43
-
42
+
44
43
  const baseTexture = new spine.SpineTexture(atlas.textureSource);
45
44
 
46
- page.width = w;
47
- page.height = h;
45
+ // Use actual texture dimensions for page (may differ from meta.size due to resolution scaling)
46
+ const texW = atlas.textureSource.pixelWidth || atlas.textureSource.source?.pixelWidth || w;
47
+ const texH = atlas.textureSource.pixelHeight || atlas.textureSource.source?.pixelHeight || h;
48
+
49
+ page.width = texW;
50
+ page.height = texH;
48
51
  page.texture = baseTexture;
49
52
  page.minFilter = page.magFilter = 9729;
50
53
  page.uWrap = page.vWrap = 33071;
@@ -60,45 +63,33 @@ class LibCache {
60
63
  const frame = atlas.data.frames[frameName];
61
64
  const region = new spine.TextureAtlasRegion(page, normalizedName);
62
65
 
63
- // Denominators for UVs: use page (atlas image) dimensions
64
- const denomW = page.width;
65
- const denomH = page.height;
66
-
67
66
  // Check if frame is rotated (TexturePacker boolean or 90 marker)
68
67
  const isRotated = frame.rotated === true || frame.rotated === 90;
69
-
68
+
70
69
  // Frame rect in the atlas (pixels)
71
70
  const fx = frame.frame.x;
72
71
  const fy = frame.frame.y;
73
72
  const fw = frame.frame.w;
74
73
  const fh = frame.frame.h;
74
+
75
+ // Region size (swap on rotation)
76
+ region.width = isRotated ? fh : fw;
77
+ region.height = isRotated ? fw : fh;
78
+
79
+ region.u = fx / texW;
80
+ region.v = fy / texH;
81
+ region.u2 = (fx + fw) / texW;
82
+ region.v2 = (fy + fh) / texH;
83
+ region.degrees = isRotated ? 90 : 0;
75
84
 
76
- // Region size (swap on rotation), divided by scale
77
- region.width = (isRotated ? fh : fw) / scale;
78
- region.height = (isRotated ? fw : fh) / scale;
79
-
80
- if (isRotated) {
81
- region.u = fx / denomW;
82
- region.v = fy / denomH;
83
- region.u2 = (fx + fh) / denomW; // swapped
84
- region.v2 = (fy + fw) / denomH; // swapped
85
- region.degrees = 90;
86
- } else {
87
- region.u = fx / denomW;
88
- region.v = fy / denomH;
89
- region.u2 = (fx + fw) / denomW;
90
- region.v2 = (fy + fh) / denomH;
91
- region.degrees = 0;
92
- }
93
-
94
- // Original (untrimmed) size divided by scale
95
- region.originalWidth = frame.sourceSize.w / scale;
96
- region.originalHeight = frame.sourceSize.h / scale;
97
-
98
- // Offsets relative to original rect (bottom-left), divided by scale
85
+ // Original (untrimmed) size - already at export scale in JSON
86
+ region.originalWidth = frame.sourceSize.w;
87
+ region.originalHeight = frame.sourceSize.h;
88
+
89
+ // Offsets relative to original rect (bottom-left)
99
90
  if (frame.spriteSourceSize) {
100
- region.offsetX = frame.spriteSourceSize.x / scale;
101
- region.offsetY = (frame.sourceSize.h - frame.spriteSourceSize.y - frame.spriteSourceSize.h) / scale;
91
+ region.offsetX = frame.spriteSourceSize.x;
92
+ region.offsetY = frame.sourceSize.h - frame.spriteSourceSize.y - frame.spriteSourceSize.h;
102
93
  } else {
103
94
  region.offsetX = 0;
104
95
  region.offsetY = 0;
@@ -1,15 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "WebFetch(domain:pixijs.com)",
5
- "WebFetch(domain:pixijs.download)",
6
- "WebFetch(domain:github.com)",
7
- "WebFetch(domain:www.npmjs.com)",
8
- "Bash(npm run build:prod:*)",
9
- "Bash(npm run dev:*)",
10
- "Bash(npm run test:*)",
11
- "WebFetch(domain:esotericsoftware.com)"
12
- ],
13
- "deny": []
14
- }
15
- }