@yaks/voxel 0.0.0-stage → 0.2.36

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 (59) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +79 -2
  3. package/_dist/boxes.d.ts +80 -0
  4. package/_dist/boxes.d.ts.map +1 -0
  5. package/_dist/chartbook.d.ts +14 -0
  6. package/_dist/chartbook.d.ts.map +1 -0
  7. package/_dist/chartsheet.d.ts +8 -0
  8. package/_dist/chartsheet.d.ts.map +1 -0
  9. package/_dist/light.d.ts +18 -0
  10. package/_dist/light.d.ts.map +1 -0
  11. package/_dist/mesh.d.ts +120 -0
  12. package/_dist/mesh.d.ts.map +1 -0
  13. package/_dist/mod.d.ts +7 -0
  14. package/_dist/mod.d.ts.map +1 -0
  15. package/_dist/stream.d.ts +33 -0
  16. package/_dist/stream.d.ts.map +1 -0
  17. package/_dist/three/mod.d.ts +5 -0
  18. package/_dist/three/mod.d.ts.map +1 -0
  19. package/_dist/three/parts.d.ts +59 -0
  20. package/_dist/three/parts.d.ts.map +1 -0
  21. package/_dist/three/puppet.d.ts +93 -0
  22. package/_dist/three/puppet.d.ts.map +1 -0
  23. package/_dist/three/soft.d.ts +27 -0
  24. package/_dist/three/soft.d.ts.map +1 -0
  25. package/boxes.js +265 -0
  26. package/boxes.js.map +1 -0
  27. package/boxes.ts +266 -0
  28. package/chartbook.js +63 -0
  29. package/chartbook.js.map +1 -0
  30. package/chartbook.ts +88 -0
  31. package/chartsheet.js +31 -0
  32. package/chartsheet.js.map +1 -0
  33. package/chartsheet.ts +32 -0
  34. package/deno.json +1 -0
  35. package/light.js +45 -0
  36. package/light.js.map +1 -0
  37. package/light.ts +49 -0
  38. package/mesh.js +577 -0
  39. package/mesh.js.map +1 -0
  40. package/mesh.ts +624 -0
  41. package/mod.js +7 -0
  42. package/mod.js.map +1 -0
  43. package/mod.ts +7 -0
  44. package/package.json +45 -4
  45. package/stream.js +80 -0
  46. package/stream.js.map +1 -0
  47. package/stream.ts +86 -0
  48. package/three/mod.js +7 -0
  49. package/three/mod.js.map +1 -0
  50. package/three/mod.ts +7 -0
  51. package/three/parts.js +181 -0
  52. package/three/parts.js.map +1 -0
  53. package/three/parts.ts +185 -0
  54. package/three/puppet.js +311 -0
  55. package/three/puppet.js.map +1 -0
  56. package/three/puppet.ts +471 -0
  57. package/three/soft.js +338 -0
  58. package/three/soft.js.map +1 -0
  59. package/three/soft.ts +382 -0
package/three/soft.js ADDED
@@ -0,0 +1,338 @@
1
+ // The soft look. Every voxel in a scene is drawn by this one material: three's
2
+ // Lambert, taught three things in its shader.
3
+ //
4
+ // Rounded edges. A face knows which of its edges are convex and where
5
+ // across it a pixel lies (mesh.ts `edge`). Near a convex edge the normal
6
+ // leans outward and the colour brightens a touch, so a hard cube reads as a
7
+ // soft one without a single extra triangle.
8
+ //
9
+ // Voxels on merged faces. A pixel is tinted by the voxel cell it falls in,
10
+ // so a large flat quad of ground still shows its voxels.
11
+ //
12
+ // Metal. A face made of metal (mesh.ts `METAL`) shows less of its own
13
+ // colour lit and more of what it mirrors: the sky above its horizon and the
14
+ // ground below it, as the scene's hemisphere light colours them, whiter
15
+ // toward a grazing edge; and each light that reaches it, the sun and the
16
+ // fire, is a tight bright highlight on it that slides as it turns. Both
17
+ // take the metal's own colour, so a tinted metal shines its tint, and both
18
+ // follow the day's light as the scene moves it. A few sums a pixel, and none
19
+ // for anything matte.
20
+ //
21
+ // A flash. A mesh glows for a moment when struck.
22
+ //
23
+ // A line of sight. The ground and what stands on it thin away where, as the
24
+ // camera sees them, they cover the subject or nearby attackers, and right
25
+ // around the camera (`see`). The clearance is round but ends above the
26
+ // ground, so a tree in the way shows the fight without hollowing the land.
27
+ // It is a stipple, pixels left out in an even pattern, so nothing needs
28
+ // sorting. The roof and upper floors of a building the subject is in or behind
29
+ // thin away the same way, over a height within its box (`cut`).
30
+ //
31
+ // No seams. A vertex is placed in the world before it is seen from the
32
+ // camera, never through the two at once, so where two chunks meet, the same
33
+ // point in each lands on the same pixel: a chunk stands at whole metres and
34
+ // its corners at whole voxels, which float32 adds exactly.
35
+ // @ts-types="npm:@types/three@^0.186.0"
36
+ import * as THREE from "three";
37
+ /** How many boxes a see-through material fades at once. */ export let CUTS = 3;
38
+ /** The nearest subjects whose silhouettes the woods also leave clear. */ export let FOES = 3;
39
+ /** A geometry over what a mesher wrote, packed (mesh.ts `pack`): the arrays
40
+ * become the geometry's own, uncopied. */ export let geometry = (p)=>{
41
+ let g = new THREE.BufferGeometry();
42
+ g.setAttribute('position', new THREE.BufferAttribute(p.pos, 3));
43
+ g.setAttribute('normal', new THREE.BufferAttribute(p.nrm, 4));
44
+ g.setAttribute('color', new THREE.BufferAttribute(p.col, 4, true));
45
+ g.setAttribute('edge', new THREE.BufferAttribute(p.edge, 4));
46
+ g.setAttribute('bw', new THREE.BufferAttribute(p.bw, 3));
47
+ g.setIndex(new THREE.BufferAttribute(p.idx, 1));
48
+ g.computeBoundingSphere();
49
+ g.computeBoundingBox();
50
+ return g;
51
+ };
52
+ let VERTEX_PARS = /* glsl */ `
53
+ attribute vec4 edge;
54
+ attribute vec3 bw;
55
+ // The colours come as sRGB bytes (mesh.ts), and light blends in linear.
56
+ vec3 unsrgb(vec3 c) {
57
+ return mix(c / 12.92, pow((c + .055) / 1.055, vec3(2.4)), step(.04045, c));
58
+ }
59
+
60
+ varying vec2 vFace;
61
+ varying vec4 vRim;
62
+ varying vec2 vBw;
63
+ varying vec3 vTu;
64
+ varying vec3 vTv;
65
+ varying vec3 vCell;
66
+ varying vec3 vAt;
67
+ varying float vMaterial;
68
+ varying float vWarmth;
69
+ `;
70
+ let VERTEX = /* glsl */ `
71
+ vec4 worldAt = vec4(transformed, 1.);
72
+ #ifdef USE_INSTANCING
73
+ worldAt = instanceMatrix * worldAt;
74
+ #endif
75
+ vAt = (modelMatrix * worldAt).xyz;
76
+ vFace = edge.xy;
77
+ vMaterial = edge.w;
78
+ vWarmth = floor(edge.z / 16.) / 15.;
79
+ vRim = mod(floor(edge.z / vec4(1., 2., 4., 8.)), 2.);
80
+ vBw = bw.xy;
81
+ // The face's own axes, from its normal as it was meshed, turned as the mesh
82
+ // is turned: by its instance, or by the bone that carries it.
83
+ vec3 an = abs(normal);
84
+ vec3 tu = an.x > .5 ? vec3(0., 0., 1.) : vec3(1., 0., 0.);
85
+ vec3 tv = an.y > .5 ? vec3(0., 0., 1.) : vec3(0., 1., 0.);
86
+ #ifdef USE_INSTANCING
87
+ tu = mat3(instanceMatrix) * tu;
88
+ tv = mat3(instanceMatrix) * tv;
89
+ #endif
90
+ #ifdef USE_SKINNING
91
+ tu = (skinMatrix * vec4(tu, 0.)).xyz;
92
+ tv = (skinMatrix * vec4(tv, 0.)).xyz;
93
+ #endif
94
+ vTu = normalize(normalMatrix * tu);
95
+ vTv = normalize(normalMatrix * tv);
96
+ vCell = (position - normal * (bw.z * .5)) / bw.z;
97
+ `;
98
+ // three's project_vertex, but for the world before the view.
99
+ let PROJECT = /* glsl */ `
100
+ vec4 mvPosition = vec4(transformed, 1.);
101
+ #ifdef USE_INSTANCING
102
+ mvPosition = instanceMatrix * mvPosition;
103
+ #endif
104
+ mvPosition = viewMatrix * (modelMatrix * mvPosition);
105
+ gl_Position = projectionMatrix * mvPosition;
106
+ `;
107
+ let FRAGMENT_PARS = /* glsl */ `
108
+ uniform vec3 flash;
109
+ uniform float flashing;
110
+ uniform float speckle;
111
+ uniform float night;
112
+ varying vec2 vFace;
113
+ varying vec4 vRim;
114
+ varying vec2 vBw;
115
+ varying vec3 vTu;
116
+ varying vec3 vTv;
117
+ varying vec3 vCell;
118
+ varying vec3 vAt;
119
+ varying float vMaterial;
120
+ varying float vWarmth;
121
+ uniform vec3 seeFrom;
122
+ uniform vec3 seeFeet;
123
+ uniform float seeTall;
124
+ uniform vec4 seeFoes[FOES];
125
+ uniform vec4 cutLo[CUTS];
126
+ uniform vec3 cutHi[CUTS];
127
+ float edge(float flag, float d, float w) {
128
+ return flag * (1. - smoothstep(0., w, d));
129
+ }
130
+ float b2(vec2 p) {
131
+ float x = mod(p.x, 2.), y = mod(p.y, 2.);
132
+ return 2. * abs(x - y) + y;
133
+ }
134
+ // A 4 by 4 ordered dither: how far through the pattern this pixel is, from
135
+ // 1/32 to 31/32. A pixel's coordinates are its middle, so they are floored
136
+ // first, or some pixels would be past 1 and never left out.
137
+ float bayer(vec2 p) {
138
+ p = floor(p);
139
+ return (4. * b2(p) + b2(floor(p / 2.)) + .5) / 16.;
140
+ }
141
+ `;
142
+ // A pixel's ray meets a disc at the subject's distance from the camera.
143
+ // Keep the lower edge above the ground and the last metre before the subject
144
+ // whole, so only the intervening woods thin away.
145
+ let SIGHT = /* glsl */ `
146
+ #ifdef SEE
147
+ vec3 sl = seeFeet + vec3(0., seeTall * .5, 0.) - seeFrom;
148
+ float sL = max(length(sl), 1e-3);
149
+ vec3 ahead = sl / sL;
150
+ float along = dot(vAt - seeFrom, ahead);
151
+ vec3 upward = normalize(vec3(0., 1., 0.) - ahead * ahead.y);
152
+ vec3 met = (vAt - seeFrom) * (sL / max(along, 1e-3)) - sl;
153
+ float up = dot(met, upward);
154
+ float body = (1. - smoothstep(1.7, 2.4, length(met))) *
155
+ smoothstep(-seeTall * .5 - .35, -seeTall * .5 - .1, up);
156
+ float thin = along > 0. && along < sL - 1. ? body : 0.;
157
+ for (int i = 0; i < FOES; i++) {
158
+ vec4 foe = seeFoes[i];
159
+ if (foe.w <= 0.) continue;
160
+ vec3 toFoe = foe.xyz - seeFrom;
161
+ float distanceToFoe = max(length(toFoe), 1e-3);
162
+ float alongFoe = dot(vAt - seeFrom, toFoe / distanceToFoe);
163
+ if (alongFoe <= 0. || alongFoe >= distanceToFoe - .5) continue;
164
+ vec3 metFoe = (vAt - seeFrom) *
165
+ (distanceToFoe / max(alongFoe, 1e-3)) - toFoe;
166
+ float upFoe = dot(metFoe,
167
+ normalize(vec3(0., 1., 0.) - toFoe *
168
+ (toFoe.y / (distanceToFoe * distanceToFoe))));
169
+ float clearFoe = (1. - smoothstep(foe.w * .7, foe.w, length(metFoe))) *
170
+ smoothstep(-foe.w * .8, -foe.w * .55, upFoe);
171
+ thin = max(thin, clearFoe);
172
+ }
173
+ float near = 1. - smoothstep(1.2, 2., length(vAt - seeFrom));
174
+ thin = max(thin, near * smoothstep(seeFrom.y - 1., seeFrom.y - .5, vAt.y));
175
+ float gone = thin * .8;
176
+ for (int i = 0; i < CUTS; i++) {
177
+ vec3 lo = cutLo[i].xyz;
178
+ if (all(greaterThanEqual(vAt, lo)) && all(lessThanEqual(vAt, cutHi[i]))) {
179
+ gone = max(gone, cutLo[i].w);
180
+ }
181
+ }
182
+ if (bayer(gl_FragCoord.xy) < gone) discard;
183
+ #endif
184
+ `;
185
+ let COLOR = /* glsl */ `
186
+ float r0 = edge(vRim.x, vFace.x, vBw.x);
187
+ float r1 = edge(vRim.y, 1. - vFace.x, vBw.x);
188
+ float r2 = edge(vRim.z, vFace.y, vBw.y);
189
+ float r3 = edge(vRim.w, 1. - vFace.y, vBw.y);
190
+ float rounded = max(max(r0, r1), max(r2, r3));
191
+ vec3 cellOf = floor(vCell + 1e-3);
192
+ float speck = fract(sin(dot(cellOf, vec3(12.9898, 78.233, 37.719))) * 43758.5453);
193
+ diffuseColor.rgb *= 1. + speckle * (speck - .5);
194
+ diffuseColor.rgb *= 1. + .14 * rounded;
195
+ diffuseColor.rgb = mix(diffuseColor.rgb, flash, flashing);
196
+ `;
197
+ let NORMAL = /* glsl */ `
198
+ normal = normalize(normal + (vTu * (r1 - r0) + vTv * (r3 - r2)) * .95);
199
+ `;
200
+ // Each light as Lambert has it, and on metal its highlight too: a tight core
201
+ // going white in a wider glow of the metal's colour.
202
+ let LIGHT = /* glsl */ `
203
+ bool metal() { return vMaterial > .5 && vMaterial < 1.5; }
204
+ void RE_Direct_Soft(
205
+ const in IncidentLight light,
206
+ const in vec3 at,
207
+ const in vec3 n,
208
+ const in vec3 view,
209
+ const in vec3 coat,
210
+ const in LambertMaterial material,
211
+ inout ReflectedLight reflected
212
+ ) {
213
+ RE_Direct_Lambert(light, at, n, view, coat, material, reflected);
214
+ if (!metal()) return;
215
+ float nh = saturate(dot(n, normalize(light.direction + view)));
216
+ float nl = saturate(dot(n, light.direction));
217
+ vec3 glint = mix(material.diffuseColor, vec3(1.), .6) * pow(nh, 90.) * 4.
218
+ + material.diffuseColor * pow(nh, 12.) * .5;
219
+ reflected.directSpecular += light.color * nl * glint;
220
+ }
221
+ #undef RE_Direct
222
+ #define RE_Direct RE_Direct_Soft
223
+ `;
224
+ // What metal mirrors, and its highlights, over a little of its own light: the
225
+ // sky down to a crisp horizon, paler low and deeper overhead, and the ground
226
+ // dark and grey under it.
227
+ let MIRROR = /* glsl */ `
228
+ if (metal()) {
229
+ vec3 seen = reflect(-geometryViewDir, geometryNormal);
230
+ float grazing = pow(1. - saturate(dot(geometryNormal, geometryViewDir)), 4.);
231
+ vec3 around = vec3(0.);
232
+ #if NUM_HEMI_LIGHTS > 0
233
+ HemisphereLight hemi = hemisphereLights[0];
234
+ float up = dot(seen, hemi.direction);
235
+ vec3 low = hemi.skyColor * 1.1, high = hemi.skyColor * hemi.skyColor;
236
+ vec3 earth = hemi.groundColor;
237
+ earth = mix(vec3(dot(earth, vec3(.3, .6, .1))), earth, .4) * .5;
238
+ around = mix(earth, mix(low, high, saturate(up)), smoothstep(-.03, .03, up));
239
+ #endif
240
+ outgoingLight = outgoingLight * .35
241
+ + around * mix(diffuseColor.rgb, vec3(1.), grazing) * .7
242
+ + reflectedLight.directSpecular;
243
+ }
244
+ outgoingLight += vec3(1., .32, .08) * vWarmth * (.18 + .82 * night);
245
+ `;
246
+ /** A soft material: `speckle` is how much each voxel's shade wobbles, and a
247
+ * material that can `see` through (the ground's) thins away between the
248
+ * camera and the subject once `sight` says where both are. */ export let soft = (opts = {})=>{
249
+ let m = new THREE.MeshLambertMaterial({
250
+ vertexColors: true,
251
+ transparent: opts.transparent ?? false,
252
+ opacity: opts.opacity ?? 1
253
+ });
254
+ let uniforms = {
255
+ speckle: {
256
+ value: opts.speckle ?? 0.1
257
+ },
258
+ night: {
259
+ value: 0
260
+ },
261
+ flash: {
262
+ value: new THREE.Color(1, 0.35, 0.3)
263
+ },
264
+ flashing: {
265
+ value: 0
266
+ },
267
+ seeFrom: {
268
+ value: new THREE.Vector3()
269
+ },
270
+ seeFeet: {
271
+ value: new THREE.Vector3()
272
+ },
273
+ seeTall: {
274
+ value: 1
275
+ },
276
+ seeFoes: {
277
+ value: Array.from({
278
+ length: FOES
279
+ }, ()=>new THREE.Vector4())
280
+ },
281
+ cutLo: {
282
+ value: Array.from({
283
+ length: CUTS
284
+ }, ()=>new THREE.Vector4())
285
+ },
286
+ cutHi: {
287
+ value: Array.from({
288
+ length: CUTS
289
+ }, ()=>new THREE.Vector3())
290
+ }
291
+ };
292
+ m.userData.soft = uniforms;
293
+ m.defines = {
294
+ CUTS,
295
+ FOES,
296
+ ...opts.see ? {
297
+ SEE: ''
298
+ } : {}
299
+ };
300
+ m.onBeforeCompile = (s)=>{
301
+ Object.assign(s.uniforms, uniforms);
302
+ s.vertexShader = s.vertexShader.replace('#include <common>', `#include <common>\n${VERTEX_PARS}`).replace('#include <begin_vertex>', `#include <begin_vertex>\n${VERTEX}`).replace('#include <project_vertex>', PROJECT).replace('#include <color_vertex>', '#include <color_vertex>\nvColor.rgb = unsrgb(vColor.rgb);');
303
+ s.fragmentShader = s.fragmentShader.replace('#include <common>', `#include <common>\n${FRAGMENT_PARS}`).replace('#include <clipping_planes_fragment>', `#include <clipping_planes_fragment>\n${SIGHT}`).replace('#include <color_fragment>', `#include <color_fragment>\n${COLOR}`).replace('#include <normal_fragment_maps>', `#include <normal_fragment_maps>\n${NORMAL}`).replace('#include <lights_lambert_pars_fragment>', `#include <lights_lambert_pars_fragment>\n${LIGHT}`).replace('#include <envmap_fragment>', `#include <envmap_fragment>\n${MIRROR}`);
304
+ };
305
+ m.customProgramCacheKey = ()=>opts.see ? 'soft-see' : 'soft';
306
+ return m;
307
+ };
308
+ /** The sight a see-through material keeps clear: from the camera (`from`)
309
+ * of the subject standing at `feet`, `tall` metres tall, and the nearest foes
310
+ * aiming at them. A foe's fourth coordinate is its clearance radius. */ export let sight = (m, from, feet, tall, foes = [])=>{
311
+ let u = m.userData.soft;
312
+ if (!u) return;
313
+ u.seeFrom.value.copy(from);
314
+ u.seeFeet.value.copy(feet);
315
+ u.seeTall.value = tall;
316
+ u.seeFoes.value.forEach((at, i)=>foes[i] ? at.copy(foes[i]) : at.set(0, 0, 0, 0));
317
+ };
318
+ /** The boxes a see-through material fades, `lo` to `hi` in metres, each by
319
+ * `fade` (0 not at all, 1 gone); the rest of its CUTS fade none. */ export let cut = (m, boxes)=>{
320
+ let u = m.userData.soft;
321
+ if (!u) return;
322
+ u.cutLo.value.forEach((lo, i)=>{
323
+ let b = boxes[i];
324
+ lo.set(b?.lo[0] ?? 0, b?.lo[1] ?? 0, b?.lo[2] ?? 0, b?.fade ?? 0);
325
+ u.cutHi.value[i].set(b?.hi[0] ?? -1, b?.hi[1] ?? -1, b?.hi[2] ?? -1);
326
+ });
327
+ };
328
+ /** How strongly a soft material glows its flash colour, 0 to 1. */ export let flash = (m, amount, color)=>{
329
+ let u = m.userData.soft;
330
+ if (!u) return;
331
+ u.flashing.value = amount;
332
+ if (color) u.flash.value.copy(color);
333
+ };
334
+ /** How much the day's light has fallen, shared by every soft mesh. */ export let night = (m, amount)=>{
335
+ let u = m.userData.soft;
336
+ if (u) u.night.value = amount;
337
+ };
338
+ //# sourceMappingURL=soft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"soft.js","sources":["./soft.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8CAA8C;AAC9C,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,8EAA8E;AAC9E,8CAA8C;AAC9C,EAAE;AACF,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,wEAAwE;AACxE,8EAA8E;AAC9E,0EAA0E;AAC1E,2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