phoria2 1.3.0 → 1.4.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.
Files changed (56) hide show
  1. package/README.md +9 -6
  2. package/dist/bloom.js +4 -4
  3. package/dist/bloom.js.map +1 -1
  4. package/dist/charts.js +436 -436
  5. package/dist/charts.js.map +1 -1
  6. package/dist/core.js +1240 -862
  7. package/dist/core.js.map +1 -1
  8. package/dist/debug.js +297 -0
  9. package/dist/debug.js.map +1 -0
  10. package/dist/edit.js +40 -40
  11. package/dist/edit.js.map +1 -1
  12. package/dist/explain.js +32 -13
  13. package/dist/explain.js.map +1 -1
  14. package/dist/gltf.js +128 -128
  15. package/dist/gltf.js.map +1 -1
  16. package/dist/keyboard.js +19 -19
  17. package/dist/keyboard.js.map +1 -1
  18. package/dist/motion.js +35 -35
  19. package/dist/motion.js.map +1 -1
  20. package/dist/particles.js +36 -36
  21. package/dist/particles.js.map +1 -1
  22. package/dist/passes.js +116 -104
  23. package/dist/passes.js.map +1 -1
  24. package/dist/phoria2.js +1 -1
  25. package/dist/picking.js +90 -71
  26. package/dist/picking.js.map +1 -1
  27. package/dist/snapshot.js +1 -1
  28. package/dist/tooltip.js +1 -1
  29. package/dist/types/View.d.ts +16 -0
  30. package/dist/types/debug.d.ts +74 -0
  31. package/dist/types/explain.d.ts +4 -0
  32. package/dist/types/frame.d.ts +5 -0
  33. package/dist/types/material/Material.d.ts +52 -0
  34. package/dist/types/watch.d.ts +8 -1
  35. package/dist/types/webgl/hooks.d.ts +48 -0
  36. package/dist/types/webgl/passes.d.ts +4 -0
  37. package/dist/types/webgl/programs.d.ts +15 -5
  38. package/dist/types/webgl/shaders.d.ts +36 -5
  39. package/llms-full.txt +227 -0
  40. package/llms.txt +1 -1
  41. package/package.json +1 -1
  42. package/schema/scene.schema.json +27 -0
  43. package/src/View.js +105 -7
  44. package/src/debug.js +283 -0
  45. package/src/explain.js +19 -0
  46. package/src/frame.js +7 -2
  47. package/src/material/Material.js +121 -2
  48. package/src/scene/drawables.js +21 -4
  49. package/src/watch.js +18 -2
  50. package/src/webgl/WebGLRenderer.js +19 -2
  51. package/src/webgl/hooks.js +121 -0
  52. package/src/webgl/passes.js +17 -2
  53. package/src/webgl/picking.js +23 -2
  54. package/src/webgl/programs.js +20 -9
  55. package/src/webgl/resources.js +1 -1
  56. package/src/webgl/shaders.js +443 -35
package/README.md CHANGED
@@ -20,6 +20,9 @@ product viewers. The [demo gallery](https://kevs3d.co.uk/phoria2/).
20
20
  - **Tells you what to write**: every option is checked, and a mistake throws an error that names
21
21
  the fix - pass `colour` and you get `Material: use 'color'`. Written to be easy for coding
22
22
  agents too.
23
+ - **Small shader hooks, not full shaders**: a line or two of GLSL in `material.shader` waves a flag,
24
+ dissolves a part or pulses a line, and lighting, shadows, picking and outlines keep working - the
25
+ hook runs inside phoria2's own shader. A hook that doesn't compile says which of its lines is wrong.
23
26
  - **Accessible**: `keyboard: true` lets people step through bars, points and parts with the
24
27
  arrow keys while a screen reader says what each one is; motion follows the system's
25
28
  reduced-motion setting.
@@ -69,12 +72,12 @@ own). Pin the version so a new release can't change your page:
69
72
  <script type="importmap">
70
73
  {
71
74
  "imports": {
72
- "phoria2": "https://cdn.jsdelivr.net/npm/phoria2@1.2.0/dist/phoria2.js",
73
- "phoria2/charts": "https://cdn.jsdelivr.net/npm/phoria2@1.2.0/dist/charts.js",
74
- "phoria2/particles": "https://cdn.jsdelivr.net/npm/phoria2@1.2.0/dist/particles.js",
75
- "phoria2/gltf": "https://cdn.jsdelivr.net/npm/phoria2@1.2.0/dist/gltf.js",
76
- "phoria2/motion": "https://cdn.jsdelivr.net/npm/phoria2@1.2.0/dist/motion.js",
77
- "phoria2/edit": "https://cdn.jsdelivr.net/npm/phoria2@1.2.0/dist/edit.js"
75
+ "phoria2": "https://cdn.jsdelivr.net/npm/phoria2@1.4.1/dist/phoria2.js",
76
+ "phoria2/charts": "https://cdn.jsdelivr.net/npm/phoria2@1.4.1/dist/charts.js",
77
+ "phoria2/particles": "https://cdn.jsdelivr.net/npm/phoria2@1.4.1/dist/particles.js",
78
+ "phoria2/gltf": "https://cdn.jsdelivr.net/npm/phoria2@1.4.1/dist/gltf.js",
79
+ "phoria2/motion": "https://cdn.jsdelivr.net/npm/phoria2@1.4.1/dist/motion.js",
80
+ "phoria2/edit": "https://cdn.jsdelivr.net/npm/phoria2@1.4.1/dist/edit.js"
78
81
  }
79
82
  }
80
83
  </script>
package/dist/bloom.js CHANGED
@@ -1,4 +1,4 @@
1
- import { E as e, w as t } from "./core.js";
1
+ import { D as e, k as t } from "./core.js";
2
2
  // src/webgl/bloom.js
3
3
  var n = `precision highp float;
4
4
  in vec2 vUv;
@@ -6,7 +6,7 @@ uniform sampler2D uSource;
6
6
  uniform vec2 uTexel;
7
7
  uniform float uThreshold;
8
8
  out vec4 fragColor;
9
- ${t}
9
+ ${e}
10
10
  vec3 tap(vec2 uv) {
11
11
  vec3 c = texture(uSource, uv).rgb;
12
12
  return uThreshold < 0.0 ? c : srgbToLinear(c);
@@ -29,7 +29,7 @@ uniform sampler2D uScene;
29
29
  uniform sampler2D uBloom;
30
30
  uniform float uStrength;
31
31
  out vec4 fragColor;
32
- ${t}
32
+ ${e}
33
33
  void main() {
34
34
  vec4 scene = texture(uScene, vUv);
35
35
  vec3 glow = texture(uBloom, vUv).rgb * uStrength;
@@ -37,7 +37,7 @@ vec3 c = srgbToLinear(scene.rgb) + glow;
37
37
  float a = clamp(scene.a + max(glow.r, max(glow.g, glow.b)), 0.0, 1.0);
38
38
  fragColor = vec4(linearToSrgb(c), a);
39
39
  }
40
- `, a = [e, n], o = [e, r], s = [e, i], c = 6, l = class {
40
+ `, a = [t, n], o = [t, r], s = [t, i], c = 6, l = class {
41
41
  #e = null;
42
42
  #t = !1;
43
43
  constructor(e, t) {
package/dist/bloom.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bloom.js","names":["FULLSCREEN_VERTEX","COMMON","DOWN_FRAGMENT","UP_FRAGMENT","COMPOSITE_FRAGMENT","DOWN","UP","COMPOSITE","LEVELS","Bloom","gl","programs","#target","#float","#free","target","#targetFor","width","height","down","source","sw","sh","level","i","settings","up","weight","levels","from","to","composite","samples","multisampled","color","depth","texture","t","format","w","h","framebuffer","picture","b"],"sources":[],"mappings":""}
1
+ {"version":3,"file":"bloom.js","names":["COMMON","FULLSCREEN_VERTEX","DOWN_FRAGMENT","UP_FRAGMENT","COMPOSITE_FRAGMENT","DOWN","UP","COMPOSITE","LEVELS","Bloom","gl","programs","#target","#float","#free","target","#targetFor","width","height","down","source","sw","sh","level","i","settings","up","weight","levels","from","to","composite","samples","multisampled","color","depth","texture","t","format","w","h","framebuffer","picture","b"],"sources":[],"mappings":""}