@expofp/renderer 3.37.1 → 3.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +34 -0
  2. package/dist/controls/camera-api.d.ts +28 -0
  3. package/dist/controls/camera-api.js +33 -10
  4. package/dist/controls/hooks.js +2 -0
  5. package/dist/core/InstanceUniforms.d.ts +15 -0
  6. package/dist/core/InstanceUniforms.js +32 -0
  7. package/dist/core/batch/BatchedMesh.js +6 -0
  8. package/dist/core/instanced/instanced-material.js +5 -1
  9. package/dist/core/lines/BatchedLines.d.ts +9 -7
  10. package/dist/core/lines/BatchedLines.js +9 -7
  11. package/dist/core/lines/{FrustumCulling.d.ts → FrustumCullingLines.d.ts} +7 -6
  12. package/dist/core/lines/{FrustumCulling.js → FrustumCullingLines.js} +2 -2
  13. package/dist/core/lines/{Raycasting.d.ts → RaycastingLines.d.ts} +7 -6
  14. package/dist/core/lines/{Raycasting.js → RaycastingLines.js} +2 -2
  15. package/dist/core/lines/lines-material.js +10 -1
  16. package/dist/core/sprites/BatchedSprites.d.ts +115 -0
  17. package/dist/core/sprites/BatchedSprites.js +205 -0
  18. package/dist/core/sprites/RaycastingSprites.d.ts +41 -0
  19. package/dist/core/sprites/RaycastingSprites.js +71 -0
  20. package/dist/core/sprites/sprite-material.d.ts +59 -0
  21. package/dist/core/sprites/sprite-material.js +192 -0
  22. package/dist/core/text/BatchedText.d.ts +6 -0
  23. package/dist/core/text/BatchedText.js +6 -0
  24. package/dist/core/text/MemberTexture.js +55 -1
  25. package/dist/core/text/Text.d.ts +16 -1
  26. package/dist/core/text/Text.js +15 -0
  27. package/dist/core/text/batched-text-material.js +4 -2
  28. package/dist/objects/containers/hooks.d.ts +7 -2
  29. package/dist/objects/containers/hooks.js +20 -5
  30. package/dist/objects/containers/mesh-writes.js +3 -3
  31. package/dist/objects/images/ImageInstance.js +111 -43
  32. package/dist/objects/images/Images.d.ts +19 -7
  33. package/dist/objects/images/Images.js +266 -83
  34. package/dist/objects/images/atlas-packer.d.ts +92 -91
  35. package/dist/objects/images/atlas-packer.js +230 -258
  36. package/dist/objects/images/image-container.d.ts +14 -3
  37. package/dist/objects/images/image-container.js +19 -5
  38. package/dist/objects/images/pack-sources.d.ts +190 -0
  39. package/dist/objects/images/pack-sources.js +272 -0
  40. package/dist/objects/images/texture-budget.js +2 -2
  41. package/dist/objects/images/worker/atlas-worker.d.ts +56 -0
  42. package/dist/objects/images/worker/atlas-worker.js +123 -0
  43. package/dist/objects/images/worker/client.d.ts +62 -0
  44. package/dist/objects/images/worker/client.js +249 -0
  45. package/dist/objects/images/worker/index.d.ts +10 -0
  46. package/dist/objects/images/worker/index.js +1 -0
  47. package/dist/objects/layer/Layer.d.ts +7 -6
  48. package/dist/objects/layer/Layer.js +40 -30
  49. package/dist/objects/layer/layer-context.d.ts +41 -0
  50. package/dist/objects/layer/layer-context.js +45 -0
  51. package/dist/objects/materials/ColorMaterial.js +16 -3
  52. package/dist/objects/materials/LineMaterial.js +4 -2
  53. package/dist/objects/materials/TextureMaterial.js +14 -2
  54. package/dist/objects/materials/effects/color-dim.d.ts +1 -10
  55. package/dist/objects/materials/effects/color-dim.js +21 -18
  56. package/dist/objects/materials/effects/effects-context.d.ts +6 -5
  57. package/dist/objects/materials/shared.d.ts +18 -0
  58. package/dist/objects/materials/shared.js +21 -0
  59. package/dist/objects/models/Models.js +1 -8
  60. package/dist/objects/shapes/Shapes.js +2 -9
  61. package/dist/objects/text/TextInstance.js +1 -1
  62. package/dist/objects/text/text-layout.d.ts +13 -4
  63. package/dist/objects/text/text-layout.js +30 -4
  64. package/dist/space/Space.d.ts +15 -0
  65. package/dist/space/Space.js +16 -10
  66. package/dist/types/defs.d.ts +53 -2
  67. package/dist/utils/logging.d.ts +6 -3
  68. package/dist/utils/logging.js +15 -7
  69. package/dist/utils/math.d.ts +11 -0
  70. package/dist/utils/math.js +14 -0
  71. package/package.json +2 -2
@@ -3,20 +3,28 @@ import createLog from 'debug';
3
3
  import { isLayerDefs } from '../types/guards';
4
4
  const rootNamespace = 'efp:renderer';
5
5
  /**
6
- * Creates a logger with the given namespace.
7
- * @param namespace - The namespace to use for the logger.
8
- * @returns A logger with the given namespace.
6
+ * Creates a logger for one namespace, nested under the root namespace.
7
+ *
8
+ * Each level prints only if you enable its namespace, for example with
9
+ * `debug.enable('efp:renderer:*')`.
10
+ * @param namespace - The namespace to nest under the root namespace.
11
+ * @returns A logger with four levels, all under that namespace.
9
12
  */
10
13
  export function createLogger(namespace) {
11
14
  const fullNamespace = namespace ? `${rootNamespace}:${namespace}` : rootNamespace;
12
15
  const info = createLog(fullNamespace);
13
- info.log = console.info.bind(console);
16
+ // Each wrapper reads the console method at call time, not at setup time. A plain
17
+ // `console.warn.bind(console)` freezes the method the console object held at that
18
+ // moment. A test can later replace `console.warn`, for example with
19
+ // `vi.spyOn(console, 'warn')`. The frozen copy still calls the old method, so the
20
+ // spy never sees the call.
21
+ info.log = (...args) => console.info(...args);
14
22
  const debug = info.extend('debug');
15
- debug.log = console.debug.bind(console);
23
+ debug.log = (...args) => console.debug(...args);
16
24
  const warn = info.extend('warn');
17
- warn.log = console.warn.bind(console);
25
+ warn.log = (...args) => console.warn(...args);
18
26
  const error = info.extend('error');
19
- error.log = console.error.bind(console);
27
+ error.log = (...args) => console.error(...args);
20
28
  return {
21
29
  debug,
22
30
  info,
@@ -1,3 +1,4 @@
1
+ import { type Matrix4 } from 'three';
1
2
  /**
2
3
  * Holds a value inside an inclusive range.
3
4
  *
@@ -21,4 +22,14 @@ export declare function clamp(value: number, min: number, max: number): number;
21
22
  * @returns The value in `[0, modulus)`.
22
23
  */
23
24
  export declare function euclideanModulo(value: number, modulus: number): number;
25
+ /**
26
+ * The length one unit along an axis is drawn at, which is the scale the matrix applies there.
27
+ *
28
+ * Reads the elements directly rather than through a vector, because picking calls this per instance
29
+ * per test and a scratch vector would be one more shared object to reason about.
30
+ * @param matrix - The matrix to measure.
31
+ * @param axis - Which axis. `0` is x, `1` is y and `2` is z.
32
+ * @returns The transformed axis's length.
33
+ */
34
+ export declare function axisLength(matrix: Matrix4, axis: number): number;
24
35
  //# sourceMappingURL=math.d.ts.map
@@ -25,3 +25,17 @@ export function clamp(value, min, max) {
25
25
  export function euclideanModulo(value, modulus) {
26
26
  return ((value % modulus) + modulus) % modulus;
27
27
  }
28
+ /**
29
+ * The length one unit along an axis is drawn at, which is the scale the matrix applies there.
30
+ *
31
+ * Reads the elements directly rather than through a vector, because picking calls this per instance
32
+ * per test and a scratch vector would be one more shared object to reason about.
33
+ * @param matrix - The matrix to measure.
34
+ * @param axis - Which axis. `0` is x, `1` is y and `2` is z.
35
+ * @returns The transformed axis's length.
36
+ */
37
+ export function axisLength(matrix, axis) {
38
+ const elements = matrix.elements;
39
+ const at = axis * 4;
40
+ return Math.hypot(elements[at], elements[at + 1], elements[at + 2]);
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/renderer",
3
- "version": "3.37.1",
3
+ "version": "3.39.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/expofp/efp-app.git",
@@ -42,7 +42,7 @@
42
42
  "troika-three-text": "^0.52.5",
43
43
  "tslib": "^2.3.0",
44
44
  "webgl-memory": "^1.1.3",
45
- "@expofp/geometry": "3.37.1"
45
+ "@expofp/geometry": "3.39.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@react-three/test-renderer": "^9.1.0",