@nodecraft/rendermite 1.0.6 → 1.1.0

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 (171) hide show
  1. package/assets/README.md +6 -2
  2. package/assets/builtin/renderchest/models/item/trident.json +372 -0
  3. package/assets/builtin-legacy/renderchest/models/item/trident.json +372 -0
  4. package/assets/mod-models/README.md +130 -0
  5. package/assets/mod-models/ad_astra/models/item/tier_1_rocket.json +4559 -0
  6. package/assets/mod-models/ad_astra/models/item/tier_1_rover.json +6021 -0
  7. package/assets/mod-models/ad_astra/models/item/tier_2_rocket.json +6832 -0
  8. package/assets/mod-models/ad_astra/models/item/tier_3_rocket.json +8522 -0
  9. package/assets/mod-models/ad_astra/models/item/tier_4_rocket.json +7498 -0
  10. package/assets/mod-models/botania/models/item/avatar.json +574 -0
  11. package/assets/mod-models/botania/models/item/bellows.json +423 -0
  12. package/assets/mod-models/botania/models/item/brewery.json +894 -0
  13. package/assets/mod-models/botania/models/item/corporea_index.json +349 -0
  14. package/assets/mod-models/botania/models/item/gaia_pylon.json +1057 -0
  15. package/assets/mod-models/botania/models/item/hourglass.json +502 -0
  16. package/assets/mod-models/botania/models/item/mana_pylon.json +741 -0
  17. package/assets/mod-models/botania/models/item/natura_pylon.json +1057 -0
  18. package/assets/mod-models/botania/models/item/teru_teru_bozu.json +347 -0
  19. package/assets/mod-models/mekanism/models/item/atomic_disassembler.json +1391 -0
  20. package/assets/mod-models/mekanism/models/item/flamethrower.json +1926 -0
  21. package/assets/mod-models/mekanism/models/item/free_runners.json +595 -0
  22. package/assets/mod-models/mekanism/models/item/jetpack.json +1767 -0
  23. package/assets/mod-models/mekanism/models/item/scuba_mask.json +2305 -0
  24. package/assets/mod-models/mekanism/models/item/scuba_tank.json +833 -0
  25. package/assets/mod-tints/README.md +19 -0
  26. package/assets/mod-tints/mysticalagriculture/items/absorption_i_augment.json +16 -0
  27. package/assets/mod-tints/mysticalagriculture/items/absorption_ii_augment.json +16 -0
  28. package/assets/mod-tints/mysticalagriculture/items/absorption_iii_augment.json +16 -0
  29. package/assets/mod-tints/mysticalagriculture/items/absorption_iv_augment.json +16 -0
  30. package/assets/mod-tints/mysticalagriculture/items/absorption_v_augment.json +16 -0
  31. package/assets/mod-tints/mysticalagriculture/items/attack_aoe_i_augment.json +16 -0
  32. package/assets/mod-tints/mysticalagriculture/items/attack_aoe_ii_augment.json +16 -0
  33. package/assets/mod-tints/mysticalagriculture/items/attack_aoe_iii_augment.json +16 -0
  34. package/assets/mod-tints/mysticalagriculture/items/blindness_resistance_augment.json +16 -0
  35. package/assets/mod-tints/mysticalagriculture/items/fire_resistance_augment.json +16 -0
  36. package/assets/mod-tints/mysticalagriculture/items/flight_augment.json +16 -0
  37. package/assets/mod-tints/mysticalagriculture/items/haste_i_augment.json +16 -0
  38. package/assets/mod-tints/mysticalagriculture/items/haste_ii_augment.json +16 -0
  39. package/assets/mod-tints/mysticalagriculture/items/haste_iii_augment.json +16 -0
  40. package/assets/mod-tints/mysticalagriculture/items/health_boost_i_augment.json +16 -0
  41. package/assets/mod-tints/mysticalagriculture/items/health_boost_ii_augment.json +16 -0
  42. package/assets/mod-tints/mysticalagriculture/items/health_boost_iii_augment.json +16 -0
  43. package/assets/mod-tints/mysticalagriculture/items/health_boost_iv_augment.json +16 -0
  44. package/assets/mod-tints/mysticalagriculture/items/health_boost_v_augment.json +16 -0
  45. package/assets/mod-tints/mysticalagriculture/items/hunger_resistance_augment.json +16 -0
  46. package/assets/mod-tints/mysticalagriculture/items/jump_boost_i_augment.json +16 -0
  47. package/assets/mod-tints/mysticalagriculture/items/jump_boost_ii_augment.json +16 -0
  48. package/assets/mod-tints/mysticalagriculture/items/jump_boost_iii_augment.json +16 -0
  49. package/assets/mod-tints/mysticalagriculture/items/luck_i_augment.json +16 -0
  50. package/assets/mod-tints/mysticalagriculture/items/luck_ii_augment.json +16 -0
  51. package/assets/mod-tints/mysticalagriculture/items/luck_iii_augment.json +16 -0
  52. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_i_augment.json +16 -0
  53. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_ii_augment.json +16 -0
  54. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_iii_augment.json +16 -0
  55. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_iv_augment.json +16 -0
  56. package/assets/mod-tints/mysticalagriculture/items/mining_fatigue_resistance_augment.json +16 -0
  57. package/assets/mod-tints/mysticalagriculture/items/nausea_resistance_augment.json +16 -0
  58. package/assets/mod-tints/mysticalagriculture/items/night_vision_augment.json +16 -0
  59. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_i_augment.json +16 -0
  60. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_ii_augment.json +16 -0
  61. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_iii_augment.json +16 -0
  62. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_iv_augment.json +16 -0
  63. package/assets/mod-tints/mysticalagriculture/items/poison_resistance_augment.json +16 -0
  64. package/assets/mod-tints/mysticalagriculture/items/slow_falling_augment.json +16 -0
  65. package/assets/mod-tints/mysticalagriculture/items/slowness_resistance_augment.json +16 -0
  66. package/assets/mod-tints/mysticalagriculture/items/speed_i_augment.json +16 -0
  67. package/assets/mod-tints/mysticalagriculture/items/speed_ii_augment.json +16 -0
  68. package/assets/mod-tints/mysticalagriculture/items/speed_iii_augment.json +16 -0
  69. package/assets/mod-tints/mysticalagriculture/items/step_assist_augment.json +16 -0
  70. package/assets/mod-tints/mysticalagriculture/items/strength_i_augment.json +16 -0
  71. package/assets/mod-tints/mysticalagriculture/items/strength_ii_augment.json +16 -0
  72. package/assets/mod-tints/mysticalagriculture/items/strength_iii_augment.json +16 -0
  73. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_i_augment.json +16 -0
  74. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_ii_augment.json +16 -0
  75. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_iii_augment.json +16 -0
  76. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_iv_augment.json +16 -0
  77. package/assets/mod-tints/mysticalagriculture/items/water_breathing_augment.json +16 -0
  78. package/assets/mod-tints/mysticalagriculture/items/weakness_resistance_augment.json +16 -0
  79. package/assets/mod-tints/mysticalagriculture/items/wither_resistance_augment.json +16 -0
  80. package/dist/atlas/registry.js +1 -1
  81. package/dist/blend-8lnfxtLe.d.ts +79 -0
  82. package/dist/blend-KXMclcHk.js +199 -0
  83. package/dist/blockstate-CdstnW2-.js +104 -0
  84. package/dist/{builtin-caYjESh0.js → builtin-WkWjATeh.js} +5 -1
  85. package/dist/builtin.d.ts +3 -1
  86. package/dist/builtin.js +2 -2
  87. package/dist/cli.js +5 -3
  88. package/dist/{compose-CQCb2LVv.js → compose-BGsNFR12.js} +1 -1
  89. package/dist/{definition-3MBm8ar_.js → definition-ColsvWrH.js} +20 -1
  90. package/dist/{definition-BwX6Xxv0.d.ts → definition-ricL7Jqf.d.ts} +2 -0
  91. package/dist/{discovery-0SM0cTLw.js → discovery-B9aqV_Rz.js} +13 -3
  92. package/dist/{discovery-wiJBGryo.d.ts → discovery-BPSUtdm4.d.ts} +1 -1
  93. package/dist/{encode-DaNQF28M.d.ts → encode-DNcXXvYe.d.ts} +1 -1
  94. package/dist/{encode-D6dQu2dJ.js → encode-LR9wxigC.js} +28 -12
  95. package/dist/{entity-fallback-BRCeGKBT.js → entity-fallback-BnFMSHS6.js} +180 -10
  96. package/dist/{face-DmCiHUd5.js → face-CMJ3b3Ae.js} +44 -18
  97. package/dist/face-cQ-pVHoe.d.ts +44 -0
  98. package/dist/{fluid-bucket-D-GpUQjg.js → fluid-bucket-BzoLofB_.js} +7 -2
  99. package/dist/{geo-Diky41Tw.js → geo-w9HHIrb5.js} +87 -13
  100. package/dist/{geometry-uIDha8S4.js → geometry-Bi-Bf5rb.js} +7 -1
  101. package/dist/{geometry-BSVmKx5b.d.ts → geometry-w0yQbzDZ.d.ts} +5 -1
  102. package/dist/index.d.ts +9 -9
  103. package/dist/index.js +10 -10
  104. package/dist/items/blockstate.d.ts +23 -0
  105. package/dist/items/blockstate.js +2 -0
  106. package/dist/items/definition.d.ts +1 -1
  107. package/dist/items/definition.js +1 -1
  108. package/dist/items/discovery.d.ts +1 -1
  109. package/dist/items/discovery.js +1 -1
  110. package/dist/{loader-D22zZME7.d.ts → loader-DD83d80u.d.ts} +2 -1
  111. package/dist/{loader-B8NJO7pR.js → loader-DwkA9LR5.js} +267 -15
  112. package/dist/{loader-CfXMxcEV.js → loader-Lb0ZeILz.js} +19 -7
  113. package/dist/models/loader.d.ts +1 -1
  114. package/dist/models/loader.js +1 -1
  115. package/dist/models/types.d.ts +1 -1
  116. package/dist/models-BKxGkPS7.js +18 -0
  117. package/dist/mods/models.d.ts +5 -0
  118. package/dist/mods/models.js +2 -0
  119. package/dist/mods/prepare.d.ts +1 -1
  120. package/dist/mods/prepare.js +1 -1
  121. package/dist/mods/tints.js +1 -1
  122. package/dist/output/encode.d.ts +1 -1
  123. package/dist/output/encode.js +1 -1
  124. package/dist/{pipeline-BIk1RRIp.js → pipeline-BVYj7OP0.js} +72 -19
  125. package/dist/{pipeline-zq-yU3Te.d.ts → pipeline-CJNiQG-1.d.ts} +15 -5
  126. package/dist/{prepare-BESRrh6K.js → prepare-D56Z-9cg.js} +7 -2
  127. package/dist/{prepare-CPxO0kKz.d.ts → prepare-Dce7-HAe.d.ts} +8 -0
  128. package/dist/{rasterizer-yqJkicm1.d.ts → rasterizer-BSQHEhJ-.d.ts} +4 -2
  129. package/dist/{rasterizer-76qO8TDh.js → rasterizer-DcVJzkxz.js} +13 -5
  130. package/dist/{registry-B9TcjVbs.js → registry-DS5PZ57l.js} +8 -1
  131. package/dist/render/blend.d.ts +2 -2
  132. package/dist/render/blend.js +2 -2
  133. package/dist/render/compose.d.ts +2 -2
  134. package/dist/render/compose.js +1 -1
  135. package/dist/render/entity-fallback.d.ts +19 -5
  136. package/dist/render/entity-fallback.js +2 -2
  137. package/dist/render/face.d.ts +2 -2
  138. package/dist/render/face.js +2 -2
  139. package/dist/render/fluid-bucket.js +1 -1
  140. package/dist/render/geo.d.ts +3 -3
  141. package/dist/render/geo.js +1 -1
  142. package/dist/render/geometry.d.ts +1 -1
  143. package/dist/render/geometry.js +1 -1
  144. package/dist/render/legacy-tints.d.ts +1 -1
  145. package/dist/render/obj.d.ts +5 -3
  146. package/dist/render/obj.js +1 -1
  147. package/dist/render/pipeline.d.ts +1 -1
  148. package/dist/render/pipeline.js +1 -1
  149. package/dist/render/rasterizer.d.ts +1 -1
  150. package/dist/render/rasterizer.js +1 -1
  151. package/dist/render/renderer.d.ts +1 -1
  152. package/dist/render/renderer.js +1 -1
  153. package/dist/render/tints.d.ts +1 -1
  154. package/dist/render/tints.js +1 -1
  155. package/dist/{renderer-DVsZHAvf.d.ts → renderer-C79EQDSn.d.ts} +3 -3
  156. package/dist/{renderer-CjT19tHd.js → renderer-oi1MSF3Y.js} +36 -19
  157. package/dist/{run-BnICOF4I.js → run-C6AP3Bn8.js} +3 -3
  158. package/dist/{run-CKUtynTy.d.ts → run-uq8_hUx9.d.ts} +1 -1
  159. package/dist/run.d.ts +2 -2
  160. package/dist/run.js +2 -2
  161. package/dist/textures/loader.js +1 -1
  162. package/dist/{tints-BtbHegpI.js → tints-3VI_2SNy.js} +107 -1
  163. package/dist/{tints-B8UJmZMu.js → tints-CebmvjmP.js} +2 -2
  164. package/dist/{tints-DLBExVWN.d.ts → tints-Do9Sh3dg.d.ts} +2 -2
  165. package/dist/{types-COGbtA1t.d.ts → types-DpRSF9Vj.d.ts} +8 -0
  166. package/dist/workers/render-worker.d.ts +1 -1
  167. package/dist/workers/render-worker.js +1 -1
  168. package/package.json +1 -1
  169. package/dist/blend-CHP2-j9U.js +0 -90
  170. package/dist/blend-CyDIxCne.d.ts +0 -36
  171. package/dist/face-BIYg14TE.d.ts +0 -30
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/pathing_aoe_iv_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 11177290
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 8743738
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/poison_resistance_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 7789388
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 3558165
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/slow_falling_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 16773073
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 10851706
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/slowness_resistance_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 3355443
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 1118481
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/speed_i_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 11358797
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 2361349
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/speed_ii_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 11358797
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 2361349
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/speed_iii_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 11358797
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 2361349
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/step_assist_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 16535296
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 6301184
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/strength_i_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 16776592
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 13405735
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/strength_ii_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 16776592
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 13405735
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/strength_iii_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 16776592
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 13405735
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/tilling_aoe_i_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 12158300
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 5848361
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/tilling_aoe_ii_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 12158300
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 5848361
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/tilling_aoe_iii_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 12158300
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 5848361
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/tilling_aoe_iv_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 12158300
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 5848361
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/water_breathing_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 15925247
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 5943247
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/weakness_resistance_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 12517500
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 8388691
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "model": {
3
+ "type": "minecraft:model",
4
+ "model": "mysticalagriculture:item/wither_resistance_augment",
5
+ "tints": [
6
+ {
7
+ "type": "minecraft:constant",
8
+ "value": 7751767
9
+ },
10
+ {
11
+ "type": "minecraft:constant",
12
+ "value": 1709590
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -1,2 +1,2 @@
1
- import { t as loadAtlasResolver } from "../registry-B9TcjVbs.js";
1
+ import { t as loadAtlasResolver } from "../registry-DS5PZ57l.js";
2
2
  export { loadAtlasResolver };
@@ -0,0 +1,79 @@
1
+ import { r as Texture } from "./loader-Myy22TDL.js";
2
+ //#region src/render/blend.d.ts
3
+ /** RGBA float pixels for render-time work; converted back to 8-bit at encode. */
4
+ interface FloatTexture {
5
+ width: number;
6
+ height: number;
7
+ /** RGBA, row-major, normalized [0,1]. */
8
+ data: Float64Array;
9
+ }
10
+ declare function toFloatTexture(texture: Texture): FloatTexture;
11
+ declare function toByteTexture(texture: FloatTexture): Texture;
12
+ declare function cloneFloatTexture(texture: FloatTexture): FloatTexture;
13
+ /**
14
+ * Imagick stores every pixel write as a Q16 quantum; values re-read for the
15
+ * next operation carry that quantization. Matching it is what turns
16
+ * off-by-one downscale rounding into exact parity.
17
+ */
18
+ declare function q16(value: number): number;
19
+ /**
20
+ * Source-over with straight alpha, in place on `dst` at `offset`:
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. q16 is inlined
23
+ * here because blendPixel is the single hottest function in the pipeline.
24
+ */
25
+ declare function blendPixel(dst: Float64Array, offset: number, sr: number, sg: number, sb: number, sa: number): void;
26
+ /**
27
+ * Upstream tintImage: uses ONLY the red channel as luminance — per pixel,
28
+ * source-over blend of {tint.rgb * pixel.r, alpha: pixel.a} onto the pixel.
29
+ */
30
+ declare function tintTexture(texture: FloatTexture, tintR: number, tintG: number, tintB: number): void;
31
+ /**
32
+ * Scale the alpha channel by a constant, over the same 1px-expanded UV window
33
+ * darkenTexture uses. Straight alpha, so colour is left alone.
34
+ */
35
+ declare function scaleTextureAlpha(texture: FloatTexture, factor: number, u1: number, v1: number, u2: number, v2: number): void;
36
+ /**
37
+ * Upstream darkenTexture: blend pure black with alpha = amount * pixel.alpha,
38
+ * restricted to the UV bounding box expanded by 1px on each side.
39
+ */
40
+ declare function darkenTexture(texture: FloatTexture, amount: number, u1: number, v1: number, u2: number, v2: number): void;
41
+ /**
42
+ * The per-face shading a sample applies as it is written, instead of against a
43
+ * pre-shaded copy of the texture.
44
+ *
45
+ * Shading used to clone the whole texture per face and darken its UV window.
46
+ * That is fine for block models, whose faces reuse a handful of windows, and
47
+ * catastrophic for anything detailed: a 1,208-cube GeckoLib gun has 6,136 faces,
48
+ * each with its own UV rect and its own float light level, so nothing is ever
49
+ * reused — 6,136 clones of a 1024x1024 texture, over 20 GB for one 16x16 icon.
50
+ * Cost now tracks pixels actually drawn (a few hundred) rather than the atlas.
51
+ */
52
+ interface FaceShading {
53
+ tint: {
54
+ r: number;
55
+ g: number;
56
+ b: number;
57
+ } | null;
58
+ /** Blend-to-black amount, applied only inside the window. */
59
+ darkness: number;
60
+ /** Alpha multiplier, applied only inside the window. */
61
+ alpha: number;
62
+ /** UV bounding box in texels, expanded 1px each way, clamped — see uvWindow. */
63
+ windowX1: number;
64
+ windowY1: number;
65
+ windowX2: number;
66
+ windowY2: number;
67
+ }
68
+ /** The UV window darkenTexture would have covered, in texels. */
69
+ declare function uvWindow(texture: FloatTexture, u1: number, v1: number, u2: number, v2: number): [number, number, number, number];
70
+ /**
71
+ * Copy one texel into a face buffer with the face's shading applied, matching
72
+ * tintTexture → darkenTexture → scaleTextureAlpha run over a cloned texture.
73
+ * Tint covers the whole sheet; darkness and alpha only the UV window, which is
74
+ * why a sample landing outside it (the rasterizer overdraws by a pixel) must
75
+ * stay untouched by those two.
76
+ */
77
+ declare function shadeTexel(dst: Float64Array, at: number, source: Float64Array, from: number, shading: FaceShading, texX: number, texY: number): void;
78
+ //#endregion
79
+ export { darkenTexture as a, shadeTexel as c, toFloatTexture as d, uvWindow as f, cloneFloatTexture as i, tintTexture as l, FloatTexture as n, q16 as o, blendPixel as r, scaleTextureAlpha as s, FaceShading as t, toByteTexture as u };
@@ -0,0 +1,199 @@
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);
4
+ function toFloatTexture(texture) {
5
+ const data = new Float64Array(texture.data.length);
6
+ for (let i = 0; i < texture.data.length; i++) data[i] = texture.data[i] / 255;
7
+ return {
8
+ width: texture.width,
9
+ height: texture.height,
10
+ data
11
+ };
12
+ }
13
+ function toByteTexture(texture) {
14
+ const data = new Uint8ClampedArray(texture.data.length);
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)];
20
+ }
21
+ return {
22
+ width: texture.width,
23
+ height: texture.height,
24
+ data
25
+ };
26
+ }
27
+ function cloneFloatTexture(texture) {
28
+ return {
29
+ width: texture.width,
30
+ height: texture.height,
31
+ data: new Float64Array(texture.data)
32
+ };
33
+ }
34
+ /**
35
+ * Imagick stores every pixel write as a Q16 quantum; values re-read for the
36
+ * next operation carry that quantization. Matching it is what turns
37
+ * off-by-one downscale rounding into exact parity.
38
+ */
39
+ function q16(value) {
40
+ return Math.round((value < 0 ? 0 : Math.min(value, 1)) * 65535) / 65535;
41
+ }
42
+ /**
43
+ * Source-over with straight alpha, in place on `dst` at `offset`:
44
+ * ra = 1-(1-sa)(1-da); rc = (sc*sa + dc*da*(1-sa)) / ra; rgb = 0 when ra = 0.
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.
47
+ */
48
+ function blendPixel(dst, offset, sr, sg, sb, sa) {
49
+ const da = dst[offset + 3];
50
+ const ra = 1 - (1 - sa) * (1 - da);
51
+ if (ra === 0) {
52
+ dst[offset] = 0;
53
+ dst[offset + 1] = 0;
54
+ dst[offset + 2] = 0;
55
+ dst[offset + 3] = 0;
56
+ return;
57
+ }
58
+ const dstWeight = da * (1 - sa);
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;
70
+ }
71
+ /**
72
+ * Upstream tintImage: uses ONLY the red channel as luminance — per pixel,
73
+ * source-over blend of {tint.rgb * pixel.r, alpha: pixel.a} onto the pixel.
74
+ */
75
+ function tintTexture(texture, tintR, tintG, tintB) {
76
+ const { data } = texture;
77
+ for (let offset = 0; offset < data.length; offset += 4) {
78
+ const value = data[offset];
79
+ blendPixel(data, offset, tintR * value, tintG * value, tintB * value, data[offset + 3]);
80
+ }
81
+ }
82
+ /**
83
+ * Scale the alpha channel by a constant, over the same 1px-expanded UV window
84
+ * darkenTexture uses. Straight alpha, so colour is left alone.
85
+ */
86
+ function scaleTextureAlpha(texture, factor, u1, v1, u2, v2) {
87
+ const { data } = texture;
88
+ forEachUvPixel(texture, u1, v1, u2, v2, (offset) => {
89
+ data[offset + 3] = q16(data[offset + 3] * factor);
90
+ });
91
+ }
92
+ /**
93
+ * Upstream darkenTexture: blend pure black with alpha = amount * pixel.alpha,
94
+ * restricted to the UV bounding box expanded by 1px on each side.
95
+ */
96
+ function darkenTexture(texture, amount, u1, v1, u2, v2) {
97
+ const { data } = texture;
98
+ forEachUvPixel(texture, u1, v1, u2, v2, (offset) => {
99
+ blendPixel(data, offset, 0, 0, 0, amount * data[offset + 3]);
100
+ });
101
+ }
102
+ /** The UV bounding box expanded by 1px on each side, clamped to the texture. */
103
+ function forEachUvPixel(texture, u1, v1, u2, v2, visit) {
104
+ const startX = Math.max(0, Math.floor(Math.min(u1, u2)) - 1);
105
+ const startY = Math.max(0, Math.floor(Math.min(v1, v2)) - 1);
106
+ const endX = Math.min(texture.width - 1, Math.ceil(Math.max(u1, u2)) + 1);
107
+ const endY = Math.min(texture.height - 1, Math.ceil(Math.max(v1, v2)) + 1);
108
+ for (let y = startY; y <= endY; y++) for (let x = startX; x <= endX; x++) visit((y * texture.width + x) * 4);
109
+ }
110
+ /** The UV window darkenTexture would have covered, in texels. */
111
+ function uvWindow(texture, u1, v1, u2, v2) {
112
+ return [
113
+ Math.max(0, Math.floor(Math.min(u1, u2)) - 1),
114
+ Math.max(0, Math.floor(Math.min(v1, v2)) - 1),
115
+ Math.min(texture.width - 1, Math.ceil(Math.max(u1, u2)) + 1),
116
+ Math.min(texture.height - 1, Math.ceil(Math.max(v1, v2)) + 1)
117
+ ];
118
+ }
119
+ /**
120
+ * Source-over of one colour onto one pixel, written into `dst`. The same
121
+ * arithmetic as blendPixel, reading its source from separate values so a sample
122
+ * can be shaded without a backing array.
123
+ */
124
+ function blendInto(dst, at, red, green, blue, alpha, sr, sg, sb, sa) {
125
+ const ra = 1 - (1 - sa) * (1 - alpha);
126
+ if (ra === 0) {
127
+ dst[at] = 0;
128
+ dst[at + 1] = 0;
129
+ dst[at + 2] = 0;
130
+ dst[at + 3] = 0;
131
+ return;
132
+ }
133
+ const dstWeight = alpha * (1 - sa);
134
+ dst[at] = q16((sr * sa + red * dstWeight) / ra);
135
+ dst[at + 1] = q16((sg * sa + green * dstWeight) / ra);
136
+ dst[at + 2] = q16((sb * sa + blue * dstWeight) / ra);
137
+ dst[at + 3] = q16(ra);
138
+ }
139
+ /**
140
+ * Copy one texel into a face buffer with the face's shading applied, matching
141
+ * tintTexture → darkenTexture → scaleTextureAlpha run over a cloned texture.
142
+ * Tint covers the whole sheet; darkness and alpha only the UV window, which is
143
+ * why a sample landing outside it (the rasterizer overdraws by a pixel) must
144
+ * stay untouched by those two.
145
+ */
146
+ function shadeTexel(dst, at, source, from, shading, texX, texY) {
147
+ const red = source[from];
148
+ const green = source[from + 1];
149
+ const blue = source[from + 2];
150
+ const alpha = source[from + 3];
151
+ const inWindow = texX >= shading.windowX1 && texX <= shading.windowX2 && texY >= shading.windowY1 && texY <= shading.windowY2;
152
+ const { tint } = shading;
153
+ if (tint === null && alpha === 1) {
154
+ if (!inWindow) {
155
+ dst[at] = red;
156
+ dst[at + 1] = green;
157
+ dst[at + 2] = blue;
158
+ dst[at + 3] = 1;
159
+ return;
160
+ }
161
+ const keep = 1 - shading.darkness;
162
+ dst[at] = q16(red * keep);
163
+ dst[at + 1] = q16(green * keep);
164
+ dst[at + 2] = q16(blue * keep);
165
+ dst[at + 3] = shading.alpha < 1 ? q16(shading.alpha) : 1;
166
+ return;
167
+ }
168
+ if (tint === null && alpha === 0 && inWindow) {
169
+ dst[at] = 0;
170
+ dst[at + 1] = 0;
171
+ dst[at + 2] = 0;
172
+ dst[at + 3] = 0;
173
+ return;
174
+ }
175
+ let currentRed = red;
176
+ let currentGreen = green;
177
+ let currentBlue = blue;
178
+ let currentAlpha = alpha;
179
+ if (tint) {
180
+ blendInto(dst, at, currentRed, currentGreen, currentBlue, currentAlpha, tint.r * red, tint.g * red, tint.b * red, currentAlpha);
181
+ currentRed = dst[at];
182
+ currentGreen = dst[at + 1];
183
+ currentBlue = dst[at + 2];
184
+ currentAlpha = dst[at + 3];
185
+ }
186
+ if (inWindow) {
187
+ blendInto(dst, at, currentRed, currentGreen, currentBlue, currentAlpha, 0, 0, 0, shading.darkness * currentAlpha);
188
+ currentRed = dst[at];
189
+ currentGreen = dst[at + 1];
190
+ currentBlue = dst[at + 2];
191
+ currentAlpha = shading.alpha < 1 ? q16(dst[at + 3] * shading.alpha) : dst[at + 3];
192
+ }
193
+ dst[at] = currentRed;
194
+ dst[at + 1] = currentGreen;
195
+ dst[at + 2] = currentBlue;
196
+ dst[at + 3] = currentAlpha;
197
+ }
198
+ //#endregion
199
+ export { scaleTextureAlpha as a, toByteTexture as c, q16 as i, toFloatTexture as l, cloneFloatTexture as n, shadeTexel as o, darkenTexture as r, tintTexture as s, blendPixel as t, uvWindow as u };