@nodecraft/rendermite 1.0.6 → 1.0.7

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.
Files changed (46) hide show
  1. package/dist/{blend-CyDIxCne.d.ts → blend-CEHoJ7tM.d.ts} +2 -1
  2. package/dist/{blend-CHP2-j9U.js → blend-D0XWgVQr.js} +20 -8
  3. package/dist/cli.js +1 -1
  4. package/dist/{compose-CQCb2LVv.js → compose-lWPrB7wh.js} +1 -1
  5. package/dist/{encode-DaNQF28M.d.ts → encode-CaSK8-mi.d.ts} +1 -1
  6. package/dist/{encode-D6dQu2dJ.js → encode-Df_tWzkl.js} +28 -12
  7. package/dist/{entity-fallback-BRCeGKBT.js → entity-fallback-D9QTGU9X.js} +1 -1
  8. package/dist/{face-BIYg14TE.d.ts → face-C49L66sQ.d.ts} +2 -2
  9. package/dist/{face-DmCiHUd5.js → face-Cl1O4m2i.js} +1 -1
  10. package/dist/{geo-Diky41Tw.js → geo-DHiWBa-C.js} +3 -3
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.js +4 -4
  13. package/dist/output/encode.d.ts +1 -1
  14. package/dist/output/encode.js +1 -1
  15. package/dist/{pipeline-BIk1RRIp.js → pipeline-Da2Kavba.js} +5 -5
  16. package/dist/{pipeline-zq-yU3Te.d.ts → pipeline-HiA3DC71.d.ts} +2 -2
  17. package/dist/{rasterizer-yqJkicm1.d.ts → rasterizer-B9ZGJI3-.d.ts} +1 -1
  18. package/dist/render/blend.d.ts +1 -1
  19. package/dist/render/blend.js +1 -1
  20. package/dist/render/compose.d.ts +2 -2
  21. package/dist/render/compose.js +1 -1
  22. package/dist/render/entity-fallback.d.ts +3 -3
  23. package/dist/render/entity-fallback.js +1 -1
  24. package/dist/render/face.d.ts +1 -1
  25. package/dist/render/face.js +1 -1
  26. package/dist/render/geo.d.ts +2 -2
  27. package/dist/render/geo.js +1 -1
  28. package/dist/render/legacy-tints.d.ts +1 -1
  29. package/dist/render/obj.d.ts +2 -2
  30. package/dist/render/obj.js +1 -1
  31. package/dist/render/pipeline.d.ts +1 -1
  32. package/dist/render/pipeline.js +1 -1
  33. package/dist/render/rasterizer.d.ts +1 -1
  34. package/dist/render/renderer.d.ts +1 -1
  35. package/dist/render/renderer.js +1 -1
  36. package/dist/render/tints.d.ts +1 -1
  37. package/dist/{renderer-DVsZHAvf.d.ts → renderer-B20ssjRm.d.ts} +2 -2
  38. package/dist/{renderer-CjT19tHd.js → renderer-gQW_I7YG.js} +18 -12
  39. package/dist/{run-BnICOF4I.js → run-B0qPw3zf.js} +2 -2
  40. package/dist/{run-CKUtynTy.d.ts → run-CT3VtFqg.d.ts} +1 -1
  41. package/dist/run.d.ts +1 -1
  42. package/dist/run.js +1 -1
  43. package/dist/{tints-DLBExVWN.d.ts → tints-BH9l0ND0.d.ts} +1 -1
  44. package/dist/workers/render-worker.d.ts +1 -1
  45. package/dist/workers/render-worker.js +1 -1
  46. package/package.json +1 -1
@@ -19,7 +19,8 @@ declare function q16(value: number): number;
19
19
  /**
20
20
  * Source-over with straight alpha, in place on `dst` at `offset`:
21
21
  * ra = 1-(1-sa)(1-da); rc = (sc*sa + dc*da*(1-sa)) / ra; rgb = 0 when ra = 0.
22
- * Results are Q16-quantized like every Imagick pixel write.
22
+ * Results are Q16-quantized like every Imagick pixel write. q16 is inlined
23
+ * here because blendPixel is the single hottest function in the pipeline.
23
24
  */
24
25
  declare function blendPixel(dst: Float64Array, offset: number, sr: number, sg: number, sb: number, sa: number): void;
25
26
  /**
@@ -1,4 +1,6 @@
1
1
  //#region src/render/blend.ts
2
+ /** Lookup table for Q16 → 8-bit conversion (ImageMagick's floor(q/257)). */
3
+ const BYTE_LUT = /* @__PURE__ */ new Uint8Array(65536);
2
4
  function toFloatTexture(texture) {
3
5
  const data = new Float64Array(texture.data.length);
4
6
  for (let i = 0; i < texture.data.length; i++) data[i] = texture.data[i] / 255;
@@ -10,9 +12,11 @@ function toFloatTexture(texture) {
10
12
  }
11
13
  function toByteTexture(texture) {
12
14
  const data = new Uint8ClampedArray(texture.data.length);
13
- for (let i = 0; i < texture.data.length; i++) {
14
- const value = texture.data[i];
15
- data[i] = Math.floor(Math.round((value < 0 ? 0 : Math.min(value, 1)) * 65535) / 257);
15
+ if (BYTE_LUT[65535] === 0) for (let q = 0; q < 65536; q++) BYTE_LUT[q] = Math.floor(q / 257);
16
+ const src = texture.data;
17
+ for (let i = 0; i < src.length; i++) {
18
+ const value = src[i];
19
+ data[i] = BYTE_LUT[Math.round((value < 0 ? 0 : value > 1 ? 1 : value) * 65535)];
16
20
  }
17
21
  return {
18
22
  width: texture.width,
@@ -38,7 +42,8 @@ function q16(value) {
38
42
  /**
39
43
  * Source-over with straight alpha, in place on `dst` at `offset`:
40
44
  * ra = 1-(1-sa)(1-da); rc = (sc*sa + dc*da*(1-sa)) / ra; rgb = 0 when ra = 0.
41
- * Results are Q16-quantized like every Imagick pixel write.
45
+ * Results are Q16-quantized like every Imagick pixel write. q16 is inlined
46
+ * here because blendPixel is the single hottest function in the pipeline.
42
47
  */
43
48
  function blendPixel(dst, offset, sr, sg, sb, sa) {
44
49
  const da = dst[offset + 3];
@@ -51,10 +56,17 @@ function blendPixel(dst, offset, sr, sg, sb, sa) {
51
56
  return;
52
57
  }
53
58
  const dstWeight = da * (1 - sa);
54
- dst[offset] = q16((sr * sa + dst[offset] * dstWeight) / ra);
55
- dst[offset + 1] = q16((sg * sa + dst[offset + 1] * dstWeight) / ra);
56
- dst[offset + 2] = q16((sb * sa + dst[offset + 2] * dstWeight) / ra);
57
- dst[offset + 3] = q16(ra);
59
+ let v = (sr * sa + dst[offset] * dstWeight) / ra;
60
+ v = v < 0 ? 0 : v > 1 ? 1 : v;
61
+ dst[offset] = Math.round(v * 65535) / 65535;
62
+ v = (sg * sa + dst[offset + 1] * dstWeight) / ra;
63
+ v = v < 0 ? 0 : v > 1 ? 1 : v;
64
+ dst[offset + 1] = Math.round(v * 65535) / 65535;
65
+ v = (sb * sa + dst[offset + 2] * dstWeight) / ra;
66
+ v = v < 0 ? 0 : v > 1 ? 1 : v;
67
+ dst[offset + 2] = Math.round(v * 65535) / 65535;
68
+ v = ra < 0 ? 0 : ra > 1 ? 1 : ra;
69
+ dst[offset + 3] = Math.round(v * 65535) / 65535;
58
70
  }
59
71
  /**
60
72
  * Upstream tintImage: uses ONLY the red channel as luminance — per pixel,
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { n as builtinPackPath, t as bedCompatPath } from "./builtin-caYjESh0.js"
3
3
  import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-CkletR5K.js";
4
4
  import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-B8UJmZMu.js";
5
5
  import { t as JarResourceManager } from "./jar-D9z-X7tA.js";
6
- import { t as run } from "./run-BnICOF4I.js";
6
+ import { t as run } from "./run-B0qPw3zf.js";
7
7
  import { t as downloadClientJar } from "./download-D9aARBFp.js";
8
8
  import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-Cc8QZ3j0.js";
9
9
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { t as blendPixel } from "./blend-CHP2-j9U.js";
1
+ import { t as blendPixel } from "./blend-D0XWgVQr.js";
2
2
  //#region src/render/compose.ts
3
3
  /**
4
4
  * Per-pixel painter's compositing, mirroring upstream Model::combineFaceImages:
@@ -1,4 +1,4 @@
1
- import { t as FloatTexture } from "./blend-CyDIxCne.js";
1
+ import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
2
2
  //#region src/output/encode.d.ts
3
3
  interface EncodedIcon {
4
4
  png: Buffer;
@@ -1,4 +1,4 @@
1
- import { o as toByteTexture } from "./blend-CHP2-j9U.js";
1
+ import { o as toByteTexture } from "./blend-D0XWgVQr.js";
2
2
  import sharp from "sharp";
3
3
  //#region src/output/encode.ts
4
4
  /**
@@ -58,17 +58,25 @@ async function encodeAnimatedIcon(frames, delaysMs, options = {}) {
58
58
  } }).png({ compressionLevel: 0 }).toBuffer();
59
59
  })));
60
60
  const animated = () => sharp(pages, { join: { animated: true } });
61
- const result = { png: (await encodeIcon(frames[0], { webp: false })).png };
62
- if (options.webp !== false) result.webp = await animated().webp({
61
+ const webpPromise = options.webp !== false ? animated().webp({
63
62
  lossless: true,
64
63
  effort: ANIMATED_WEBP_EFFORT,
65
64
  loop: 0,
66
65
  delay: delaysMs
67
- }).toBuffer();
68
- if (options.gif) result.gif = await animated().gif({
66
+ }).toBuffer() : Promise.resolve(void 0);
67
+ const firstFramePromise = encodeIcon(frames[0], { webp: false });
68
+ const gifPromise = options.gif ? animated().gif({
69
69
  loop: 0,
70
70
  delay: delaysMs
71
- }).toBuffer();
71
+ }).toBuffer() : Promise.resolve(void 0);
72
+ const [firstFrame, webp, gif] = await Promise.all([
73
+ firstFramePromise,
74
+ webpPromise,
75
+ gifPromise
76
+ ]);
77
+ const result = { png: firstFrame.png };
78
+ if (webp) result.webp = webp;
79
+ if (gif) result.gif = gif;
72
80
  if (options.avif) try {
73
81
  result.avif = await animated().avif({
74
82
  lossless: true,
@@ -101,19 +109,27 @@ async function encodeIcon(texture, options = {}) {
101
109
  channels: 4
102
110
  } });
103
111
  const paletteSafe = countColors(bytes.data, 256) <= 256;
104
- const result = { png: await raw.clone().png({
112
+ const pngPromise = raw.clone().png({
105
113
  compressionLevel: 9,
106
114
  effort: 10,
107
115
  palette: paletteSafe
108
- }).toBuffer() };
109
- if (options.webp !== false) result.webp = await raw.clone().webp({
116
+ }).toBuffer();
117
+ const webpPromise = options.webp !== false ? raw.clone().webp({
110
118
  lossless: true,
111
119
  effort: STATIC_WEBP_EFFORT
112
- }).toBuffer();
113
- if (options.avif) result.avif = await raw.clone().avif({
120
+ }).toBuffer() : Promise.resolve(void 0);
121
+ const avifPromise = options.avif ? raw.clone().avif({
114
122
  lossless: true,
115
123
  effort: 6
116
- }).toBuffer();
124
+ }).toBuffer() : Promise.resolve(void 0);
125
+ const [png, webp, avif] = await Promise.all([
126
+ pngPromise,
127
+ webpPromise,
128
+ avifPromise
129
+ ]);
130
+ const result = { png };
131
+ if (webp) result.webp = webp;
132
+ if (avif) result.avif = avif;
117
133
  return result;
118
134
  }
119
135
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
2
- import { i as renderModel } from "./renderer-CjT19tHd.js";
2
+ import { i as renderModel } from "./renderer-gQW_I7YG.js";
3
3
  //#region src/render/entity-fallback.ts
4
4
  /**
5
5
  * Heuristic rendering for mod items that parent `builtin/entity` — chests,
@@ -1,8 +1,8 @@
1
- import { t as FloatTexture } from "./blend-CyDIxCne.js";
1
+ import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
2
2
  import { t as Mat4 } from "./vector-DRKRi4--.js";
3
3
  import { n as FaceGeometry } from "./geometry-BSVmKx5b.js";
4
4
  import { r as LightSource } from "./lighting-3FGRC3Af.js";
5
- import { n as FaceBuffer } from "./rasterizer-yqJkicm1.js";
5
+ import { n as FaceBuffer } from "./rasterizer-B9ZGJI3-.js";
6
6
  //#region src/render/face.d.ts
7
7
  interface TintColor {
8
8
  r: number;
@@ -1,5 +1,5 @@
1
1
  import { c as normalize, g as transformVector, h as transformDirection, m as sub, r as dot, t as cross } from "./vector-CCxLae_T.js";
2
- import { a as tintTexture, n as cloneFloatTexture, r as darkenTexture } from "./blend-CHP2-j9U.js";
2
+ import { a as tintTexture, n as cloneFloatTexture, r as darkenTexture } from "./blend-D0XWgVQr.js";
3
3
  import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "./rasterizer-76qO8TDh.js";
4
4
  //#region src/render/face.ts
5
5
  /**
@@ -1,9 +1,9 @@
1
1
  import { n as displayMatrix } from "./vector-CCxLae_T.js";
2
2
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
3
- import { s as toFloatTexture } from "./blend-CHP2-j9U.js";
4
- import { t as combineFaceBuffers } from "./compose-CQCb2LVv.js";
3
+ import { s as toFloatTexture } from "./blend-D0XWgVQr.js";
4
+ import { t as combineFaceBuffers } from "./compose-lWPrB7wh.js";
5
5
  import { i as createFaceBuffer } from "./rasterizer-76qO8TDh.js";
6
- import { n as renderFace, t as faceMaxZ } from "./face-DmCiHUd5.js";
6
+ import { n as renderFace, t as faceMaxZ } from "./face-Cl1O4m2i.js";
7
7
  import { c as lightsForProfile } from "./lighting--5myudVu.js";
8
8
  //#region src/render/geo.ts
9
9
  /**
package/dist/index.d.ts CHANGED
@@ -4,17 +4,17 @@ import { a as TextureMeta, i as TextureLoader, o as TextureResolutionError, r as
4
4
  import { d as parseAtlasSources, n as AtlasSource, r as AtlasSourceError, s as ResolvedSprite, t as AtlasResolver, u as createAtlasResolver } from "./sources-B9X9w3qP.js";
5
5
  import { s as builtinDynamicResources } from "./generators-DhRov4RB.js";
6
6
  import { a as resolveTexture, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "./loader-D22zZME7.js";
7
- import { c as toFloatTexture, s as toByteTexture, t as FloatTexture } from "./blend-CyDIxCne.js";
7
+ import { c as toFloatTexture, s as toByteTexture, t as FloatTexture } from "./blend-CEHoJ7tM.js";
8
8
  import { a as LightingProfileName, i as LightingProfile, r as LightSource, u as lightsForProfile } from "./lighting-3FGRC3Af.js";
9
- import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, o as boxDownscale, r as ItemRenderError, s as pointResize } from "./renderer-DVsZHAvf.js";
9
+ import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, o as boxDownscale, r as ItemRenderError, s as pointResize } from "./renderer-B20ssjRm.js";
10
10
  import { c as defaultProperties, i as ItemRenderInstruction, l as evaluateItemModel, n as InvalidItemDefinitionError, o as TintDefinition, r as ItemProperties, s as UNKNOWN_MODEL } from "./definition-BwX6Xxv0.js";
11
11
  import { a as resolveItem, i as discoverItems, n as ItemDiscoveryOptions, r as ItemResolutionError, t as DiscoveredItem } from "./discovery-wiJBGryo.js";
12
- import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, t as DYE_COLORS } from "./tints-DLBExVWN.js";
13
- import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "./encode-DaNQF28M.js";
12
+ import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, t as DYE_COLORS } from "./tints-BH9l0ND0.js";
13
+ import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "./encode-CaSK8-mi.js";
14
14
  import { t as minifyStylesheet } from "./minify-CIV6enbr.js";
15
15
  import { a as compareVersions, o as eraForVersion, s as prepareVersionResources } from "./prepare-Cs6QDqie.js";
16
16
  import { i as prepareModResources } from "./prepare-CPxO0kKz.js";
17
17
  import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "./stylesheet-i-t_7sZ7.js";
18
- import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CKUtynTy.js";
18
+ import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CT3VtFqg.js";
19
19
  import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-CFkA-VgT.js";
20
20
  export { type AnimatedEncodeOptions, AnimatedTexture, type AtlasResolver, type AtlasSource, AtlasSourceError, DYE_COLORS, type DiscoveredItem, type EncodeOptions, type EncodedAnimatedIcon, type EncodedIcon, type FloatTexture, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, type ItemDiscoveryOptions, type ItemFailure, type ItemProperties, ItemRenderError, type ItemRenderInstruction, ItemResolutionError, type ItemStyle, JarResourceManager, LayeredResourceManager, type LightSource, LightingProfile, type LightingProfileName, ModelLoader, ModelResolutionError, type RenderOptions, type RenderedFrames, type ResolvedModel, type ResolvedSprite, ResourceKind, type ResourceKindName, ResourceLocator, type ResourceManager, type RunOptions, type RunResult, type StylesheetOptions, type Texture, TextureLoader, type TextureMeta, TextureResolutionError, type TintDefinition, UNKNOWN_MODEL, UnsafeJarError, boxDownscale, builtinDynamicResources, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateItemModel, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, minifyStylesheet, parseAtlasSources, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture };
package/dist/index.js CHANGED
@@ -3,18 +3,18 @@ import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locato
3
3
  import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-CkletR5K.js";
4
4
  import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-D9z-X7tA.js";
5
5
  import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "./discovery-0SM0cTLw.js";
6
- import { o as toByteTexture, s as toFloatTexture } from "./blend-CHP2-j9U.js";
7
- import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-D6dQu2dJ.js";
6
+ import { o as toByteTexture, s as toFloatTexture } from "./blend-D0XWgVQr.js";
7
+ import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-Df_tWzkl.js";
8
8
  import { a as builtinDynamicResources } from "./generators-BlG4KmtP.js";
9
9
  import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
10
10
  import { n as itemClass, t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
11
11
  import { c as lightsForProfile, r as LightingProfile } from "./lighting--5myudVu.js";
12
12
  import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-B8NJO7pR.js";
13
- import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "./renderer-CjT19tHd.js";
13
+ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "./renderer-gQW_I7YG.js";
14
14
  import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-BtbHegpI.js";
15
15
  import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-Bxk-WOzH.js";
16
16
  import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-CfXMxcEV.js";
17
- import { t as run } from "./run-BnICOF4I.js";
17
+ import { t as run } from "./run-B0qPw3zf.js";
18
18
  import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-Cc8QZ3j0.js";
19
19
  import { n as prepareModResources } from "./prepare-BESRrh6K.js";
20
20
  export { AnimatedTexture, AtlasSourceError, DYE_COLORS, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, ItemRenderError, ItemResolutionError, JarResourceManager, LayeredResourceManager, LightingProfile, ModelLoader, ModelResolutionError, ResourceKind, ResourceLocator, TextureLoader, TextureResolutionError, UNKNOWN_MODEL, UnsafeJarError, boxDownscale, builtinDynamicResources, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateItemModel, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, minifyStylesheet, parseAtlasSources, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture };
@@ -1,2 +1,2 @@
1
- import { a as RasterAssetFormat, c as encodeRasterAsset, i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "../encode-DaNQF28M.js";
1
+ import { a as RasterAssetFormat, c as encodeRasterAsset, i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "../encode-CaSK8-mi.js";
2
2
  export { AnimatedEncodeOptions, EncodeOptions, EncodedAnimatedIcon, EncodedIcon, RasterAssetFormat, encodeAnimatedIcon, encodeIcon, encodeRasterAsset };
@@ -1,2 +1,2 @@
1
- import { n as encodeIcon, r as encodeRasterAsset, t as encodeAnimatedIcon } from "../encode-D6dQu2dJ.js";
1
+ import { n as encodeIcon, r as encodeRasterAsset, t as encodeAnimatedIcon } from "../encode-Df_tWzkl.js";
2
2
  export { encodeAnimatedIcon, encodeIcon, encodeRasterAsset };
@@ -2,13 +2,13 @@ import { a as defaultProperties } from "./definition-3MBm8ar_.js";
2
2
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
3
3
  import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-CkletR5K.js";
4
4
  import { r as resolveItem } from "./discovery-0SM0cTLw.js";
5
- import { s as toFloatTexture, t as blendPixel } from "./blend-CHP2-j9U.js";
6
- import { t as encodeAnimatedIcon } from "./encode-D6dQu2dJ.js";
5
+ import { s as toFloatTexture, t as blendPixel } from "./blend-D0XWgVQr.js";
6
+ import { t as encodeAnimatedIcon } from "./encode-Df_tWzkl.js";
7
7
  import { a as builtinDynamicResources } from "./generators-BlG4KmtP.js";
8
8
  import { t as ModelLoader } from "./loader-B8NJO7pR.js";
9
- import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize } from "./renderer-CjT19tHd.js";
10
- import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "./entity-fallback-BRCeGKBT.js";
11
- import { i as renderGeo, t as findGeoForItem } from "./geo-Diky41Tw.js";
9
+ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize } from "./renderer-gQW_I7YG.js";
10
+ import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "./entity-fallback-D9QTGU9X.js";
11
+ import { i as renderGeo, t as findGeoForItem } from "./geo-DHiWBa-C.js";
12
12
  import { t as legacyTintsForChain } from "./legacy-tints-B09J0Rxh.js";
13
13
  import { a as resolveTints } from "./tints-BtbHegpI.js";
14
14
  import { t as loadAtlasResolver } from "./registry-B9TcjVbs.js";
@@ -1,7 +1,7 @@
1
1
  import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
2
- import { t as FloatTexture } from "./blend-CyDIxCne.js";
2
+ import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
3
3
  import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
4
- import { n as AnimationLimits } from "./renderer-DVsZHAvf.js";
4
+ import { n as AnimationLimits } from "./renderer-B20ssjRm.js";
5
5
  //#region src/render/pipeline.d.ts
6
6
  interface PipelineSettings {
7
7
  builtin?: string;
@@ -1,4 +1,4 @@
1
- import { t as FloatTexture } from "./blend-CyDIxCne.js";
1
+ import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
2
2
  //#region src/render/rasterizer.d.ts
3
3
  /** The rectangle of a buffer written since it was last cleared. */
4
4
  interface DirtyRect {
@@ -1,2 +1,2 @@
1
- import { a as q16, c as toFloatTexture, i as darkenTexture, n as blendPixel, o as tintTexture, r as cloneFloatTexture, s as toByteTexture, t as FloatTexture } from "../blend-CyDIxCne.js";
1
+ import { a as q16, c as toFloatTexture, i as darkenTexture, n as blendPixel, o as tintTexture, r as cloneFloatTexture, s as toByteTexture, t as FloatTexture } from "../blend-CEHoJ7tM.js";
2
2
  export { FloatTexture, blendPixel, cloneFloatTexture, darkenTexture, q16, tintTexture, toByteTexture, toFloatTexture };
@@ -1,2 +1,2 @@
1
- import { a as tintTexture, i as q16, n as cloneFloatTexture, o as toByteTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "../blend-CHP2-j9U.js";
1
+ import { a as tintTexture, i as q16, n as cloneFloatTexture, o as toByteTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "../blend-D0XWgVQr.js";
2
2
  export { blendPixel, cloneFloatTexture, darkenTexture, q16, tintTexture, toByteTexture, toFloatTexture };
@@ -1,5 +1,5 @@
1
- import { t as FloatTexture } from "../blend-CyDIxCne.js";
2
- import { n as FaceBuffer } from "../rasterizer-yqJkicm1.js";
1
+ import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
2
+ import { n as FaceBuffer } from "../rasterizer-B9ZGJI3-.js";
3
3
  //#region src/render/compose.d.ts
4
4
  declare function combineFaceBuffers(width: number, height: number, faces: FaceBuffer[]): FloatTexture;
5
5
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as combineFaceBuffers } from "../compose-CQCb2LVv.js";
1
+ import { t as combineFaceBuffers } from "../compose-lWPrB7wh.js";
2
2
  export { combineFaceBuffers };
@@ -1,9 +1,9 @@
1
1
  import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
2
2
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
3
3
  import { t as ModelLoader } from "../loader-D22zZME7.js";
4
- import { t as FloatTexture } from "../blend-CyDIxCne.js";
5
- import { r as TintColor } from "../face-BIYg14TE.js";
6
- import { i as RenderOptions } from "../renderer-DVsZHAvf.js";
4
+ import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
5
+ import { r as TintColor } from "../face-C49L66sQ.js";
6
+ import { i as RenderOptions } from "../renderer-B20ssjRm.js";
7
7
  //#region src/render/entity-fallback.d.ts
8
8
  /**
9
9
  * Dyed variants of vanilla items whose models mods generate at runtime (quark's
@@ -1,2 +1,2 @@
1
- import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "../entity-fallback-BRCeGKBT.js";
1
+ import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "../entity-fallback-D9QTGU9X.js";
2
2
  export { renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
@@ -1,2 +1,2 @@
1
- import { a as renderFace, i as faceMaxZ, n as RenderableFace, r as TintColor, t as FaceShadeCache } from "../face-BIYg14TE.js";
1
+ import { a as renderFace, i as faceMaxZ, n as RenderableFace, r as TintColor, t as FaceShadeCache } from "../face-C49L66sQ.js";
2
2
  export { FaceShadeCache, RenderableFace, TintColor, faceMaxZ, renderFace };
@@ -1,2 +1,2 @@
1
- import { n as renderFace, t as faceMaxZ } from "../face-DmCiHUd5.js";
1
+ import { n as renderFace, t as faceMaxZ } from "../face-Cl1O4m2i.js";
2
2
  export { faceMaxZ, renderFace };
@@ -1,9 +1,9 @@
1
1
  import { n as ResourceLocator } from "../locator-jDbdUeTd.js";
2
2
  import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
3
3
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
4
- import { t as FloatTexture } from "../blend-CyDIxCne.js";
4
+ import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
5
5
  import { n as FaceGeometry } from "../geometry-BSVmKx5b.js";
6
- import { i as RenderOptions } from "../renderer-DVsZHAvf.js";
6
+ import { i as RenderOptions } from "../renderer-B20ssjRm.js";
7
7
  //#region src/render/geo.d.ts
8
8
  interface GeoCube {
9
9
  origin?: number[];
@@ -1,2 +1,2 @@
1
- import { i as renderGeo, n as geoToFaces, r as parseGeo, t as findGeoForItem } from "../geo-Diky41Tw.js";
1
+ import { i as renderGeo, n as geoToFaces, r as parseGeo, t as findGeoForItem } from "../geo-DHiWBa-C.js";
2
2
  export { findGeoForItem, geoToFaces, parseGeo, renderGeo };
@@ -1,5 +1,5 @@
1
1
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
2
- import { r as TintColor } from "../face-BIYg14TE.js";
2
+ import { r as TintColor } from "../face-C49L66sQ.js";
3
3
  //#region src/render/legacy-tints.d.ts
4
4
  /**
5
5
  * Tints for a model rendered without an item definition (pre-1.21.4 eras and
@@ -1,9 +1,9 @@
1
1
  import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
2
2
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
3
3
  import { r as ResolvedModel } from "../loader-D22zZME7.js";
4
- import { t as FloatTexture } from "../blend-CyDIxCne.js";
4
+ import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
5
5
  import { n as Vec3 } from "../vector-DRKRi4--.js";
6
- import { i as RenderOptions } from "../renderer-DVsZHAvf.js";
6
+ import { i as RenderOptions } from "../renderer-B20ssjRm.js";
7
7
  //#region src/render/obj.d.ts
8
8
  interface ObjTriangle {
9
9
  positions: [Vec3, Vec3, Vec3];
@@ -1,2 +1,2 @@
1
- import { c as renderObjModel, o as parseMtl, s as parseObj } from "../renderer-CjT19tHd.js";
1
+ import { c as renderObjModel, o as parseMtl, s as parseObj } from "../renderer-gQW_I7YG.js";
2
2
  export { parseMtl, parseObj, renderObjModel };
@@ -1,2 +1,2 @@
1
- import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-zq-yU3Te.js";
1
+ import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-HiA3DC71.js";
2
2
  export { ItemPipeline, ItemRenderOutcome, PipelineSettings, RenderedFrames };
@@ -1,2 +1,2 @@
1
- import { t as ItemPipeline } from "../pipeline-BIk1RRIp.js";
1
+ import { t as ItemPipeline } from "../pipeline-Da2Kavba.js";
2
2
  export { ItemPipeline };
@@ -1,2 +1,2 @@
1
- import { a as clearFaceBuffer, c as drawTexturedTriangle, i as RowCursor, l as phpRound, n as FaceBuffer, o as compactFaceBuffer, r as RasterPoint, s as createFaceBuffer, t as DirtyRect } from "../rasterizer-yqJkicm1.js";
1
+ import { a as clearFaceBuffer, c as drawTexturedTriangle, i as RowCursor, l as phpRound, n as FaceBuffer, o as compactFaceBuffer, r as RasterPoint, s as createFaceBuffer, t as DirtyRect } from "../rasterizer-B9ZGJI3-.js";
2
2
  export { DirtyRect, FaceBuffer, RasterPoint, RowCursor, clearFaceBuffer, compactFaceBuffer, createFaceBuffer, drawTexturedTriangle, phpRound };
@@ -1,2 +1,2 @@
1
- import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, n as AnimationLimits, o as boxDownscale, r as ItemRenderError, s as pointResize, t as AnimationDiagnostics } from "../renderer-DVsZHAvf.js";
1
+ import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, n as AnimationLimits, o as boxDownscale, r as ItemRenderError, s as pointResize, t as AnimationDiagnostics } from "../renderer-B20ssjRm.js";
2
2
  export { AnimationDiagnostics, AnimationLimits, ItemRenderError, RenderOptions, RenderedFrames, boxDownscale, pointResize, renderModel, renderModelFrames };
@@ -1,2 +1,2 @@
1
- import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "../renderer-CjT19tHd.js";
1
+ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "../renderer-gQW_I7YG.js";
2
2
  export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
@@ -1,2 +1,2 @@
1
- import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, r as TintContext, t as DYE_COLORS } from "../tints-DLBExVWN.js";
1
+ import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, r as TintContext, t as DYE_COLORS } from "../tints-BH9l0ND0.js";
2
2
  export { DYE_COLORS, InvalidTinterDefinitionError, TintContext, parseTintValue, resolveTint, resolveTints };
@@ -1,10 +1,10 @@
1
1
  import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
2
2
  import { i as TextureLoader } from "./loader-Myy22TDL.js";
3
3
  import { r as ResolvedModel } from "./loader-D22zZME7.js";
4
- import { t as FloatTexture } from "./blend-CyDIxCne.js";
4
+ import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
5
5
  import { t as Mat4 } from "./vector-DRKRi4--.js";
6
6
  import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
7
- import { r as TintColor } from "./face-BIYg14TE.js";
7
+ import { r as TintColor } from "./face-C49L66sQ.js";
8
8
  //#region src/render/renderer.d.ts
9
9
  interface AnimationLimits {
10
10
  /** Emitted frames per icon (default 128). */
@@ -1,9 +1,9 @@
1
1
  import { c as normalize, g as transformVector, m as sub, n as displayMatrix, o as identity, r as dot, s as multiply, t as cross } from "./vector-CCxLae_T.js";
2
2
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
3
- import { a as tintTexture, n as cloneFloatTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "./blend-CHP2-j9U.js";
4
- import { t as combineFaceBuffers } from "./compose-CQCb2LVv.js";
3
+ import { a as tintTexture, n as cloneFloatTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "./blend-D0XWgVQr.js";
4
+ import { t as combineFaceBuffers } from "./compose-lWPrB7wh.js";
5
5
  import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-76qO8TDh.js";
6
- import { n as renderFace, t as faceMaxZ } from "./face-DmCiHUd5.js";
6
+ import { n as renderFace, t as faceMaxZ } from "./face-Cl1O4m2i.js";
7
7
  import { t as paintBucketFluid } from "./fluid-bucket-D-GpUQjg.js";
8
8
  import { r as buildElementFaces } from "./geometry-uIDha8S4.js";
9
9
  import { c as lightsForProfile } from "./lighting--5myudVu.js";
@@ -529,14 +529,19 @@ async function renderElementModelWith(model, supplier, renderSize, options, sess
529
529
  /** Nearest-neighbour resize matching Imagick FILTER_POINT (destination-center sampling). */
530
530
  function pointResize(texture, width, height) {
531
531
  const data = new Float64Array(width * height * 4);
532
+ const srcXs = new Int32Array(width);
533
+ for (let x = 0; x < width; x++) {
534
+ const srcX = Math.floor((x + .5) * texture.width / width);
535
+ srcXs[x] = srcX >= texture.width ? texture.width - 1 : srcX;
536
+ }
532
537
  for (let y = 0; y < height; y++) {
533
538
  let srcY = Math.floor((y + .5) * texture.height / height);
534
539
  srcY = srcY >= texture.height ? texture.height - 1 : srcY;
540
+ const srcRow = srcY * texture.width;
541
+ const dstRow = y * width;
535
542
  for (let x = 0; x < width; x++) {
536
- let srcX = Math.floor((x + .5) * texture.width / width);
537
- srcX = srcX >= texture.width ? texture.width - 1 : srcX;
538
- const src = (srcY * texture.width + srcX) * 4;
539
- const dst = (y * width + x) * 4;
543
+ const src = (srcRow + srcXs[x]) * 4;
544
+ const dst = (dstRow + x) * 4;
540
545
  data[dst] = texture.data[src];
541
546
  data[dst + 1] = texture.data[src + 1];
542
547
  data[dst + 2] = texture.data[src + 2];
@@ -562,6 +567,7 @@ function boxPass(texture, factor, isHorizontal) {
562
567
  const width = isHorizontal ? Math.round(texture.width / factor) : texture.width;
563
568
  const height = isHorizontal ? texture.height : Math.round(texture.height / factor);
564
569
  const data = new Float64Array(width * height * 4);
570
+ const { data: src } = texture;
565
571
  for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
566
572
  let r = 0;
567
573
  let g = 0;
@@ -569,11 +575,11 @@ function boxPass(texture, factor, isHorizontal) {
569
575
  let alphaSum = 0;
570
576
  for (let i = 0; i < factor; i++) {
571
577
  const srcX = isHorizontal ? x * factor + i : x;
572
- const src = ((isHorizontal ? y : y * factor + i) * texture.width + srcX) * 4;
573
- const alpha = Math.round(texture.data[src + 3] * 65535);
574
- r += Math.round(texture.data[src] * 65535) * alpha;
575
- g += Math.round(texture.data[src + 1] * 65535) * alpha;
576
- b += Math.round(texture.data[src + 2] * 65535) * alpha;
578
+ const srcOffset = ((isHorizontal ? y : y * factor + i) * texture.width + srcX) * 4;
579
+ const alpha = Math.round(src[srcOffset + 3] * 65535);
580
+ r += Math.round(src[srcOffset] * 65535) * alpha;
581
+ g += Math.round(src[srcOffset + 1] * 65535) * alpha;
582
+ b += Math.round(src[srcOffset + 2] * 65535) * alpha;
577
583
  alphaSum += alpha;
578
584
  }
579
585
  const dst = (y * width + x) * 4;
@@ -1,10 +1,10 @@
1
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
2
2
  import { n as discoverItems } from "./discovery-0SM0cTLw.js";
3
- import { r as encodeRasterAsset } from "./encode-D6dQu2dJ.js";
3
+ import { r as encodeRasterAsset } from "./encode-Df_tWzkl.js";
4
4
  import { t as classifyItemStyle } from "./item-styles-upgEO1yP.js";
5
5
  import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
6
6
  import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
7
- import { t as ItemPipeline } from "./pipeline-BIk1RRIp.js";
7
+ import { t as ItemPipeline } from "./pipeline-Da2Kavba.js";
8
8
  import { t as describeResources } from "./descriptor-DWebtkI1.js";
9
9
  import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
10
10
  import path from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
2
2
  import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
3
- import { n as AnimationLimits } from "./renderer-DVsZHAvf.js";
3
+ import { n as AnimationLimits } from "./renderer-B20ssjRm.js";
4
4
  //#region src/run.d.ts
5
5
  interface RunOptions {
6
6
  resources: ResourceManager;
package/dist/run.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { l as evaluateItemModel } from "./definition-BwX6Xxv0.js";
2
- import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CKUtynTy.js";
2
+ import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CT3VtFqg.js";
3
3
  export { ItemFailure, RunOptions, RunResult, evaluateItemModel, run };
package/dist/run.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { o as evaluateItemModel } from "./definition-3MBm8ar_.js";
2
- import { t as run } from "./run-BnICOF4I.js";
2
+ import { t as run } from "./run-B0qPw3zf.js";
3
3
  export { evaluateItemModel, run };
@@ -1,5 +1,5 @@
1
1
  import { i as TextureLoader } from "./loader-Myy22TDL.js";
2
- import { r as TintColor } from "./face-BIYg14TE.js";
2
+ import { r as TintColor } from "./face-C49L66sQ.js";
3
3
  import { o as TintDefinition } from "./definition-BwX6Xxv0.js";
4
4
  //#region src/render/tints.d.ts
5
5
  declare class InvalidTinterDefinitionError extends Error {}
@@ -1,5 +1,5 @@
1
1
  import { s as ResourceDescriptor } from "../manager-Cv1NeFyF.js";
2
- import { n as ItemRenderOutcome, r as PipelineSettings } from "../pipeline-zq-yU3Te.js";
2
+ import { n as ItemRenderOutcome, r as PipelineSettings } from "../pipeline-HiA3DC71.js";
3
3
  //#region src/workers/render-worker.d.ts
4
4
  interface RenderWorkerData {
5
5
  resources: ResourceDescriptor;
@@ -1,4 +1,4 @@
1
- import { t as ItemPipeline } from "../pipeline-BIk1RRIp.js";
1
+ import { t as ItemPipeline } from "../pipeline-Da2Kavba.js";
2
2
  import { n as restoreResources } from "../descriptor-DWebtkI1.js";
3
3
  import sharp from "sharp";
4
4
  import { parentPort, workerData } from "node:worker_threads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodecraft/rendermite",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Minecraft item icon renderer: renders inventory-identical item icons from vanilla and modded assets across game versions, outputting optimized PNG/WebP/AVIF plus CSS and a JSON item library.",
5
5
  "type": "module",
6
6
  "license": "MIT",