@multiplekex/shallot 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -23
- package/src/standard/compute/index.ts +36 -0
- package/src/standard/render/camera.ts +1 -1
- package/dist/core/builder.d.ts +0 -25
- package/dist/core/builder.d.ts.map +0 -1
- package/dist/core/builder.js +0 -88
- package/dist/core/builder.js.map +0 -1
- package/dist/core/component.d.ts +0 -29
- package/dist/core/component.d.ts.map +0 -1
- package/dist/core/component.js +0 -36
- package/dist/core/component.js.map +0 -1
- package/dist/core/index.d.ts +0 -13
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/math.d.ts +0 -32
- package/dist/core/math.d.ts.map +0 -1
- package/dist/core/math.js +0 -39
- package/dist/core/math.js.map +0 -1
- package/dist/core/relation.d.ts +0 -16
- package/dist/core/relation.d.ts.map +0 -1
- package/dist/core/relation.js +0 -32
- package/dist/core/relation.js.map +0 -1
- package/dist/core/resource.d.ts +0 -9
- package/dist/core/resource.d.ts.map +0 -1
- package/dist/core/resource.js +0 -12
- package/dist/core/resource.js.map +0 -1
- package/dist/core/runtime.d.ts +0 -13
- package/dist/core/runtime.d.ts.map +0 -1
- package/dist/core/runtime.js +0 -118
- package/dist/core/runtime.js.map +0 -1
- package/dist/core/scheduler.d.ts +0 -47
- package/dist/core/scheduler.d.ts.map +0 -1
- package/dist/core/scheduler.js +0 -138
- package/dist/core/scheduler.js.map +0 -1
- package/dist/core/state.d.ts +0 -62
- package/dist/core/state.d.ts.map +0 -1
- package/dist/core/state.js +0 -185
- package/dist/core/state.js.map +0 -1
- package/dist/core/strings.d.ts +0 -3
- package/dist/core/strings.d.ts.map +0 -1
- package/dist/core/strings.js +0 -11
- package/dist/core/strings.js.map +0 -1
- package/dist/core/types.d.ts +0 -33
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/xml.d.ts +0 -42
- package/dist/core/xml.d.ts.map +0 -1
- package/dist/core/xml.js +0 -349
- package/dist/core/xml.js.map +0 -1
- package/dist/extras/arrows/index.d.ts +0 -33
- package/dist/extras/arrows/index.d.ts.map +0 -1
- package/dist/extras/arrows/index.js +0 -288
- package/dist/extras/arrows/index.js.map +0 -1
- package/dist/extras/index.d.ts +0 -5
- package/dist/extras/index.d.ts.map +0 -1
- package/dist/extras/index.js +0 -31
- package/dist/extras/index.js.map +0 -1
- package/dist/extras/lines/index.d.ts +0 -36
- package/dist/extras/lines/index.d.ts.map +0 -1
- package/dist/extras/lines/index.js +0 -288
- package/dist/extras/lines/index.js.map +0 -1
- package/dist/extras/orbit/index.d.ts +0 -20
- package/dist/extras/orbit/index.d.ts.map +0 -1
- package/dist/extras/orbit/index.js +0 -93
- package/dist/extras/orbit/index.js.map +0 -1
- package/dist/extras/text/index.d.ts +0 -64
- package/dist/extras/text/index.d.ts.map +0 -1
- package/dist/extras/text/index.js +0 -423
- package/dist/extras/text/index.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -187
- package/dist/index.js.map +0 -1
- package/dist/rust/transforms/pkg/shallot_transforms.js +0 -107
- package/dist/rust/transforms/pkg/shallot_transforms.js.map +0 -1
- package/dist/standard/compute/graph.d.ts +0 -37
- package/dist/standard/compute/graph.d.ts.map +0 -1
- package/dist/standard/compute/graph.js +0 -85
- package/dist/standard/compute/graph.js.map +0 -1
- package/dist/standard/compute/index.d.ts +0 -21
- package/dist/standard/compute/index.d.ts.map +0 -1
- package/dist/standard/compute/index.js +0 -81
- package/dist/standard/compute/index.js.map +0 -1
- package/dist/standard/defaults.d.ts +0 -3
- package/dist/standard/defaults.d.ts.map +0 -1
- package/dist/standard/defaults.js +0 -18
- package/dist/standard/defaults.js.map +0 -1
- package/dist/standard/index.d.ts +0 -8
- package/dist/standard/index.d.ts.map +0 -1
- package/dist/standard/input/index.d.ts +0 -5
- package/dist/standard/input/index.d.ts.map +0 -1
- package/dist/standard/input/index.js +0 -70
- package/dist/standard/input/index.js.map +0 -1
- package/dist/standard/loading/index.d.ts +0 -7
- package/dist/standard/loading/index.d.ts.map +0 -1
- package/dist/standard/loading/index.js +0 -91
- package/dist/standard/loading/index.js.map +0 -1
- package/dist/standard/render/camera.d.ts +0 -36
- package/dist/standard/render/camera.d.ts.map +0 -1
- package/dist/standard/render/camera.js +0 -71
- package/dist/standard/render/camera.js.map +0 -1
- package/dist/standard/render/forward.d.ts +0 -30
- package/dist/standard/render/forward.d.ts.map +0 -1
- package/dist/standard/render/forward.js +0 -158
- package/dist/standard/render/forward.js.map +0 -1
- package/dist/standard/render/index.d.ts +0 -22
- package/dist/standard/render/index.d.ts.map +0 -1
- package/dist/standard/render/index.js +0 -153
- package/dist/standard/render/index.js.map +0 -1
- package/dist/standard/render/light.d.ts +0 -25
- package/dist/standard/render/light.d.ts.map +0 -1
- package/dist/standard/render/light.js +0 -48
- package/dist/standard/render/light.js.map +0 -1
- package/dist/standard/render/mesh/box.d.ts +0 -3
- package/dist/standard/render/mesh/box.d.ts.map +0 -1
- package/dist/standard/render/mesh/box.js +0 -190
- package/dist/standard/render/mesh/box.js.map +0 -1
- package/dist/standard/render/mesh/index.d.ts +0 -52
- package/dist/standard/render/mesh/index.d.ts.map +0 -1
- package/dist/standard/render/mesh/index.js +0 -158
- package/dist/standard/render/mesh/index.js.map +0 -1
- package/dist/standard/render/mesh/plane.d.ts +0 -3
- package/dist/standard/render/mesh/plane.d.ts.map +0 -1
- package/dist/standard/render/mesh/plane.js +0 -33
- package/dist/standard/render/mesh/plane.js.map +0 -1
- package/dist/standard/render/mesh/sphere.d.ts +0 -3
- package/dist/standard/render/mesh/sphere.d.ts.map +0 -1
- package/dist/standard/render/mesh/sphere.js +0 -25
- package/dist/standard/render/mesh/sphere.js.map +0 -1
- package/dist/standard/render/postprocess.d.ts +0 -11
- package/dist/standard/render/postprocess.d.ts.map +0 -1
- package/dist/standard/render/postprocess.js +0 -190
- package/dist/standard/render/postprocess.js.map +0 -1
- package/dist/standard/render/scene.d.ts +0 -8
- package/dist/standard/render/scene.d.ts.map +0 -1
- package/dist/standard/render/scene.js +0 -67
- package/dist/standard/render/scene.js.map +0 -1
- package/dist/standard/transforms/index.d.ts +0 -27
- package/dist/standard/transforms/index.d.ts.map +0 -1
- package/dist/standard/transforms/index.js +0 -122
- package/dist/standard/transforms/index.js.map +0 -1
- package/dist/standard/transforms/wasm.d.ts +0 -17
- package/dist/standard/transforms/wasm.d.ts.map +0 -1
- package/dist/standard/transforms/wasm.js +0 -31
- package/dist/standard/transforms/wasm.js.map +0 -1
- package/dist/standard/tween/easing.d.ts +0 -5
- package/dist/standard/tween/easing.d.ts.map +0 -1
- package/dist/standard/tween/easing.js +0 -80
- package/dist/standard/tween/easing.js.map +0 -1
- package/dist/standard/tween/index.d.ts +0 -4
- package/dist/standard/tween/index.d.ts.map +0 -1
- package/dist/standard/tween/sequence.d.ts +0 -20
- package/dist/standard/tween/sequence.d.ts.map +0 -1
- package/dist/standard/tween/sequence.js +0 -95
- package/dist/standard/tween/sequence.js.map +0 -1
- package/dist/standard/tween/tween.d.ts +0 -28
- package/dist/standard/tween/tween.d.ts.map +0 -1
- package/dist/standard/tween/tween.js +0 -136
- package/dist/standard/tween/tween.js.map +0 -1
- package/src/vite-env.d.ts +0 -6
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
import z from "@mapbox/tiny-sdf";
|
|
2
|
-
import "bitecs";
|
|
3
|
-
import { MAX_ENTITIES as M } from "../../core/state.js";
|
|
4
|
-
import "../../core/builder.js";
|
|
5
|
-
import { resource as I } from "../../core/resource.js";
|
|
6
|
-
import { setTraits as A } from "../../core/component.js";
|
|
7
|
-
import "../../core/relation.js";
|
|
8
|
-
import "../../core/math.js";
|
|
9
|
-
import "fast-xml-parser";
|
|
10
|
-
import { ComputePlugin as C, Compute as S } from "../../standard/compute/index.js";
|
|
11
|
-
import { RenderPlugin as U, Render as D } from "../../standard/render/index.js";
|
|
12
|
-
import { Transform as y } from "../../standard/transforms/index.js";
|
|
13
|
-
const P = 5e4, v = 16, T = {
|
|
14
|
-
data: new Float32Array(M * 12)
|
|
15
|
-
};
|
|
16
|
-
function g(r) {
|
|
17
|
-
const t = T.data;
|
|
18
|
-
function n(e) {
|
|
19
|
-
return t[e * 12 + r];
|
|
20
|
-
}
|
|
21
|
-
function c(e, o) {
|
|
22
|
-
t[e * 12 + r] = o;
|
|
23
|
-
}
|
|
24
|
-
return new Proxy([], {
|
|
25
|
-
get(e, o) {
|
|
26
|
-
if (o === "get") return n;
|
|
27
|
-
if (o === "set") return c;
|
|
28
|
-
const i = Number(o);
|
|
29
|
-
if (!Number.isNaN(i))
|
|
30
|
-
return n(i);
|
|
31
|
-
},
|
|
32
|
-
set(e, o, i) {
|
|
33
|
-
const a = Number(o);
|
|
34
|
-
return Number.isNaN(a) ? !1 : (c(a, i), !0);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function R() {
|
|
39
|
-
const r = T.data;
|
|
40
|
-
function t(c) {
|
|
41
|
-
const e = c * 12 + 8, o = Math.round(r[e] * 255), i = Math.round(r[e + 1] * 255), a = Math.round(r[e + 2] * 255);
|
|
42
|
-
return o << 16 | i << 8 | a;
|
|
43
|
-
}
|
|
44
|
-
function n(c, e) {
|
|
45
|
-
const o = c * 12 + 8;
|
|
46
|
-
r[o] = (e >> 16 & 255) / 255, r[o + 1] = (e >> 8 & 255) / 255, r[o + 2] = (e & 255) / 255, r[o + 3] = 1;
|
|
47
|
-
}
|
|
48
|
-
return new Proxy([], {
|
|
49
|
-
get(c, e) {
|
|
50
|
-
if (e === "get") return t;
|
|
51
|
-
if (e === "set") return n;
|
|
52
|
-
const o = Number(e);
|
|
53
|
-
if (!Number.isNaN(o))
|
|
54
|
-
return t(o);
|
|
55
|
-
},
|
|
56
|
-
set(c, e, o) {
|
|
57
|
-
const i = Number(e);
|
|
58
|
-
return Number.isNaN(i) ? !1 : (n(i, o), !0);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
const l = {
|
|
63
|
-
fontSize: g(0),
|
|
64
|
-
opacity: g(1),
|
|
65
|
-
visible: g(2),
|
|
66
|
-
anchorX: g(3),
|
|
67
|
-
anchorY: g(4),
|
|
68
|
-
color: R()
|
|
69
|
-
};
|
|
70
|
-
A(l, {
|
|
71
|
-
defaults: () => ({
|
|
72
|
-
fontSize: 1,
|
|
73
|
-
opacity: 1,
|
|
74
|
-
visible: 1,
|
|
75
|
-
anchorX: 0,
|
|
76
|
-
anchorY: 0,
|
|
77
|
-
color: 16777215
|
|
78
|
-
}),
|
|
79
|
-
accessors: {
|
|
80
|
-
fontSize: l.fontSize,
|
|
81
|
-
opacity: l.opacity,
|
|
82
|
-
visible: l.visible,
|
|
83
|
-
anchorX: l.anchorX,
|
|
84
|
-
anchorY: l.anchorY,
|
|
85
|
-
color: l.color
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
function B(r) {
|
|
89
|
-
const e = r.createTexture({
|
|
90
|
-
size: { width: 1024, height: 1024 },
|
|
91
|
-
format: "r8unorm",
|
|
92
|
-
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST,
|
|
93
|
-
label: "glyphAtlas"
|
|
94
|
-
}), o = new z({
|
|
95
|
-
fontSize: 32,
|
|
96
|
-
fontFamily: "monospace",
|
|
97
|
-
fontWeight: "normal",
|
|
98
|
-
fontStyle: "normal",
|
|
99
|
-
buffer: 3,
|
|
100
|
-
radius: 8,
|
|
101
|
-
cutoff: 0.5
|
|
102
|
-
});
|
|
103
|
-
return {
|
|
104
|
-
texture: e,
|
|
105
|
-
textureView: e.createView(),
|
|
106
|
-
width: 1024,
|
|
107
|
-
height: 1024,
|
|
108
|
-
glyphs: /* @__PURE__ */ new Map(),
|
|
109
|
-
rowHeight: 0,
|
|
110
|
-
cursorX: 0,
|
|
111
|
-
cursorY: 0,
|
|
112
|
-
sdf: o,
|
|
113
|
-
sdfFontSize: 32
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function L(r, t, n) {
|
|
117
|
-
const c = t.glyphs.get(n);
|
|
118
|
-
if (c) return c;
|
|
119
|
-
const e = t.sdf.draw(n);
|
|
120
|
-
if (t.cursorX + e.width > t.width && (t.cursorX = 0, t.cursorY += t.rowHeight, t.rowHeight = 0), t.cursorY + e.height > t.height)
|
|
121
|
-
throw new Error("Glyph atlas full");
|
|
122
|
-
const o = new Uint8Array(e.data.length);
|
|
123
|
-
o.set(e.data), r.queue.writeTexture(
|
|
124
|
-
{
|
|
125
|
-
texture: t.texture,
|
|
126
|
-
origin: { x: t.cursorX, y: t.cursorY }
|
|
127
|
-
},
|
|
128
|
-
o,
|
|
129
|
-
{ bytesPerRow: e.width },
|
|
130
|
-
{ width: e.width, height: e.height }
|
|
131
|
-
);
|
|
132
|
-
const i = {
|
|
133
|
-
width: e.width,
|
|
134
|
-
height: e.height,
|
|
135
|
-
glyphWidth: e.glyphWidth,
|
|
136
|
-
glyphHeight: e.glyphHeight,
|
|
137
|
-
glyphTop: e.glyphTop,
|
|
138
|
-
glyphLeft: e.glyphLeft,
|
|
139
|
-
advance: e.glyphAdvance,
|
|
140
|
-
u0: t.cursorX / t.width,
|
|
141
|
-
v0: t.cursorY / t.height,
|
|
142
|
-
u1: (t.cursorX + e.width) / t.width,
|
|
143
|
-
v1: (t.cursorY + e.height) / t.height
|
|
144
|
-
};
|
|
145
|
-
return t.glyphs.set(n, i), t.cursorX += e.width, t.rowHeight = Math.max(t.rowHeight, e.height), i;
|
|
146
|
-
}
|
|
147
|
-
function E(r, t, n) {
|
|
148
|
-
for (const c of n)
|
|
149
|
-
L(r, t, c);
|
|
150
|
-
}
|
|
151
|
-
function W(r, t, n) {
|
|
152
|
-
const c = [], e = n / t.sdfFontSize;
|
|
153
|
-
let o = 0, i = 0;
|
|
154
|
-
for (const a of r) {
|
|
155
|
-
const s = t.glyphs.get(a);
|
|
156
|
-
if (!s) continue;
|
|
157
|
-
const h = s.glyphWidth * e, d = s.glyphHeight * e, p = s.advance * e, x = o + s.glyphLeft * e, w = (s.glyphTop - s.glyphHeight) * e;
|
|
158
|
-
c.push({
|
|
159
|
-
x,
|
|
160
|
-
y: w,
|
|
161
|
-
width: h,
|
|
162
|
-
height: d,
|
|
163
|
-
u0: s.u0,
|
|
164
|
-
v0: s.v0,
|
|
165
|
-
u1: s.u1,
|
|
166
|
-
v1: s.v1
|
|
167
|
-
}), o += p, i = Math.max(i, d);
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
glyphs: c,
|
|
171
|
-
width: o,
|
|
172
|
-
height: i
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
const Z = (
|
|
176
|
-
/* wgsl */
|
|
177
|
-
`
|
|
178
|
-
struct Scene {
|
|
179
|
-
viewProj: mat4x4<f32>,
|
|
180
|
-
cameraWorld: mat4x4<f32>,
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
struct GlyphInstance {
|
|
184
|
-
posX: f32,
|
|
185
|
-
posY: f32,
|
|
186
|
-
posZ: f32,
|
|
187
|
-
_pad0: f32,
|
|
188
|
-
width: f32,
|
|
189
|
-
height: f32,
|
|
190
|
-
_pad1: vec2<f32>,
|
|
191
|
-
u0: f32,
|
|
192
|
-
v0: f32,
|
|
193
|
-
u1: f32,
|
|
194
|
-
v1: f32,
|
|
195
|
-
color: vec4<f32>,
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@group(0) @binding(0) var<uniform> scene: Scene;
|
|
199
|
-
@group(0) @binding(1) var<storage, read> glyphs: array<GlyphInstance>;
|
|
200
|
-
@group(0) @binding(2) var atlasTexture: texture_2d<f32>;
|
|
201
|
-
@group(0) @binding(3) var atlasSampler: sampler;
|
|
202
|
-
|
|
203
|
-
struct VertexOutput {
|
|
204
|
-
@builtin(position) position: vec4<f32>,
|
|
205
|
-
@location(0) uv: vec2<f32>,
|
|
206
|
-
@location(1) color: vec4<f32>,
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const SDF_SMOOTHING: f32 = 0.1;
|
|
210
|
-
|
|
211
|
-
@vertex
|
|
212
|
-
fn vs(@builtin(vertex_index) vid: u32) -> VertexOutput {
|
|
213
|
-
let glyphIdx = vid / 6u;
|
|
214
|
-
let cornerIdx = vid % 6u;
|
|
215
|
-
|
|
216
|
-
let glyph = glyphs[glyphIdx];
|
|
217
|
-
|
|
218
|
-
var localPos: vec2<f32>;
|
|
219
|
-
var uv: vec2<f32>;
|
|
220
|
-
|
|
221
|
-
switch cornerIdx {
|
|
222
|
-
case 0u: {
|
|
223
|
-
localPos = vec2(0.0, 0.0);
|
|
224
|
-
uv = vec2(glyph.u0, glyph.v1);
|
|
225
|
-
}
|
|
226
|
-
case 1u: {
|
|
227
|
-
localPos = vec2(1.0, 0.0);
|
|
228
|
-
uv = vec2(glyph.u1, glyph.v1);
|
|
229
|
-
}
|
|
230
|
-
case 2u: {
|
|
231
|
-
localPos = vec2(1.0, 1.0);
|
|
232
|
-
uv = vec2(glyph.u1, glyph.v0);
|
|
233
|
-
}
|
|
234
|
-
case 3u: {
|
|
235
|
-
localPos = vec2(0.0, 0.0);
|
|
236
|
-
uv = vec2(glyph.u0, glyph.v1);
|
|
237
|
-
}
|
|
238
|
-
case 4u: {
|
|
239
|
-
localPos = vec2(1.0, 1.0);
|
|
240
|
-
uv = vec2(glyph.u1, glyph.v0);
|
|
241
|
-
}
|
|
242
|
-
case 5u: {
|
|
243
|
-
localPos = vec2(0.0, 1.0);
|
|
244
|
-
uv = vec2(glyph.u0, glyph.v0);
|
|
245
|
-
}
|
|
246
|
-
default: {
|
|
247
|
-
localPos = vec2(0.0);
|
|
248
|
-
uv = vec2(0.0);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
let worldPos = vec3(
|
|
253
|
-
glyph.posX + localPos.x * glyph.width,
|
|
254
|
-
glyph.posY + localPos.y * glyph.height,
|
|
255
|
-
glyph.posZ
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
var out: VertexOutput;
|
|
259
|
-
out.position = scene.viewProj * vec4(worldPos, 1.0);
|
|
260
|
-
out.uv = uv;
|
|
261
|
-
out.color = glyph.color;
|
|
262
|
-
return out;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
@fragment
|
|
266
|
-
fn fs(input: VertexOutput) -> @location(0) vec4<f32> {
|
|
267
|
-
let sdfValue = textureSample(atlasTexture, atlasSampler, input.uv).r;
|
|
268
|
-
let alpha = smoothstep(0.5 - SDF_SMOOTHING, 0.5 + SDF_SMOOTHING, sdfValue);
|
|
269
|
-
|
|
270
|
-
if alpha < 0.01 {
|
|
271
|
-
discard;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return vec4(input.color.rgb, input.color.a * alpha);
|
|
275
|
-
}
|
|
276
|
-
`
|
|
277
|
-
);
|
|
278
|
-
function q(r, t) {
|
|
279
|
-
const n = r.createShaderModule({ code: Z });
|
|
280
|
-
return r.createRenderPipeline({
|
|
281
|
-
layout: "auto",
|
|
282
|
-
vertex: {
|
|
283
|
-
module: n,
|
|
284
|
-
entryPoint: "vs"
|
|
285
|
-
},
|
|
286
|
-
fragment: {
|
|
287
|
-
module: n,
|
|
288
|
-
entryPoint: "fs",
|
|
289
|
-
targets: [
|
|
290
|
-
{
|
|
291
|
-
format: t,
|
|
292
|
-
blend: {
|
|
293
|
-
color: {
|
|
294
|
-
srcFactor: "src-alpha",
|
|
295
|
-
dstFactor: "one-minus-src-alpha",
|
|
296
|
-
operation: "add"
|
|
297
|
-
},
|
|
298
|
-
alpha: {
|
|
299
|
-
srcFactor: "one",
|
|
300
|
-
dstFactor: "one-minus-src-alpha",
|
|
301
|
-
operation: "add"
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
]
|
|
306
|
-
},
|
|
307
|
-
primitive: {
|
|
308
|
-
topology: "triangle-list",
|
|
309
|
-
cullMode: "none"
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
function j(r) {
|
|
314
|
-
let t = null, n = null;
|
|
315
|
-
return {
|
|
316
|
-
id: "text",
|
|
317
|
-
phase: "overlay",
|
|
318
|
-
inputs: [],
|
|
319
|
-
outputs: [],
|
|
320
|
-
execute(c) {
|
|
321
|
-
const e = r.getCount();
|
|
322
|
-
if (e === 0) return;
|
|
323
|
-
const { device: o, encoder: i, format: a } = c, s = c.getTextureView("scene") ?? c.canvasView;
|
|
324
|
-
t || (t = q(o, a)), n || (n = o.createBindGroup({
|
|
325
|
-
layout: t.getBindGroupLayout(0),
|
|
326
|
-
entries: [
|
|
327
|
-
{ binding: 0, resource: { buffer: r.scene } },
|
|
328
|
-
{ binding: 1, resource: { buffer: r.glyphs } },
|
|
329
|
-
{ binding: 2, resource: r.atlas },
|
|
330
|
-
{ binding: 3, resource: r.sampler }
|
|
331
|
-
]
|
|
332
|
-
}));
|
|
333
|
-
const h = i.beginRenderPass({
|
|
334
|
-
colorAttachments: [
|
|
335
|
-
{
|
|
336
|
-
view: s,
|
|
337
|
-
loadOp: "load",
|
|
338
|
-
storeOp: "store"
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
});
|
|
342
|
-
h.setPipeline(t), h.setBindGroup(0, n), h.draw(e * 6), h.end();
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
const m = I("text");
|
|
347
|
-
function ue(r, t, n) {
|
|
348
|
-
const c = m.from(r);
|
|
349
|
-
c && c.content.set(t, n);
|
|
350
|
-
}
|
|
351
|
-
function ae(r, t) {
|
|
352
|
-
return m.from(r)?.content.get(t);
|
|
353
|
-
}
|
|
354
|
-
const k = {
|
|
355
|
-
group: "draw",
|
|
356
|
-
update(r) {
|
|
357
|
-
const t = S.from(r), n = m.from(r);
|
|
358
|
-
if (!t || !n) return;
|
|
359
|
-
const { device: c } = t, { atlas: e, staging: o, content: i } = n;
|
|
360
|
-
let a = 0;
|
|
361
|
-
for (const s of r.query([l, y])) {
|
|
362
|
-
if (!l.visible[s]) continue;
|
|
363
|
-
const h = i.get(s);
|
|
364
|
-
if (!h) continue;
|
|
365
|
-
E(c, e, h);
|
|
366
|
-
const d = l.fontSize[s], p = W(h, e, d), x = l.anchorX[s], w = l.anchorY[s], N = -p.width * x, X = -p.height * w, Y = y.posX[s] + N, G = y.posY[s] + X, _ = y.posZ[s], b = l.color[s], F = (b >> 16 & 255) / 255, H = (b >> 8 & 255) / 255, O = (b & 255) / 255, V = l.opacity[s];
|
|
367
|
-
for (const f of p.glyphs) {
|
|
368
|
-
if (a >= P) break;
|
|
369
|
-
const u = a * v;
|
|
370
|
-
o[u + 0] = Y + f.x, o[u + 1] = G + f.y, o[u + 2] = _, o[u + 3] = 0, o[u + 4] = f.width, o[u + 5] = f.height, o[u + 6] = 0, o[u + 7] = 0, o[u + 8] = f.u0, o[u + 9] = f.v0, o[u + 10] = f.u1, o[u + 11] = f.v1, o[u + 12] = F, o[u + 13] = H, o[u + 14] = O, o[u + 15] = V, a++;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
n.count = a, a > 0 && c.queue.writeBuffer(
|
|
374
|
-
n.buffer,
|
|
375
|
-
0,
|
|
376
|
-
o.buffer,
|
|
377
|
-
0,
|
|
378
|
-
a * v * 4
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
}, le = {
|
|
382
|
-
systems: [k],
|
|
383
|
-
components: { Text: l },
|
|
384
|
-
dependencies: [C, U],
|
|
385
|
-
initialize(r) {
|
|
386
|
-
const t = S.from(r), n = D.from(r);
|
|
387
|
-
if (!t || !n) return;
|
|
388
|
-
const { device: c } = t, e = B(c), o = c.createSampler({
|
|
389
|
-
magFilter: "linear",
|
|
390
|
-
minFilter: "linear"
|
|
391
|
-
}), i = {
|
|
392
|
-
content: /* @__PURE__ */ new Map(),
|
|
393
|
-
atlas: e,
|
|
394
|
-
sampler: o,
|
|
395
|
-
buffer: c.createBuffer({
|
|
396
|
-
label: "glyphs",
|
|
397
|
-
size: P * v * 4,
|
|
398
|
-
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST
|
|
399
|
-
}),
|
|
400
|
-
staging: new Float32Array(P * v),
|
|
401
|
-
count: 0
|
|
402
|
-
};
|
|
403
|
-
r.setResource(m, i), t.graph.add(
|
|
404
|
-
j({
|
|
405
|
-
scene: n.scene,
|
|
406
|
-
glyphs: i.buffer,
|
|
407
|
-
atlas: e.textureView,
|
|
408
|
-
sampler: o,
|
|
409
|
-
getCount: () => i.count
|
|
410
|
-
})
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
export {
|
|
415
|
-
l as Text,
|
|
416
|
-
T as TextData,
|
|
417
|
-
le as TextPlugin,
|
|
418
|
-
m as TextResource,
|
|
419
|
-
j as createTextNode,
|
|
420
|
-
ae as getTextContent,
|
|
421
|
-
ue as setTextContent
|
|
422
|
-
};
|
|
423
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/extras/text/index.ts"],"sourcesContent":["import TinySDF from \"@mapbox/tiny-sdf\";\nimport { MAX_ENTITIES, resource, type Plugin, type State, type System } from \"../../core\";\nimport { setTraits, type FieldAccessor } from \"../../core/component\";\nimport {\n Compute,\n ComputePlugin,\n type ComputeNode,\n type ExecutionContext,\n} from \"../../standard/compute\";\nimport { Render, RenderPlugin } from \"../../standard/render\";\nimport { Transform } from \"../../standard/transforms\";\n\nconst MAX_GLYPHS = 50000;\nconst GLYPH_FLOATS = 16;\n\nexport const TextData = {\n data: new Float32Array(MAX_ENTITIES * 12),\n};\n\ninterface TextProxy extends Array<number>, FieldAccessor {}\n\nfunction textProxy(offset: number): TextProxy {\n const data = TextData.data;\n\n function getValue(eid: number): number {\n return data[eid * 12 + offset];\n }\n\n function setValue(eid: number, value: number): void {\n data[eid * 12 + offset] = value;\n }\n\n return new Proxy([] as unknown as TextProxy, {\n get(_, prop) {\n if (prop === \"get\") return getValue;\n if (prop === \"set\") return setValue;\n const eid = Number(prop);\n if (Number.isNaN(eid)) return undefined;\n return getValue(eid);\n },\n set(_, prop, value) {\n const eid = Number(prop);\n if (Number.isNaN(eid)) return false;\n setValue(eid, value);\n return true;\n },\n });\n}\n\nfunction colorProxy(): TextProxy {\n const data = TextData.data;\n\n function getValue(eid: number): number {\n const offset = eid * 12 + 8;\n const r = Math.round(data[offset] * 255);\n const g = Math.round(data[offset + 1] * 255);\n const b = Math.round(data[offset + 2] * 255);\n return (r << 16) | (g << 8) | b;\n }\n\n function setValue(eid: number, value: number): void {\n const offset = eid * 12 + 8;\n data[offset] = ((value >> 16) & 0xff) / 255;\n data[offset + 1] = ((value >> 8) & 0xff) / 255;\n data[offset + 2] = (value & 0xff) / 255;\n data[offset + 3] = 1;\n }\n\n return new Proxy([] as unknown as TextProxy, {\n get(_, prop) {\n if (prop === \"get\") return getValue;\n if (prop === \"set\") return setValue;\n const eid = Number(prop);\n if (Number.isNaN(eid)) return undefined;\n return getValue(eid);\n },\n set(_, prop, value) {\n const eid = Number(prop);\n if (Number.isNaN(eid)) return false;\n setValue(eid, value);\n return true;\n },\n });\n}\n\nexport const Text: {\n fontSize: TextProxy;\n opacity: TextProxy;\n visible: TextProxy;\n anchorX: TextProxy;\n anchorY: TextProxy;\n color: TextProxy;\n} = {\n fontSize: textProxy(0),\n opacity: textProxy(1),\n visible: textProxy(2),\n anchorX: textProxy(3),\n anchorY: textProxy(4),\n color: colorProxy(),\n};\n\nsetTraits(Text, {\n defaults: () => ({\n fontSize: 1,\n opacity: 1,\n visible: 1,\n anchorX: 0,\n anchorY: 0,\n color: 0xffffff,\n }),\n accessors: {\n fontSize: Text.fontSize,\n opacity: Text.opacity,\n visible: Text.visible,\n anchorX: Text.anchorX,\n anchorY: Text.anchorY,\n color: Text.color,\n },\n});\n\ninterface GlyphMetrics {\n width: number;\n height: number;\n glyphWidth: number;\n glyphHeight: number;\n glyphTop: number;\n glyphLeft: number;\n advance: number;\n u0: number;\n v0: number;\n u1: number;\n v1: number;\n}\n\ninterface GlyphAtlas {\n texture: GPUTexture;\n textureView: GPUTextureView;\n width: number;\n height: number;\n glyphs: Map<string, GlyphMetrics>;\n rowHeight: number;\n cursorX: number;\n cursorY: number;\n sdf: TinySDF;\n sdfFontSize: number;\n}\n\nfunction createGlyphAtlas(device: GPUDevice): GlyphAtlas {\n const width = 1024;\n const height = 1024;\n const fontSize = 32;\n\n const texture = device.createTexture({\n size: { width, height },\n format: \"r8unorm\",\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST,\n label: \"glyphAtlas\",\n });\n\n const sdf = new TinySDF({\n fontSize,\n fontFamily: \"monospace\",\n fontWeight: \"normal\",\n fontStyle: \"normal\",\n buffer: 3,\n radius: 8,\n cutoff: 0.5,\n });\n\n return {\n texture,\n textureView: texture.createView(),\n width,\n height,\n glyphs: new Map(),\n rowHeight: 0,\n cursorX: 0,\n cursorY: 0,\n sdf,\n sdfFontSize: fontSize,\n };\n}\n\nfunction ensureGlyph(device: GPUDevice, atlas: GlyphAtlas, char: string): GlyphMetrics {\n const existing = atlas.glyphs.get(char);\n if (existing) return existing;\n\n const glyph = atlas.sdf.draw(char);\n\n if (atlas.cursorX + glyph.width > atlas.width) {\n atlas.cursorX = 0;\n atlas.cursorY += atlas.rowHeight;\n atlas.rowHeight = 0;\n }\n\n if (atlas.cursorY + glyph.height > atlas.height) {\n throw new Error(\"Glyph atlas full\");\n }\n\n const glyphData = new Uint8Array(glyph.data.length);\n glyphData.set(glyph.data);\n\n device.queue.writeTexture(\n {\n texture: atlas.texture,\n origin: { x: atlas.cursorX, y: atlas.cursorY },\n },\n glyphData,\n { bytesPerRow: glyph.width },\n { width: glyph.width, height: glyph.height }\n );\n\n const metrics: GlyphMetrics = {\n width: glyph.width,\n height: glyph.height,\n glyphWidth: glyph.glyphWidth,\n glyphHeight: glyph.glyphHeight,\n glyphTop: glyph.glyphTop,\n glyphLeft: glyph.glyphLeft,\n advance: glyph.glyphAdvance,\n u0: atlas.cursorX / atlas.width,\n v0: atlas.cursorY / atlas.height,\n u1: (atlas.cursorX + glyph.width) / atlas.width,\n v1: (atlas.cursorY + glyph.height) / atlas.height,\n };\n\n atlas.glyphs.set(char, metrics);\n atlas.cursorX += glyph.width;\n atlas.rowHeight = Math.max(atlas.rowHeight, glyph.height);\n\n return metrics;\n}\n\nfunction ensureString(device: GPUDevice, atlas: GlyphAtlas, text: string): void {\n for (const char of text) {\n ensureGlyph(device, atlas, char);\n }\n}\n\ninterface LayoutGlyph {\n x: number;\n y: number;\n width: number;\n height: number;\n u0: number;\n v0: number;\n u1: number;\n v1: number;\n}\n\ninterface LayoutResult {\n glyphs: LayoutGlyph[];\n width: number;\n height: number;\n}\n\nfunction layoutText(text: string, atlas: GlyphAtlas, fontSize: number): LayoutResult {\n const glyphs: LayoutGlyph[] = [];\n const scale = fontSize / atlas.sdfFontSize;\n\n let cursorX = 0;\n let maxHeight = 0;\n\n for (const char of text) {\n const metrics = atlas.glyphs.get(char);\n if (!metrics) continue;\n\n const glyphW = metrics.glyphWidth * scale;\n const glyphH = metrics.glyphHeight * scale;\n const advance = metrics.advance * scale;\n\n const x = cursorX + metrics.glyphLeft * scale;\n const y = (metrics.glyphTop - metrics.glyphHeight) * scale;\n\n glyphs.push({\n x,\n y,\n width: glyphW,\n height: glyphH,\n u0: metrics.u0,\n v0: metrics.v0,\n u1: metrics.u1,\n v1: metrics.v1,\n });\n\n cursorX += advance;\n maxHeight = Math.max(maxHeight, glyphH);\n }\n\n return {\n glyphs,\n width: cursorX,\n height: maxHeight,\n };\n}\n\nconst textShader = /* wgsl */ `\nstruct Scene {\n viewProj: mat4x4<f32>,\n cameraWorld: mat4x4<f32>,\n}\n\nstruct GlyphInstance {\n posX: f32,\n posY: f32,\n posZ: f32,\n _pad0: f32,\n width: f32,\n height: f32,\n _pad1: vec2<f32>,\n u0: f32,\n v0: f32,\n u1: f32,\n v1: f32,\n color: vec4<f32>,\n}\n\n@group(0) @binding(0) var<uniform> scene: Scene;\n@group(0) @binding(1) var<storage, read> glyphs: array<GlyphInstance>;\n@group(0) @binding(2) var atlasTexture: texture_2d<f32>;\n@group(0) @binding(3) var atlasSampler: sampler;\n\nstruct VertexOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n @location(1) color: vec4<f32>,\n}\n\nconst SDF_SMOOTHING: f32 = 0.1;\n\n@vertex\nfn vs(@builtin(vertex_index) vid: u32) -> VertexOutput {\n let glyphIdx = vid / 6u;\n let cornerIdx = vid % 6u;\n\n let glyph = glyphs[glyphIdx];\n\n var localPos: vec2<f32>;\n var uv: vec2<f32>;\n\n switch cornerIdx {\n case 0u: {\n localPos = vec2(0.0, 0.0);\n uv = vec2(glyph.u0, glyph.v1);\n }\n case 1u: {\n localPos = vec2(1.0, 0.0);\n uv = vec2(glyph.u1, glyph.v1);\n }\n case 2u: {\n localPos = vec2(1.0, 1.0);\n uv = vec2(glyph.u1, glyph.v0);\n }\n case 3u: {\n localPos = vec2(0.0, 0.0);\n uv = vec2(glyph.u0, glyph.v1);\n }\n case 4u: {\n localPos = vec2(1.0, 1.0);\n uv = vec2(glyph.u1, glyph.v0);\n }\n case 5u: {\n localPos = vec2(0.0, 1.0);\n uv = vec2(glyph.u0, glyph.v0);\n }\n default: {\n localPos = vec2(0.0);\n uv = vec2(0.0);\n }\n }\n\n let worldPos = vec3(\n glyph.posX + localPos.x * glyph.width,\n glyph.posY + localPos.y * glyph.height,\n glyph.posZ\n );\n\n var out: VertexOutput;\n out.position = scene.viewProj * vec4(worldPos, 1.0);\n out.uv = uv;\n out.color = glyph.color;\n return out;\n}\n\n@fragment\nfn fs(input: VertexOutput) -> @location(0) vec4<f32> {\n let sdfValue = textureSample(atlasTexture, atlasSampler, input.uv).r;\n let alpha = smoothstep(0.5 - SDF_SMOOTHING, 0.5 + SDF_SMOOTHING, sdfValue);\n\n if alpha < 0.01 {\n discard;\n }\n\n return vec4(input.color.rgb, input.color.a * alpha);\n}\n`;\n\nfunction createTextPipeline(device: GPUDevice, format: GPUTextureFormat): GPURenderPipeline {\n const module = device.createShaderModule({ code: textShader });\n\n return device.createRenderPipeline({\n layout: \"auto\",\n vertex: {\n module,\n entryPoint: \"vs\",\n },\n fragment: {\n module,\n entryPoint: \"fs\",\n targets: [\n {\n format,\n blend: {\n color: {\n srcFactor: \"src-alpha\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\",\n },\n alpha: {\n srcFactor: \"one\",\n dstFactor: \"one-minus-src-alpha\",\n operation: \"add\",\n },\n },\n },\n ],\n },\n primitive: {\n topology: \"triangle-list\",\n cullMode: \"none\",\n },\n });\n}\n\nexport interface TextConfig {\n scene: GPUBuffer;\n glyphs: GPUBuffer;\n atlas: GPUTextureView;\n sampler: GPUSampler;\n getCount: () => number;\n}\n\nexport function createTextNode(config: TextConfig): ComputeNode {\n let pipeline: GPURenderPipeline | null = null;\n let bindGroup: GPUBindGroup | null = null;\n\n return {\n id: \"text\",\n phase: \"overlay\",\n inputs: [],\n outputs: [],\n\n execute(ctx: ExecutionContext) {\n const count = config.getCount();\n if (count === 0) return;\n\n const { device, encoder, format } = ctx;\n const targetView = ctx.getTextureView(\"scene\") ?? ctx.canvasView;\n\n if (!pipeline) {\n pipeline = createTextPipeline(device, format);\n }\n\n if (!bindGroup) {\n bindGroup = device.createBindGroup({\n layout: pipeline.getBindGroupLayout(0),\n entries: [\n { binding: 0, resource: { buffer: config.scene } },\n { binding: 1, resource: { buffer: config.glyphs } },\n { binding: 2, resource: config.atlas },\n { binding: 3, resource: config.sampler },\n ],\n });\n }\n\n const pass = encoder.beginRenderPass({\n colorAttachments: [\n {\n view: targetView,\n loadOp: \"load\" as const,\n storeOp: \"store\" as const,\n },\n ],\n });\n\n pass.setPipeline(pipeline);\n pass.setBindGroup(0, bindGroup);\n pass.draw(count * 6);\n pass.end();\n },\n };\n}\n\nexport interface TextState {\n content: Map<number, string>;\n atlas: GlyphAtlas;\n sampler: GPUSampler;\n buffer: GPUBuffer;\n staging: Float32Array;\n count: number;\n}\n\nexport const TextResource = resource<TextState>(\"text\");\n\nexport function setTextContent(state: State, eid: number, content: string): void {\n const text = TextResource.from(state);\n if (!text) return;\n text.content.set(eid, content);\n}\n\nexport function getTextContent(state: State, eid: number): string | undefined {\n const text = TextResource.from(state);\n return text?.content.get(eid);\n}\n\nconst TextSystem: System = {\n group: \"draw\",\n\n update(state: State) {\n const compute = Compute.from(state);\n const text = TextResource.from(state);\n if (!compute || !text) return;\n\n const { device } = compute;\n const { atlas, staging, content } = text;\n\n let glyphCount = 0;\n\n for (const eid of state.query([Text, Transform])) {\n if (!Text.visible[eid]) continue;\n\n const textContent = content.get(eid);\n if (!textContent) continue;\n\n ensureString(device, atlas, textContent);\n\n const fontSize = Text.fontSize[eid];\n const layout = layoutText(textContent, atlas, fontSize);\n\n const anchorX = Text.anchorX[eid];\n const anchorY = Text.anchorY[eid];\n const offsetX = -layout.width * anchorX;\n const offsetY = -layout.height * anchorY;\n\n const baseX = Transform.posX[eid] + offsetX;\n const baseY = Transform.posY[eid] + offsetY;\n const baseZ = Transform.posZ[eid];\n\n const color = Text.color[eid];\n const r = ((color >> 16) & 0xff) / 255;\n const g = ((color >> 8) & 0xff) / 255;\n const b = (color & 0xff) / 255;\n const a = Text.opacity[eid];\n\n for (const glyph of layout.glyphs) {\n if (glyphCount >= MAX_GLYPHS) break;\n\n const offset = glyphCount * GLYPH_FLOATS;\n\n staging[offset + 0] = baseX + glyph.x;\n staging[offset + 1] = baseY + glyph.y;\n staging[offset + 2] = baseZ;\n staging[offset + 3] = 0;\n\n staging[offset + 4] = glyph.width;\n staging[offset + 5] = glyph.height;\n staging[offset + 6] = 0;\n staging[offset + 7] = 0;\n\n staging[offset + 8] = glyph.u0;\n staging[offset + 9] = glyph.v0;\n staging[offset + 10] = glyph.u1;\n staging[offset + 11] = glyph.v1;\n\n staging[offset + 12] = r;\n staging[offset + 13] = g;\n staging[offset + 14] = b;\n staging[offset + 15] = a;\n\n glyphCount++;\n }\n }\n\n text.count = glyphCount;\n\n if (glyphCount > 0) {\n device.queue.writeBuffer(\n text.buffer,\n 0,\n staging.buffer,\n 0,\n glyphCount * GLYPH_FLOATS * 4\n );\n }\n },\n};\n\nexport const TextPlugin: Plugin = {\n systems: [TextSystem],\n components: { Text },\n dependencies: [ComputePlugin, RenderPlugin],\n\n initialize(state: State) {\n const compute = Compute.from(state);\n const render = Render.from(state);\n if (!compute || !render) return;\n\n const { device } = compute;\n\n const atlas = createGlyphAtlas(device);\n const sampler = device.createSampler({\n magFilter: \"linear\",\n minFilter: \"linear\",\n });\n\n const textState: TextState = {\n content: new Map(),\n atlas,\n sampler,\n buffer: device.createBuffer({\n label: \"glyphs\",\n size: MAX_GLYPHS * GLYPH_FLOATS * 4,\n usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,\n }),\n staging: new Float32Array(MAX_GLYPHS * GLYPH_FLOATS),\n count: 0,\n };\n\n state.setResource(TextResource, textState);\n\n compute.graph.add(\n createTextNode({\n scene: render.scene,\n glyphs: textState.buffer,\n atlas: atlas.textureView,\n sampler,\n getCount: () => textState.count,\n })\n );\n },\n};\n"],"names":["MAX_GLYPHS","GLYPH_FLOATS","TextData","MAX_ENTITIES","textProxy","offset","data","getValue","eid","setValue","value","_","prop","colorProxy","r","g","b","Text","setTraits","createGlyphAtlas","device","texture","sdf","TinySDF","ensureGlyph","atlas","char","existing","glyph","glyphData","metrics","ensureString","text","layoutText","fontSize","glyphs","scale","cursorX","maxHeight","glyphW","glyphH","advance","y","textShader","createTextPipeline","format","module","createTextNode","config","pipeline","bindGroup","ctx","count","encoder","targetView","pass","TextResource","resource","setTextContent","state","content","getTextContent","TextSystem","compute","Compute","staging","glyphCount","Transform","textContent","layout","anchorX","anchorY","offsetX","offsetY","baseX","baseY","baseZ","color","a","TextPlugin","ComputePlugin","RenderPlugin","render","Render","sampler","textState"],"mappings":";;;;;;;;;;;;AAYA,MAAMA,IAAa,KACbC,IAAe,IAERC,I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A9D,MAAW2C,GAEbtC,IAAQN,EAAiBC,CAAM,GAC/BgE,IAAUhE,EAAO,cAAc;AAAA,MACjC,WAAW;AAAA,MACX,WAAW;AAAA,IAAA,CACd,GAEKiE,IAAuB;AAAA,MACzB,6BAAa,IAAA;AAAA,MACb,OAAA5D;AAAA,MACA,SAAA2D;AAAA,MACA,QAAQhE,EAAO,aAAa;AAAA,QACxB,OAAO;AAAA,QACP,MAAMpB,IAAaC,IAAe;AAAA,QAClC,OAAO,eAAe,UAAU,eAAe;AAAA,MAAA,CAClD;AAAA,MACD,SAAS,IAAI,aAAaD,IAAaC,CAAY;AAAA,MACnD,OAAO;AAAA,IAAA;AAGX,IAAA0D,EAAM,YAAYH,GAAc6B,CAAS,GAEzCtB,EAAQ,MAAM;AAAA,MACVhB,EAAe;AAAA,QACX,OAAOmC,EAAO;AAAA,QACd,QAAQG,EAAU;AAAA,QAClB,OAAO5D,EAAM;AAAA,QACb,SAAA2D;AAAA,QACA,UAAU,MAAMC,EAAU;AAAA,MAAA,CAC7B;AAAA,IAAA;AAAA,EAET;AACJ;"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { All as t, And as o, Any as a, Cascade as n, Hierarchy as i, IsA as m, None as s, Not as p, Or as l, Pair as c, Wildcard as f, createRelation as u, getRelationTargets as x, observe as d, onAdd as g, onGet as T, onRemove as S, onSet as h } from "bitecs";
|
|
2
|
-
import { MAX_ENTITIES as P, State as A } from "./core/state.js";
|
|
3
|
-
import { StateBuilder as I } from "./core/builder.js";
|
|
4
|
-
import { resource as E } from "./core/resource.js";
|
|
5
|
-
import { CycleError as D, OrderingError as N, Scheduler as y, Time as M } from "./core/scheduler.js";
|
|
6
|
-
import { clearRegistry as b, directAccessor as k, getRegisteredComponent as B, getTraits as F, registerComponent as _, setTraits as G } from "./core/component.js";
|
|
7
|
-
import { ChildOf as q, clearRelationDefs as v, defineRelation as H, getRelationDef as z } from "./core/relation.js";
|
|
8
|
-
import { clamp as Q, eulerToQuaternion as W, lerp as Z, lookAt as K, quaternionToEuler as V, rotateQuaternion as j, slerp as J } from "./core/math.js";
|
|
9
|
-
import { toCamelCase as $, toKebabCase as ee } from "./core/strings.js";
|
|
10
|
-
import { getRuntime as te, initRuntime as oe, resetRuntime as ae } from "./core/runtime.js";
|
|
11
|
-
import { loadScene as ie, loadSceneFile as me, parseXml as se, registerPostLoadHook as pe, unregisterPostLoadHook as le } from "./core/xml.js";
|
|
12
|
-
import { Compute as fe, ComputePlugin as ue, ComputeSystem as xe, createEntityIdBuffer as de, requestGPU as ge } from "./standard/compute/index.js";
|
|
13
|
-
import { Input as Se, InputPlugin as he, InputSystem as Ce } from "./standard/input/index.js";
|
|
14
|
-
import { Tween as Ae, TweenPlugin as Re, TweenState as Ie, TweenSystem as we, TweenTarget as Ee, createTween as Le } from "./standard/tween/tween.js";
|
|
15
|
-
import { Pause as Ne, Sequence as ye, SequenceState as Me, computeTweenDelays as Oe, finalizeSequences as be } from "./standard/tween/sequence.js";
|
|
16
|
-
import { EASING_FUNCTIONS as Be, getEasing as Fe, getEasingIndex as _e } from "./standard/tween/easing.js";
|
|
17
|
-
import { Transform as Ue, TransformsPlugin as qe, WorldTransform as ve, rotate as He } from "./standard/transforms/index.js";
|
|
18
|
-
import { Render as Xe, RenderPlugin as Qe } from "./standard/render/index.js";
|
|
19
|
-
import { shallotDark as Ze, minimalDark as Ke, minimalLight as Ve, shallotDark as je, shallotLight as Je } from "./standard/loading/index.js";
|
|
20
|
-
import { DEFAULT_PLUGINS as $e } from "./standard/defaults.js";
|
|
21
|
-
import { Orbit as rr, OrbitPlugin as tr, OrbitSystem as or } from "./extras/orbit/index.js";
|
|
22
|
-
import { Line as nr, LineData as ir, Lines as mr, LinesPlugin as sr, createLinesNode as pr, createLinesPipeline as lr, lineShader as cr } from "./extras/lines/index.js";
|
|
23
|
-
import { Arrow as ur, ArrowData as xr, Arrows as dr, ArrowsPlugin as gr, arrowShader as Tr, createArrowsNode as Sr, createArrowsPipeline as hr } from "./extras/arrows/index.js";
|
|
24
|
-
import { Text as Pr, TextData as Ar, TextPlugin as Rr, TextResource as Ir, createTextNode as wr, getTextContent as Er, setTextContent as Lr } from "./extras/text/index.js";
|
|
25
|
-
import { ComputeGraph as Nr } from "./standard/compute/graph.js";
|
|
26
|
-
import { Camera as Mr, DebugMode as Or, FXAA as br, RenderMode as kr, Tonemap as Br, Vignette as Fr, unpackColor as _r, uploadCamera as Gr } from "./standard/render/camera.js";
|
|
27
|
-
import { AmbientLight as qr, DirectionalLight as vr, normalizeDirection as Hr, packLightUniforms as zr } from "./standard/render/light.js";
|
|
28
|
-
import { createBox as Qr } from "./standard/render/mesh/box.js";
|
|
29
|
-
import { createSphere as Zr } from "./standard/render/mesh/sphere.js";
|
|
30
|
-
import { createPlane as Vr } from "./standard/render/mesh/plane.js";
|
|
31
|
-
import { Mesh as Jr, MeshColors as Yr, MeshShape as $r, MeshSizes as et, collectByShape as rt, createGeometry as tt, createMeshBuffers as ot, updateBatches as at } from "./standard/render/mesh/index.js";
|
|
32
|
-
import { DEPTH_FORMAT as it, SCENE_UNIFORM_SIZE as mt, createSceneBuffer as st, ensureRenderTextures as pt, invert as lt, multiply as ct, perspective as ft } from "./standard/render/scene.js";
|
|
33
|
-
import { INDIRECT_SIZE as xt, clearColor as dt, createForwardNode as gt, createForwardPipeline as Tt, createIndirectBuffer as St, litShader as ht, writeIndirect as Ct } from "./standard/render/forward.js";
|
|
34
|
-
import { createPostProcessNode as At } from "./standard/render/postprocess.js";
|
|
35
|
-
export {
|
|
36
|
-
t as All,
|
|
37
|
-
qr as AmbientLight,
|
|
38
|
-
o as And,
|
|
39
|
-
a as Any,
|
|
40
|
-
ur as Arrow,
|
|
41
|
-
xr as ArrowData,
|
|
42
|
-
dr as Arrows,
|
|
43
|
-
gr as ArrowsPlugin,
|
|
44
|
-
Mr as Camera,
|
|
45
|
-
n as Cascade,
|
|
46
|
-
q as ChildOf,
|
|
47
|
-
fe as Compute,
|
|
48
|
-
Nr as ComputeGraph,
|
|
49
|
-
ue as ComputePlugin,
|
|
50
|
-
xe as ComputeSystem,
|
|
51
|
-
D as CycleError,
|
|
52
|
-
$e as DEFAULT_PLUGINS,
|
|
53
|
-
it as DEPTH_FORMAT,
|
|
54
|
-
Or as DebugMode,
|
|
55
|
-
vr as DirectionalLight,
|
|
56
|
-
Be as EASING_FUNCTIONS,
|
|
57
|
-
br as FXAA,
|
|
58
|
-
i as Hierarchy,
|
|
59
|
-
xt as INDIRECT_SIZE,
|
|
60
|
-
Se as Input,
|
|
61
|
-
he as InputPlugin,
|
|
62
|
-
Ce as InputSystem,
|
|
63
|
-
m as IsA,
|
|
64
|
-
nr as Line,
|
|
65
|
-
ir as LineData,
|
|
66
|
-
mr as Lines,
|
|
67
|
-
sr as LinesPlugin,
|
|
68
|
-
P as MAX_ENTITIES,
|
|
69
|
-
Jr as Mesh,
|
|
70
|
-
Yr as MeshColors,
|
|
71
|
-
$r as MeshShape,
|
|
72
|
-
et as MeshSizes,
|
|
73
|
-
s as None,
|
|
74
|
-
p as Not,
|
|
75
|
-
l as Or,
|
|
76
|
-
rr as Orbit,
|
|
77
|
-
tr as OrbitPlugin,
|
|
78
|
-
or as OrbitSystem,
|
|
79
|
-
N as OrderingError,
|
|
80
|
-
c as Pair,
|
|
81
|
-
Ne as Pause,
|
|
82
|
-
Xe as Render,
|
|
83
|
-
kr as RenderMode,
|
|
84
|
-
Qe as RenderPlugin,
|
|
85
|
-
mt as SCENE_UNIFORM_SIZE,
|
|
86
|
-
y as Scheduler,
|
|
87
|
-
ye as Sequence,
|
|
88
|
-
Me as SequenceState,
|
|
89
|
-
A as State,
|
|
90
|
-
I as StateBuilder,
|
|
91
|
-
Pr as Text,
|
|
92
|
-
Ar as TextData,
|
|
93
|
-
Rr as TextPlugin,
|
|
94
|
-
Ir as TextResource,
|
|
95
|
-
M as Time,
|
|
96
|
-
Br as Tonemap,
|
|
97
|
-
Ue as Transform,
|
|
98
|
-
qe as TransformsPlugin,
|
|
99
|
-
Ae as Tween,
|
|
100
|
-
Re as TweenPlugin,
|
|
101
|
-
Ie as TweenState,
|
|
102
|
-
we as TweenSystem,
|
|
103
|
-
Ee as TweenTarget,
|
|
104
|
-
Fr as Vignette,
|
|
105
|
-
f as Wildcard,
|
|
106
|
-
ve as WorldTransform,
|
|
107
|
-
Tr as arrowShader,
|
|
108
|
-
Ze as canvasLoading,
|
|
109
|
-
Q as clamp,
|
|
110
|
-
dt as clearColor,
|
|
111
|
-
b as clearRegistry,
|
|
112
|
-
v as clearRelationDefs,
|
|
113
|
-
rt as collectByShape,
|
|
114
|
-
Oe as computeTweenDelays,
|
|
115
|
-
Sr as createArrowsNode,
|
|
116
|
-
hr as createArrowsPipeline,
|
|
117
|
-
Qr as createBox,
|
|
118
|
-
de as createEntityIdBuffer,
|
|
119
|
-
gt as createForwardNode,
|
|
120
|
-
Tt as createForwardPipeline,
|
|
121
|
-
tt as createGeometry,
|
|
122
|
-
St as createIndirectBuffer,
|
|
123
|
-
pr as createLinesNode,
|
|
124
|
-
lr as createLinesPipeline,
|
|
125
|
-
ot as createMeshBuffers,
|
|
126
|
-
Vr as createPlane,
|
|
127
|
-
At as createPostProcessNode,
|
|
128
|
-
u as createRelation,
|
|
129
|
-
st as createSceneBuffer,
|
|
130
|
-
Zr as createSphere,
|
|
131
|
-
wr as createTextNode,
|
|
132
|
-
Le as createTween,
|
|
133
|
-
H as defineRelation,
|
|
134
|
-
k as directAccessor,
|
|
135
|
-
pt as ensureRenderTextures,
|
|
136
|
-
W as eulerToQuaternion,
|
|
137
|
-
be as finalizeSequences,
|
|
138
|
-
Fe as getEasing,
|
|
139
|
-
_e as getEasingIndex,
|
|
140
|
-
B as getRegisteredComponent,
|
|
141
|
-
z as getRelationDef,
|
|
142
|
-
x as getRelationTargets,
|
|
143
|
-
te as getRuntime,
|
|
144
|
-
Er as getTextContent,
|
|
145
|
-
F as getTraits,
|
|
146
|
-
oe as initRuntime,
|
|
147
|
-
lt as invert,
|
|
148
|
-
Z as lerp,
|
|
149
|
-
cr as lineShader,
|
|
150
|
-
ht as litShader,
|
|
151
|
-
ie as loadScene,
|
|
152
|
-
me as loadSceneFile,
|
|
153
|
-
K as lookAt,
|
|
154
|
-
Ke as minimalDark,
|
|
155
|
-
Ve as minimalLight,
|
|
156
|
-
ct as multiply,
|
|
157
|
-
Hr as normalizeDirection,
|
|
158
|
-
d as observe,
|
|
159
|
-
g as onAdd,
|
|
160
|
-
T as onGet,
|
|
161
|
-
S as onRemove,
|
|
162
|
-
h as onSet,
|
|
163
|
-
zr as packLightUniforms,
|
|
164
|
-
se as parseXml,
|
|
165
|
-
ft as perspective,
|
|
166
|
-
V as quaternionToEuler,
|
|
167
|
-
_ as registerComponent,
|
|
168
|
-
pe as registerPostLoadHook,
|
|
169
|
-
ge as requestGPU,
|
|
170
|
-
ae as resetRuntime,
|
|
171
|
-
E as resource,
|
|
172
|
-
He as rotate,
|
|
173
|
-
j as rotateQuaternion,
|
|
174
|
-
Lr as setTextContent,
|
|
175
|
-
G as setTraits,
|
|
176
|
-
je as shallotDark,
|
|
177
|
-
Je as shallotLight,
|
|
178
|
-
J as slerp,
|
|
179
|
-
$ as toCamelCase,
|
|
180
|
-
ee as toKebabCase,
|
|
181
|
-
_r as unpackColor,
|
|
182
|
-
le as unregisterPostLoadHook,
|
|
183
|
-
at as updateBatches,
|
|
184
|
-
Gr as uploadCamera,
|
|
185
|
-
Ct as writeIndirect
|
|
186
|
-
};
|
|
187
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|