@holtjs/craft 0.0.0-stage → 0.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.
- package/CHANGELOG.md +14 -0
- package/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +63 -2
- package/dist/atlas-Pc12eQsg.js +112 -0
- package/dist/atlas.d.ts +75 -0
- package/dist/atlas.js +1 -0
- package/dist/index.d.ts +154 -0
- package/dist/index.js +14 -0
- package/dist/inspect-NzY8Ac1j.js +466 -0
- package/dist/inspect.d.ts +36 -0
- package/dist/inspect.js +1 -0
- package/dist/pixel-D3jgByB5.js +728 -0
- package/dist/pixel.d.ts +79 -0
- package/dist/pixel.js +1 -0
- package/dist/rig3d-C3i7UL88.js +7257 -0
- package/dist/rig3d-DhTgbTbX.d.ts +605 -0
- package/dist/rig3d.d.ts +2 -0
- package/dist/rig3d.js +2 -0
- package/dist/tilemap-BFH4_JLe.js +266 -0
- package/dist/tilemap.d.ts +61 -0
- package/dist/tilemap.js +1 -0
- package/llms.txt +16 -0
- package/package.json +71 -4
- package/skills/craft/SKILL.md +93 -0
- package/skills/craft/references/subpaths.md +32 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@holtjs/craft` are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-12-04
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial release of **`@holtjs/craft`** (6 zero-dependency, zero-DOM ESM subpaths):
|
|
9
|
+
- `@holtjs/craft/pixel`: `PixelCanvas`, `derivePixelRamp`, `derivePaletteVariants`, `compilePixelGrid`, and pure-TS `encodePngRgba`.
|
|
10
|
+
- `@holtjs/craft/rig3d`: Analytical 3D→2D character, custom humanoid/monster, cosmetic, and `26°` oblique decor-prop rasterizer (~0.4 ms/frame), 9 projected 2D sockets, `bakeDirectionalCharacterSheet`, and `GRAVEYARD_PRESETS` (`keeperBody`, `zombieBody`, `ironAxe`, `blazingTorch`, `chop`, `shamble`, `tombstone`, `woodenChest`, `stoneFurnace`, `arrowTower`, `ancientPine`).
|
|
11
|
+
- `@holtjs/craft/tilemap`: Textured 16-tile Oskar Stålberg Dual-Grid (`bakePixelDualGridSheet`), 47-tile Blob (`bakePixelBlob47Sheet`), and 3×3 Sobel normal-map baker (`bakeNormalMapRgba`).
|
|
12
|
+
- `@holtjs/craft/atlas`: Shelf sprite & normal-map atlas packer (`packSpriteAtlas`) + `registerAtlasOnStage`.
|
|
13
|
+
- `@holtjs/craft/inspect`: 4× nearest-neighbor checkerboard contact sheet & socket/baseline inspector (`renderContactSheet`).
|
|
14
|
+
- Bundled `skills/craft/SKILL.md`, `skills/craft/references/subpaths.md`, `llms.txt`, and `examples/graveyard-sheet.mjs`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Holt Craft (@holtjs/craft)
|
|
2
|
+
Copyright 2026 Botiverse, Inc.
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Design & algorithmic acknowledgments:
|
|
7
|
+
- Dual-Grid 16-tile autotiling in `src/tilemap.ts` builds on the dual-lattice terrain transition
|
|
8
|
+
technique popularized by Oskar Stålberg.
|
|
9
|
+
- 3D-to-2D analytical raycast pixel rasterization and 2D connected-patch crescent shading in
|
|
10
|
+
`src/rig3d*.ts` are extracted from Botiverse's production Raft Deck engine.
|
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Holt Craft (`@holtjs/craft`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@holtjs/craft)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](package.json)
|
|
6
|
+
|
|
7
|
+
**Zero-dependency procedural pixel-art, analytical 3D→2D character/prop/socket baker, Dual-Grid/Blob tileset & normal-map generator, atlas packer, and 4× AI visual contact-sheet inspector** in pure zero-DOM TypeScript — built as the asset-crafting companion to [`@holtjs/stage`](https://github.com/botiverse-play/stage).
|
|
8
|
+
|
|
9
|
+
- **Official Docs**: https://holt.js.org
|
|
10
|
+
- **Repository**: https://github.com/botiverse-play/craft
|
|
11
|
+
- **AI Agent Skill**: [skills/craft/SKILL.md](skills/craft/SKILL.md) · [llms.txt](llms.txt)
|
|
12
|
+
|
|
13
|
+
## Why `@holtjs/craft`?
|
|
14
|
+
|
|
15
|
+
AI coding agents write great game logic, physics, and shaders — yet struggle when games need **frame-consistent multi-direction pixel characters, oblique stone/timber props, seamless shoreline/cobblestone autotiles, and normal maps**. Image diffusion models produce inconsistent frames and opaque backgrounds; Three.js/Blender pipelines require heavy native/GPU dependencies.
|
|
16
|
+
|
|
17
|
+
`@holtjs/craft` solves this in **~25 kB gzipped of pure ES2022 TypeScript (zero DOM, zero native addons, zero runtime dependencies)**:
|
|
18
|
+
|
|
19
|
+
- **`@holtjs/craft/rig3d`** (~0.4 ms/frame CPU analytical raycaster): Composes 3D ellipsoids, superellipsoids, capsules, cones, boxes, cylinders, and tori over an articulated 12-bone skeleton with 9 projected 2D equipment sockets (`handR`, `handL`, `headTop`, `back`, ...), supersampled weighted material voting, 2D connected-patch crescent shading, depth-stepped inner seam lines, and 4-connected colored 1px outlines. Includes ready-to-bake *Graveyard Keeper*-style presets (`GRAVEYARD_PRESETS`).
|
|
20
|
+
- **`@holtjs/craft/tilemap`**: Bakes textured 16-tile Oskar Stålberg Dual-Grid sheets (`cobble`, `stone_brick`, `grass`, `dirt`, `water`, `sand`) and 47-tile Blob wall/wrought-iron fence sheets + paired 3×3 Sobel normal maps (`bakeNormalMapRgba`).
|
|
21
|
+
- **`@holtjs/craft/pixel`**: Integer-crisp `PixelCanvas`, hue-shifted 4-shade ramps (`derivePixelRamp`), 16-variant palette generator, Bayer dithering, ASCII pixel grid compiler, and a **pure-TS zero-dependency PNG encoder** (`encodePngRgba`).
|
|
22
|
+
- **`@holtjs/craft/atlas`**: Shelf sprite + synchronized normal-map atlas packer (`packSpriteAtlas`) with one-line `@holtjs/stage` scene registration (`registerAtlasOnStage`).
|
|
23
|
+
- **`@holtjs/craft/inspect`**: 4× nearest-neighbor checkerboard contact sheet (`renderContactSheet`) with `3×5` bitmap labels, cell grids, ground baselines, and socket markers so AI agents can inspect every generated frame in a single PNG.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @holtjs/craft
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import fs from 'node:fs';
|
|
35
|
+
import { GRAVEYARD_PRESETS, bakeDirectionalCharacterSheet, renderDecorPropSheet } from '@holtjs/craft/rig3d';
|
|
36
|
+
import { bakePixelDualGridSheet } from '@holtjs/craft/tilemap';
|
|
37
|
+
import { renderContactSheet } from '@holtjs/craft/inspect';
|
|
38
|
+
|
|
39
|
+
const keeper = bakeDirectionalCharacterSheet(GRAVEYARD_PRESETS.keeperBody, {
|
|
40
|
+
dirs: 4,
|
|
41
|
+
rows: [{ clip: 'walk' }, { clip: GRAVEYARD_PRESETS.clips.chop, name: 'chop' }],
|
|
42
|
+
cosmetics: [GRAVEYARD_PRESETS.cosmetics.ironAxe, GRAVEYARD_PRESETS.cosmetics.blazingTorch],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const tombstone = renderDecorPropSheet(GRAVEYARD_PRESETS.props.tombstone);
|
|
46
|
+
const cobble = bakePixelDualGridSheet({ id: 'cobble', tileSize: 32, baseColor: '#64748b', style: 'cobble' });
|
|
47
|
+
|
|
48
|
+
const qa = renderContactSheet([
|
|
49
|
+
{ label: 'KEEPER 4-DIR', sprite: keeper, cellW: 32, cellH: 32 },
|
|
50
|
+
{ label: 'TOMBSTONE 4-DIR', sprite: tombstone, cellW: 32, baseY: 36 },
|
|
51
|
+
{ label: 'COBBLE DUAL-GRID', sprite: cobble, cellW: 32, cellH: 32 },
|
|
52
|
+
]);
|
|
53
|
+
fs.writeFileSync('graveyard-qa.png', qa.png);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## AI Agent Skill
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx skills add botiverse-play/craft
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { a as encodePngRgba, u as __exportAll } from "./pixel-D3jgByB5.js";
|
|
2
|
+
import { n as bakeNormalMapRgba } from "./tilemap-BFH4_JLe.js";
|
|
3
|
+
// src/atlas.ts
|
|
4
|
+
var atlas_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
packSpriteAtlas: () => packSpriteAtlas,
|
|
6
|
+
registerAtlasOnStage: () => registerAtlasOnStage,
|
|
7
|
+
writeRgbaToCanvas: () => writeRgbaToCanvas
|
|
8
|
+
});
|
|
9
|
+
function nextPow2(n) {
|
|
10
|
+
let p = 1;
|
|
11
|
+
while (p < n) p <<= 1;
|
|
12
|
+
return p;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Pack multiple sprites, animation strips, or tilesets into one tight RGBA sprite atlas
|
|
16
|
+
* (plus optional synchronized tangent-space normal-map atlas) with border padding.
|
|
17
|
+
*/
|
|
18
|
+
function packSpriteAtlas(items, opts = {}) {
|
|
19
|
+
const pad = Math.max(0, Math.floor(opts.padding ?? 2));
|
|
20
|
+
const maxW = Math.max(64, Math.floor(opts.maxWidth ?? 1024));
|
|
21
|
+
const sorted = [...items].sort((a, b) => b.height - a.height || b.width - a.width);
|
|
22
|
+
const placements = [];
|
|
23
|
+
let curX = pad;
|
|
24
|
+
let curY = pad;
|
|
25
|
+
let rowH = 0;
|
|
26
|
+
let usedW = pad * 2;
|
|
27
|
+
for (const item of sorted) {
|
|
28
|
+
if (curX + item.width + pad > maxW && curX > pad) {
|
|
29
|
+
curX = pad;
|
|
30
|
+
curY += rowH + pad;
|
|
31
|
+
rowH = 0;
|
|
32
|
+
}
|
|
33
|
+
placements.push({
|
|
34
|
+
item,
|
|
35
|
+
x: curX,
|
|
36
|
+
y: curY
|
|
37
|
+
});
|
|
38
|
+
curX += item.width + pad;
|
|
39
|
+
if (curX > usedW) usedW = curX;
|
|
40
|
+
if (item.height > rowH) rowH = item.height;
|
|
41
|
+
}
|
|
42
|
+
const rawW = Math.max(1, usedW);
|
|
43
|
+
const rawH = Math.max(1, curY + rowH + pad);
|
|
44
|
+
const width = opts.powerOfTwo ? nextPow2(rawW) : rawW;
|
|
45
|
+
const height = opts.powerOfTwo ? nextPow2(rawH) : rawH;
|
|
46
|
+
const rgba = new Uint8ClampedArray(width * height * 4);
|
|
47
|
+
const wantNormals = opts.bakeNormals !== false;
|
|
48
|
+
const normalRgba = wantNormals ? new Uint8ClampedArray(width * height * 4) : void 0;
|
|
49
|
+
const frames = {};
|
|
50
|
+
for (const { item, x, y } of placements) {
|
|
51
|
+
const itemNorm = wantNormals ? item.normalRgba ?? bakeNormalMapRgba(item.rgba, item.width, item.height) : void 0;
|
|
52
|
+
for (let sy = 0; sy < item.height; sy++) {
|
|
53
|
+
const srcOff = sy * item.width * 4;
|
|
54
|
+
const dstOff = ((y + sy) * width + x) * 4;
|
|
55
|
+
rgba.set(item.rgba.subarray(srcOff, srcOff + item.width * 4), dstOff);
|
|
56
|
+
if (normalRgba && itemNorm) normalRgba.set(itemNorm.subarray(srcOff, srcOff + item.width * 4), dstOff);
|
|
57
|
+
}
|
|
58
|
+
frames[item.id] = {
|
|
59
|
+
key: item.id,
|
|
60
|
+
x,
|
|
61
|
+
y,
|
|
62
|
+
w: item.width,
|
|
63
|
+
h: item.height,
|
|
64
|
+
pivotX: item.pivotX ?? .5,
|
|
65
|
+
pivotY: item.pivotY ?? .5
|
|
66
|
+
};
|
|
67
|
+
if (item.subFrames?.length) for (const sf of item.subFrames) frames[sf.key] = {
|
|
68
|
+
key: sf.key,
|
|
69
|
+
x: x + sf.x,
|
|
70
|
+
y: y + sf.y,
|
|
71
|
+
w: sf.w,
|
|
72
|
+
h: sf.h,
|
|
73
|
+
pivotX: sf.pivotX ?? .5,
|
|
74
|
+
pivotY: sf.pivotY ?? .5
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
width,
|
|
79
|
+
height,
|
|
80
|
+
rgba,
|
|
81
|
+
...normalRgba ? { normalRgba } : {},
|
|
82
|
+
frames,
|
|
83
|
+
toPng() {
|
|
84
|
+
return encodePngRgba(width, height, rgba);
|
|
85
|
+
},
|
|
86
|
+
toNormalPng() {
|
|
87
|
+
return normalRgba ? encodePngRgba(width, height, normalRgba) : null;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Copy any `PixelSpriteLike` (`{ width, height, rgba }`) onto a browser or `@napi-rs/canvas` 2D canvas. */
|
|
92
|
+
function writeRgbaToCanvas(sprite, createCanvas) {
|
|
93
|
+
const canvas = createCanvas(sprite.width, sprite.height);
|
|
94
|
+
const ctx = canvas.getContext("2d");
|
|
95
|
+
if (!ctx) throw new Error("writeRgbaToCanvas: 2D context unavailable");
|
|
96
|
+
const img = ctx.createImageData(sprite.width, sprite.height);
|
|
97
|
+
img.data.set(sprite.rgba);
|
|
98
|
+
ctx.putImageData(img, 0, 0);
|
|
99
|
+
return canvas;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Register a `PackedSpriteAtlas` (and all of its named frames) directly onto a `@holtjs/stage` `Scene`
|
|
103
|
+
* in one call, using `scene.textures.exists(key)` safely.
|
|
104
|
+
*/
|
|
105
|
+
function registerAtlasOnStage(scene, textureKey, atlas, createCanvas) {
|
|
106
|
+
if (!scene.textures.exists(textureKey)) {
|
|
107
|
+
const canvas = writeRgbaToCanvas(atlas, createCanvas);
|
|
108
|
+
const tex = scene.textures.addCanvas(textureKey, canvas);
|
|
109
|
+
for (const f of Object.values(atlas.frames)) tex.add(f.key, 0, f.x, f.y, f.w, f.h);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export { writeRgbaToCanvas as i, packSpriteAtlas as n, registerAtlasOnStage as r, atlas_exports as t };
|
package/dist/atlas.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { PixelSpriteLike } from "./pixel.js";
|
|
2
|
+
export interface AtlasInputItem {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
readonly rgba: Uint8ClampedArray;
|
|
7
|
+
readonly normalRgba?: Uint8ClampedArray;
|
|
8
|
+
/** Optional sub-frames inside this strip/grid (relative to item `(0, 0)`). */
|
|
9
|
+
readonly subFrames?: ReadonlyArray<{
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly x: number;
|
|
12
|
+
readonly y: number;
|
|
13
|
+
readonly w: number;
|
|
14
|
+
readonly h: number;
|
|
15
|
+
readonly pivotX?: number;
|
|
16
|
+
readonly pivotY?: number;
|
|
17
|
+
}>;
|
|
18
|
+
readonly pivotX?: number;
|
|
19
|
+
readonly pivotY?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface PackedFrameRect {
|
|
22
|
+
readonly key: string;
|
|
23
|
+
readonly x: number;
|
|
24
|
+
readonly y: number;
|
|
25
|
+
readonly w: number;
|
|
26
|
+
readonly h: number;
|
|
27
|
+
readonly pivotX: number;
|
|
28
|
+
readonly pivotY: number;
|
|
29
|
+
}
|
|
30
|
+
export interface PackAtlasOptions {
|
|
31
|
+
readonly maxWidth?: number;
|
|
32
|
+
readonly padding?: number;
|
|
33
|
+
readonly powerOfTwo?: boolean;
|
|
34
|
+
readonly bakeNormals?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface PackedSpriteAtlas {
|
|
37
|
+
readonly width: number;
|
|
38
|
+
readonly height: number;
|
|
39
|
+
readonly rgba: Uint8ClampedArray;
|
|
40
|
+
readonly normalRgba?: Uint8ClampedArray;
|
|
41
|
+
readonly frames: Readonly<Record<string, PackedFrameRect>>;
|
|
42
|
+
toPng(): Uint8Array;
|
|
43
|
+
toNormalPng(): Uint8Array | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Pack multiple sprites, animation strips, or tilesets into one tight RGBA sprite atlas
|
|
47
|
+
* (plus optional synchronized tangent-space normal-map atlas) with border padding.
|
|
48
|
+
*/
|
|
49
|
+
export declare function packSpriteAtlas(items: readonly AtlasInputItem[], opts?: PackAtlasOptions): PackedSpriteAtlas;
|
|
50
|
+
/** Minimal structural interface matching `@holtjs/stage` `Scene` + canvas factory (zero runtime coupling). */
|
|
51
|
+
export interface StageSceneTextureHost {
|
|
52
|
+
readonly textures: {
|
|
53
|
+
exists(key: string): boolean;
|
|
54
|
+
addCanvas(key: string, canvas: unknown): {
|
|
55
|
+
add(name: string | number, sourceIndex: number, x: number, y: number, width: number, height: number): unknown;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface MinimalCanvas2D {
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
getContext(type: '2d'): {
|
|
63
|
+
createImageData(w: number, h: number): {
|
|
64
|
+
data: Uint8ClampedArray;
|
|
65
|
+
};
|
|
66
|
+
putImageData(img: unknown, x: number, y: number): void;
|
|
67
|
+
} | null;
|
|
68
|
+
}
|
|
69
|
+
/** Copy any `PixelSpriteLike` (`{ width, height, rgba }`) onto a browser or `@napi-rs/canvas` 2D canvas. */
|
|
70
|
+
export declare function writeRgbaToCanvas(sprite: PixelSpriteLike, createCanvas: (w: number, h: number) => MinimalCanvas2D): MinimalCanvas2D;
|
|
71
|
+
/**
|
|
72
|
+
* Register a `PackedSpriteAtlas` (and all of its named frames) directly onto a `@holtjs/stage` `Scene`
|
|
73
|
+
* in one call, using `scene.textures.exists(key)` safely.
|
|
74
|
+
*/
|
|
75
|
+
export declare function registerAtlasOnStage(scene: StageSceneTextureHost, textureKey: string, atlas: PackedSpriteAtlas, createCanvas: (w: number, h: number) => MinimalCanvas2D): void;
|
package/dist/atlas.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as packSpriteAtlas, r as registerAtlasOnStage, i as writeRgbaToCanvas } from "./atlas-Pc12eQsg.js";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { AsciiPixelGridSpec, CompilePixelGridOptions, PixelCanvas, PixelSpriteLike, Ramp4, Rgb, Rgba, compilePixelGrid, derivePaletteVariants, derivePixelRamp, encodePngRgba, mixRgb, parseHexRgb, rgbToHex } from "./pixel.js";
|
|
2
|
+
import { $ as RigBoneName, A as RigDecorGroup, At as RigBodyAttachBone, B as RIG_BONE_NAMES, Bt as RigClip, C as BUILTIN_ANIM_FRAMES, Ct as reachArm, D as RigBodyCategory, Dt as RIG_BODY_EYE_STYLES, E as RIG_DECOR_GROUPS, Et as RIG_BODY_ATTACH_BONES, F as Mat4, Ft as RigBodySpec, G as RIG_COS_E, Gt as RigPrimitiveSpec, H as RIG_CAMERA_GROUND_Y, Ht as RigKeyframe, I as MutVec3, It as RigBodyTailStyle, J as RIG_EYE_MODES, Jt as rigClipFrameCount, K as RIG_DUO_VIEW, Kt as RigPropInstance, L as ProjectedPoint2D, Lt as rigBodyKeyFromIndex, M as compileCustomBodySpec, Mt as RigBodyCustomColors, N as validateRigCustomBody, Nt as RigBodyEyeStyle, O as RigCustomBodyDefaultColors, Ot as RIG_BODY_KEYS, P as validateRigDecorProp, Pt as RigBodyKey, Q as RIG_SOCKET_NAMES, Qt as validateRigPrimitiveList, R as ProjectedSocket2D, Rt as RIG_PRIMITIVE_SHAPES, St as quatMul, T as RIG_BODY_CATEGORIES, Tt as RIG_BODIES, U as RIG_CELL_SIZE, Ut as RigPixelSpriteSpec, V as RIG_CAMERA_ELEV_DEG, Vt as RigCosmeticSpec, W as RIG_COSMETIC_SLOTS, Wt as RigPrimitiveShape, X as RIG_MODEL_SCALE, Xt as validateRigCosmetic, Y as RIG_LIMITS, Yt as validateRigClip, Z as RIG_SIN_E, Zt as validateRigPixelSprite, _ as renderRigPose, _t as projectWorldPoint2D, a as GRAVEYARD_PRESETS, at as RigSocketName, b as RigLookColors, bt as quatFromUnitVectors, c as DEFAULT_RIG_COLORS, ct as createRigState, d as renderBodyAnimStrip, dt as mat4Invert, et as RigBoneTransform, f as renderBodyRestPreview, ft as mat4Mul, g as renderRigClipStrip, gt as projectSocket2D, h as renderDecorPropSprite, ht as projectAllSockets2D, i as DirectionalSheetRowSpec, it as RigPoseState, j as RigDecorPropSpec, jt as RigBodyAttachment, k as RigCustomBodySpec, kt as RIG_BODY_TAIL_STYLES, l as RenderedRigCell, lt as getBodySockets, m as renderDecorPropSheet, mt as mat4TransformPoint, n as BakedCharacterSheet, nt as RigEaseMode, o as bakeDirectionalCharacterSheet, ot as SocketDefinition, p as renderCosmeticSprite, pt as mat4TransformDir, q as RIG_EASE_MODES, qt as evaluateRigClip, r as CharacterFrameMeta, rt as RigEyeMode, s as CompiledRigStrip, st as Vec3, t as BakeCharacterSheetOptions, tt as RigCosmeticSlot, u as compositeSpriteRgba, ut as mat4Compose, vt as quatFromAxisAngle, w as evaluateBuiltinPose, wt as updateRigMatrices, xt as quatIdentity, yt as quatFromEuler, z as Quat, zt as RigBonePoseOverride } from "./rig3d-DhTgbTbX.js";
|
|
3
|
+
import { BLOB47_CANONICAL_MASKS, BakedPixelTileset, PixelBlob47Spec, PixelDualGridSpec, TerrainTextureStyle, bakeNormalMapRgba, bakePixelBlob47Sheet, bakePixelDualGridSheet, computeBlob47Index, computeDualGridMask } from "./tilemap.js";
|
|
4
|
+
import { AtlasInputItem, MinimalCanvas2D, PackAtlasOptions, PackedFrameRect, PackedSpriteAtlas, StageSceneTextureHost, packSpriteAtlas, registerAtlasOnStage, writeRgbaToCanvas } from "./atlas.js";
|
|
5
|
+
import { ContactSheetItem, ContactSheetOptions, ContactSheetResult, InspectMarker, renderContactSheet } from "./inspect.js";
|
|
6
|
+
export declare const Craft: {
|
|
7
|
+
mixRgb: (a: Rgb, b: Rgb, t: number) => Rgb;
|
|
8
|
+
parseHexRgb(hex: string): Rgb;
|
|
9
|
+
rgbToHex(rgb: Rgb): string;
|
|
10
|
+
derivePixelRamp(hexOrRgb: string | Rgb): Ramp4;
|
|
11
|
+
derivePaletteVariants(baseHex: string, count?: number): Ramp4[];
|
|
12
|
+
PixelCanvas: typeof PixelCanvas;
|
|
13
|
+
compilePixelGrid(spec: AsciiPixelGridSpec, opts?: CompilePixelGridOptions): PixelCanvas;
|
|
14
|
+
encodePngRgba(width: number, height: number, rgba: Uint8Array | Uint8ClampedArray): Uint8Array;
|
|
15
|
+
computeDualGridMask(tl: boolean, tr: boolean, bl: boolean, br: boolean): number;
|
|
16
|
+
BLOB47_CANONICAL_MASKS: readonly number[];
|
|
17
|
+
computeBlob47Index(n: boolean, ne: boolean, e: boolean, se: boolean, s: boolean, sw: boolean, w: boolean, nw: boolean): number;
|
|
18
|
+
bakeNormalMapRgba(rgba: Uint8Array | Uint8ClampedArray, width: number, height: number, opts?: {
|
|
19
|
+
strength?: number;
|
|
20
|
+
alphaWeight?: number;
|
|
21
|
+
}): Uint8ClampedArray;
|
|
22
|
+
bakePixelDualGridSheet(spec: PixelDualGridSpec): BakedPixelTileset;
|
|
23
|
+
bakePixelBlob47Sheet(spec: PixelBlob47Spec): BakedPixelTileset;
|
|
24
|
+
packSpriteAtlas(items: readonly AtlasInputItem[], opts?: PackAtlasOptions): PackedSpriteAtlas;
|
|
25
|
+
writeRgbaToCanvas(sprite: PixelSpriteLike, createCanvas: (w: number, h: number) => MinimalCanvas2D): MinimalCanvas2D;
|
|
26
|
+
registerAtlasOnStage(scene: StageSceneTextureHost, textureKey: string, atlas: PackedSpriteAtlas, createCanvas: (w: number, h: number) => MinimalCanvas2D): void;
|
|
27
|
+
RIG_BODY_KEYS: readonly ["0", "A", "B", "C", "Y", "K", "M", "G"];
|
|
28
|
+
RIG_BODY_EYE_STYLES: readonly ["otter", "big", "cat", "dot", "blue"];
|
|
29
|
+
RIG_BODY_TAIL_STYLES: readonly ["otter", "cat", "fluffy", "curled", "stub"];
|
|
30
|
+
RIG_BODY_ATTACH_BONES: readonly ["head", "chest", "hips", "tail0", "armL", "armR"];
|
|
31
|
+
RIG_BODIES: Readonly<Record<"0" | "A" | "B" | "C" | "G" | "K" | "M" | "Y", RigBodySpec>>;
|
|
32
|
+
rigBodyKeyFromIndex: typeof rigBodyKeyFromIndex;
|
|
33
|
+
RIG_BONE_NAMES: readonly ["root", "hips", "chest", "neck", "head", "armL", "armR", "legL", "legR", "tail0", "tail1", "tail2"];
|
|
34
|
+
RIG_SOCKET_NAMES: readonly ["headTop", "face", "earL", "earR", "neck", "back", "waist", "handL", "handR"];
|
|
35
|
+
RIG_COSMETIC_SLOTS: readonly ["hat", "face", "neck", "back", "hand", "other"];
|
|
36
|
+
RIG_EYE_MODES: readonly ["open", "happy", "shut", "squeeze"];
|
|
37
|
+
RIG_EASE_MODES: readonly ["linear", "easeInOut", "easeOut", "step"];
|
|
38
|
+
RIG_MODEL_SCALE: 0.93;
|
|
39
|
+
RIG_CELL_SIZE: 32;
|
|
40
|
+
RIG_CAMERA_ELEV_DEG: 13;
|
|
41
|
+
RIG_CAMERA_GROUND_Y: 29;
|
|
42
|
+
RIG_DUO_VIEW: 2;
|
|
43
|
+
RIG_COS_E: number;
|
|
44
|
+
RIG_SIN_E: number;
|
|
45
|
+
RIG_LIMITS: {
|
|
46
|
+
readonly maxCosmeticPrimitives: 16;
|
|
47
|
+
readonly maxCosmeticPixelSize: 24;
|
|
48
|
+
readonly maxCustomBodyExtras: 12;
|
|
49
|
+
readonly maxCustomBodyPrimitives: 24;
|
|
50
|
+
readonly maxDecorPrimitives: 24;
|
|
51
|
+
readonly maxDecorPixelSize: 48;
|
|
52
|
+
readonly maxClipKeyframes: 16;
|
|
53
|
+
readonly maxClipProps: 4;
|
|
54
|
+
readonly maxClipDurationMs: 12000;
|
|
55
|
+
readonly minClipDurationMs: 120;
|
|
56
|
+
readonly maxClipFps: 12;
|
|
57
|
+
readonly minClipFps: 2;
|
|
58
|
+
readonly maxClipNameLen: 48;
|
|
59
|
+
};
|
|
60
|
+
quatIdentity: typeof quatIdentity;
|
|
61
|
+
quatMul: typeof quatMul;
|
|
62
|
+
quatFromEuler: typeof quatFromEuler;
|
|
63
|
+
quatFromAxisAngle: typeof quatFromAxisAngle;
|
|
64
|
+
quatFromUnitVectors: typeof quatFromUnitVectors;
|
|
65
|
+
mat4Compose: typeof mat4Compose;
|
|
66
|
+
mat4Mul: typeof mat4Mul;
|
|
67
|
+
mat4Invert: typeof mat4Invert;
|
|
68
|
+
mat4TransformPoint: typeof mat4TransformPoint;
|
|
69
|
+
mat4TransformDir: typeof mat4TransformDir;
|
|
70
|
+
createRigState: typeof createRigState;
|
|
71
|
+
updateRigMatrices: typeof updateRigMatrices;
|
|
72
|
+
reachArm: typeof reachArm;
|
|
73
|
+
getBodySockets: typeof getBodySockets;
|
|
74
|
+
projectWorldPoint2D: typeof projectWorldPoint2D;
|
|
75
|
+
projectSocket2D: typeof projectSocket2D;
|
|
76
|
+
projectAllSockets2D: typeof projectAllSockets2D;
|
|
77
|
+
BUILTIN_ANIM_FRAMES: Readonly<Record<string, {
|
|
78
|
+
readonly frames: number;
|
|
79
|
+
readonly dirs: number;
|
|
80
|
+
}>>;
|
|
81
|
+
evaluateBuiltinPose(bodyOrKey: RigBodyKey | RigBodySpec, anim: string, frame?: number, dir16?: number): RigPoseState;
|
|
82
|
+
RIG_PRIMITIVE_SHAPES: readonly ["ellipsoid", "box", "cone", "capsule", "cylinder", "torus"];
|
|
83
|
+
validateRigCosmetic: typeof validateRigCosmetic;
|
|
84
|
+
validateRigClip: typeof validateRigClip;
|
|
85
|
+
validateRigPrimitiveList: typeof validateRigPrimitiveList;
|
|
86
|
+
validateRigPixelSprite: typeof validateRigPixelSprite;
|
|
87
|
+
evaluateRigClip: typeof evaluateRigClip;
|
|
88
|
+
rigClipFrameCount: typeof rigClipFrameCount;
|
|
89
|
+
RIG_BODY_CATEGORIES: readonly ["animal", "character"];
|
|
90
|
+
RIG_DECOR_GROUPS: readonly ["office", "pet", "nature", "decor", "game"];
|
|
91
|
+
validateRigCustomBody: typeof validateRigCustomBody;
|
|
92
|
+
compileCustomBodySpec: typeof compileCustomBodySpec;
|
|
93
|
+
validateRigDecorProp: typeof validateRigDecorProp;
|
|
94
|
+
DEFAULT_RIG_COLORS: RigLookColors;
|
|
95
|
+
renderRigPose(state: RigPoseState, opts?: {
|
|
96
|
+
colors?: RigLookColors;
|
|
97
|
+
cosmetics?: readonly RigCosmeticSpec[];
|
|
98
|
+
cellSize?: number;
|
|
99
|
+
ss?: number;
|
|
100
|
+
}): RenderedRigCell;
|
|
101
|
+
renderRigClipStrip(bodyOrKey: RigBodyKey | RigBodySpec, clip: RigClip, dir16?: number, opts?: {
|
|
102
|
+
colors?: RigLookColors;
|
|
103
|
+
cosmetics?: readonly RigCosmeticSpec[];
|
|
104
|
+
cellSize?: number;
|
|
105
|
+
ss?: number;
|
|
106
|
+
}): CompiledRigStrip;
|
|
107
|
+
renderBodyAnimStrip(bodyOrKey: RigBodyKey | RigBodySpec, anim: string, dir16?: number, opts?: {
|
|
108
|
+
colors?: RigLookColors;
|
|
109
|
+
cosmetics?: readonly RigCosmeticSpec[];
|
|
110
|
+
cellSize?: number;
|
|
111
|
+
ss?: number;
|
|
112
|
+
}): CompiledRigStrip;
|
|
113
|
+
renderCosmeticSprite(cosmetic: RigCosmeticSpec, dir16?: number, opts?: {
|
|
114
|
+
size?: number;
|
|
115
|
+
ss?: number;
|
|
116
|
+
}): RenderedRigCell;
|
|
117
|
+
compositeSpriteRgba(dst: Uint8ClampedArray, dstW: number, dstH: number, src: RenderedRigCell, cx: number, cy: number, behind?: boolean): void;
|
|
118
|
+
renderDecorPropSprite(spec: RigDecorPropSpec, dir4?: number, opts?: {
|
|
119
|
+
ss?: number;
|
|
120
|
+
}): RenderedRigCell;
|
|
121
|
+
renderDecorPropSheet(spec: RigDecorPropSpec, opts?: {
|
|
122
|
+
ss?: number;
|
|
123
|
+
}): {
|
|
124
|
+
readonly width: number;
|
|
125
|
+
readonly height: number;
|
|
126
|
+
readonly frameW: number;
|
|
127
|
+
readonly frameH: number;
|
|
128
|
+
readonly dirs: 1 | 4;
|
|
129
|
+
readonly rgba: Uint8ClampedArray;
|
|
130
|
+
};
|
|
131
|
+
renderBodyRestPreview(bodyOrKey: RigBodyKey | RigBodySpec, dir16?: number, colors?: RigLookColors): RenderedRigCell;
|
|
132
|
+
bakeDirectionalCharacterSheet(bodyOrCustom: RigBodyKey | RigBodySpec | RigCustomBodySpec, opts?: BakeCharacterSheetOptions): BakedCharacterSheet;
|
|
133
|
+
GRAVEYARD_PRESETS: {
|
|
134
|
+
readonly keeperBody: RigCustomBodySpec;
|
|
135
|
+
readonly zombieBody: RigCustomBodySpec;
|
|
136
|
+
readonly cosmetics: {
|
|
137
|
+
readonly ironAxe: RigCosmeticSpec;
|
|
138
|
+
readonly blazingTorch: RigCosmeticSpec;
|
|
139
|
+
};
|
|
140
|
+
readonly clips: {
|
|
141
|
+
readonly chop: RigClip;
|
|
142
|
+
readonly shamble: RigClip;
|
|
143
|
+
};
|
|
144
|
+
readonly props: {
|
|
145
|
+
readonly tombstone: RigDecorPropSpec;
|
|
146
|
+
readonly woodenChest: RigDecorPropSpec;
|
|
147
|
+
readonly stoneFurnace: RigDecorPropSpec;
|
|
148
|
+
readonly arrowTower: RigDecorPropSpec;
|
|
149
|
+
readonly ancientPine: RigDecorPropSpec;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
renderContactSheet(items: readonly ContactSheetItem[], opts?: ContactSheetOptions): ContactSheetResult;
|
|
153
|
+
};
|
|
154
|
+
export { AsciiPixelGridSpec, AtlasInputItem, BLOB47_CANONICAL_MASKS, BUILTIN_ANIM_FRAMES, type BakeCharacterSheetOptions, type BakedCharacterSheet, BakedPixelTileset, type CharacterFrameMeta, CompilePixelGridOptions, type CompiledRigStrip, ContactSheetItem, ContactSheetOptions, ContactSheetResult, Craft as default, DEFAULT_RIG_COLORS, type DirectionalSheetRowSpec, GRAVEYARD_PRESETS, InspectMarker, type Mat4, MinimalCanvas2D, type MutVec3, PackAtlasOptions, PackedFrameRect, PackedSpriteAtlas, PixelBlob47Spec, PixelCanvas, PixelDualGridSpec, PixelSpriteLike, type ProjectedPoint2D, type ProjectedSocket2D, type Quat, RIG_BODIES, RIG_BODY_ATTACH_BONES, RIG_BODY_CATEGORIES, RIG_BODY_EYE_STYLES, RIG_BODY_KEYS, RIG_BODY_TAIL_STYLES, RIG_BONE_NAMES, RIG_CAMERA_ELEV_DEG, RIG_CAMERA_GROUND_Y, RIG_CELL_SIZE, RIG_COSMETIC_SLOTS, RIG_COS_E, RIG_DECOR_GROUPS, RIG_DUO_VIEW, RIG_EASE_MODES, RIG_EYE_MODES, RIG_LIMITS, RIG_MODEL_SCALE, RIG_PRIMITIVE_SHAPES, RIG_SIN_E, RIG_SOCKET_NAMES, Ramp4, type RenderedRigCell, Rgb, Rgba, type RigBodyAttachBone, type RigBodyAttachment, type RigBodyCategory, type RigBodyCustomColors, type RigBodyEyeStyle, type RigBodyKey, type RigBodySpec, type RigBodyTailStyle, type RigBoneName, type RigBonePoseOverride, type RigBoneTransform, type RigClip, type RigCosmeticSlot, type RigCosmeticSpec, type RigCustomBodyDefaultColors, type RigCustomBodySpec, type RigDecorGroup, type RigDecorPropSpec, type RigEaseMode, type RigEyeMode, type RigKeyframe, type RigLookColors, type RigPixelSpriteSpec, type RigPoseState, type RigPrimitiveShape, type RigPrimitiveSpec, type RigPropInstance, type RigSocketName, type SocketDefinition, StageSceneTextureHost, TerrainTextureStyle, type Vec3, bakeDirectionalCharacterSheet, bakeNormalMapRgba, bakePixelBlob47Sheet, bakePixelDualGridSheet, compileCustomBodySpec, compilePixelGrid, compositeSpriteRgba, computeBlob47Index, computeDualGridMask, createRigState, derivePaletteVariants, derivePixelRamp, encodePngRgba, evaluateBuiltinPose, evaluateRigClip, getBodySockets, mat4Compose, mat4Invert, mat4Mul, mat4TransformDir, mat4TransformPoint, mixRgb, packSpriteAtlas, parseHexRgb, projectAllSockets2D, projectSocket2D, projectWorldPoint2D, quatFromAxisAngle, quatFromEuler, quatFromUnitVectors, quatIdentity, quatMul, reachArm, registerAtlasOnStage, renderBodyAnimStrip, renderBodyRestPreview, renderContactSheet, renderCosmeticSprite, renderDecorPropSheet, renderDecorPropSprite, renderRigClipStrip, renderRigPose, rgbToHex, rigBodyKeyFromIndex, rigClipFrameCount, updateRigMatrices, validateRigClip, validateRigCosmetic, validateRigCustomBody, validateRigDecorProp, validateRigPixelSprite, validateRigPrimitiveList, writeRgbaToCanvas };
|