@woosh/meep-engine 2.109.16 → 2.109.19

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 (96) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +86 -50
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +86 -50
  5. package/package.json +1 -1
  6. package/src/core/color/Color.d.ts.map +1 -1
  7. package/src/core/color/Color.js +29 -6
  8. package/src/core/color/rgb2uint24.js +1 -0
  9. package/src/core/color/rgb2uint32.d.ts +10 -0
  10. package/src/core/color/rgb2uint32.d.ts.map +1 -0
  11. package/src/core/color/rgb2uint32.js +18 -0
  12. package/src/core/geom/3d/Ray3.d.ts +1 -1
  13. package/src/core/geom/3d/Ray3.d.ts.map +1 -1
  14. package/src/core/geom/3d/Ray3.js +1 -1
  15. package/src/core/geom/3d/aabb/aabb3_raycast.d.ts.map +1 -1
  16. package/src/core/geom/3d/aabb/aabb3_raycast.js +3 -2
  17. package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.d.ts.map +1 -1
  18. package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js +3 -1
  19. package/src/core/geom/3d/decompose_matrix_4_array.js +4 -4
  20. package/src/core/geom/3d/frustum/frustum_from_projection_matrix_array.d.ts.map +1 -1
  21. package/src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js +3 -1
  22. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
  23. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +2 -1
  24. package/src/core/geom/3d/quaternion/quat_encode_to_uint32.d.ts.map +1 -1
  25. package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +2 -1
  26. package/src/core/geom/3d/ray/ray3_array_apply_matrix4.d.ts.map +1 -1
  27. package/src/core/geom/3d/ray/ray3_array_apply_matrix4.js +3 -1
  28. package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts.map +1 -1
  29. package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js +3 -1
  30. package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
  31. package/src/core/geom/3d/shape/TransformedShape3D.js +7 -6
  32. package/src/core/geom/3d/shape/UnitSphereShape3D.js +1 -1
  33. package/src/core/geom/3d/topology/tm_vertex_compute_normal.d.ts.map +1 -1
  34. package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +2 -1
  35. package/src/core/geom/3d/v3_compute_triangle_normal.spec.js +2 -1
  36. package/src/core/geom/mat3/m3_rm_extract_scale.d.ts.map +1 -1
  37. package/src/core/geom/mat3/m3_rm_extract_scale.js +4 -2
  38. package/src/core/geom/vec2/v2_length.d.ts +8 -0
  39. package/src/core/geom/vec2/v2_length.d.ts.map +1 -0
  40. package/src/core/geom/vec2/v2_length.js +11 -0
  41. package/src/core/geom/vec3/v3_distance.d.ts.map +1 -1
  42. package/src/core/geom/vec3/v3_distance.js +3 -1
  43. package/src/core/geom/vec3/v3_length.js +1 -1
  44. package/src/core/geom/vec3/v3_matrix4_rotate.d.ts.map +1 -1
  45. package/src/core/geom/vec3/v3_matrix4_rotate.js +3 -1
  46. package/src/core/geom/vec3/v3_normalize_array.d.ts.map +1 -1
  47. package/src/core/geom/vec3/v3_normalize_array.js +3 -1
  48. package/src/core/json/abstractJSONSerializer.d.ts +1 -1
  49. package/src/core/json/abstractJSONSerializer.d.ts.map +1 -1
  50. package/src/core/json/abstractJSONSerializer.js +32 -6
  51. package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
  52. package/src/engine/asset/loaders/material/computeTextureHash.js +5 -1
  53. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
  54. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +2 -1
  55. package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts +3 -0
  56. package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts.map +1 -1
  57. package/src/engine/graphics/ecs/highlight/HighlightDefinition.js +31 -28
  58. package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.d.ts.map +1 -1
  59. package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +2 -1
  60. package/src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.d.ts.map +1 -1
  61. package/src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.js +5 -3
  62. package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.d.ts.map +1 -1
  63. package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +2 -1
  64. package/src/engine/graphics/ecs/path/tube/build/make_cap.d.ts.map +1 -1
  65. package/src/engine/graphics/ecs/path/tube/build/make_cap.js +3 -2
  66. package/src/engine/graphics/ecs/path/tube/build/make_ring_vertices.d.ts.map +1 -1
  67. package/src/engine/graphics/ecs/path/tube/build/make_ring_vertices.js +6 -5
  68. package/src/engine/graphics/sh3/gi/material/common.glsl +51 -9
  69. package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts.map +1 -1
  70. package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js +3 -3
  71. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +5 -0
  72. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
  73. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +11 -0
  74. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +1 -1
  75. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
  76. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +30 -15
  77. package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/frag.glsl +88 -0
  78. package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/prototype.d.ts +2 -0
  79. package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/prototype.d.ts.map +1 -0
  80. package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/prototype.js +96 -0
  81. package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/vert.glsl +65 -0
  82. package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts.map +1 -1
  83. package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.js +2 -1
  84. package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +283 -27
  85. package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
  86. package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +2 -6
  87. package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -1
  88. package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.js +1 -0
  89. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +1 -1
  90. package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -1
  91. package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.js +2 -1
  92. package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.d.ts.map +1 -1
  93. package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.js +2 -1
  94. package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +1 -1
  95. package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.js +3 -1
  96. package/src/engine/graphics/sh3/prototypeSH3Probe.js +8 -6
@@ -32,7 +32,7 @@ export class UnitSphereShape3D extends AbstractShape3D {
32
32
  const r_z = reference[2];
33
33
 
34
34
  // normalize vector to 1 radius
35
- const d = 1 / Math.hypot(r_x, r_y, r_z);
35
+ const d = 1 / v3_length(r_x, r_y, r_z);
36
36
 
37
37
  result[0] = r_x * d;
38
38
  result[1] = r_y * d;
@@ -1 +1 @@
1
- {"version":3,"file":"tm_vertex_compute_normal.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/tm_vertex_compute_normal.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,iDAJW,MAAM,EAAE,iBACR,MAAM,4BAgChB"}
1
+ {"version":3,"file":"tm_vertex_compute_normal.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/tm_vertex_compute_normal.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,iDAJW,MAAM,EAAE,iBACR,MAAM,4BAgChB"}
@@ -1,3 +1,4 @@
1
+ import { v3_length } from "../../vec3/v3_length.js";
1
2
  import { compute_triangle_normal } from "../compute_triangle_normal.js";
2
3
  //
3
4
 
@@ -30,7 +31,7 @@ export function tm_vertex_compute_normal(result, result_offset, vertex) {
30
31
  }
31
32
 
32
33
  // re-normalize
33
- const len_inv = Math.hypot(_x,_y,_z);
34
+ const len_inv = v3_length(_x,_y,_z);
34
35
 
35
36
  _x *= len_inv;
36
37
  _y *= len_inv;
@@ -1,3 +1,4 @@
1
+ import { v3_length } from "../vec3/v3_length.js";
1
2
  import { v3_compute_triangle_normal } from "./v3_compute_triangle_normal.js";
2
3
 
3
4
  test("axis aligned triangles on +X plane", () => {
@@ -41,5 +42,5 @@ test("degenerate triangle with all points at the same position", () => {
41
42
  expect(result[2]).not.toBeNaN();
42
43
 
43
44
  // normal vector length should be 1
44
- expect(Math.hypot(result[0], result[1], result[2])).toBeCloseTo(1);
45
+ expect(v3_length(result[0], result[1], result[2])).toBeCloseTo(1);
45
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"m3_rm_extract_scale.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/mat3/m3_rm_extract_scale.js"],"names":[],"mappings":"AAAA,gEAMC"}
1
+ {"version":3,"file":"m3_rm_extract_scale.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/mat3/m3_rm_extract_scale.js"],"names":[],"mappings":"AAEA,gEAMC"}
@@ -1,6 +1,8 @@
1
+ import { v2_length } from "../vec2/v2_length.js";
2
+
1
3
  export function m3_rm_extract_scale(result, m3) {
2
- const scale_x = Math.hypot(m3[0], m3[3]);
3
- const scale_y = Math.hypot(m3[1], m3[4]);
4
+ const scale_x = v2_length(m3[0], m3[3]);
5
+ const scale_y = v2_length(m3[1], m3[4]);
4
6
 
5
7
  result[0] = scale_x;
6
8
  result[1] = scale_y;
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {number} x
4
+ * @param {number} y
5
+ * @returns {number}
6
+ */
7
+ export function v2_length(x: number, y: number): number;
8
+ //# sourceMappingURL=v2_length.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2_length.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_length.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,6BAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB"}
@@ -0,0 +1,11 @@
1
+ import { v2_length_sqr } from "./v2_length_sqr.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number} x
6
+ * @param {number} y
7
+ * @returns {number}
8
+ */
9
+ export function v2_length(x, y) {
10
+ return Math.sqrt(v2_length_sqr(x, y));
11
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"v3_distance.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_distance.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,gCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAOlB"}
1
+ {"version":3,"file":"v3_distance.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_distance.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,gCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAOlB"}
@@ -1,3 +1,5 @@
1
+ import { v3_length } from "./v3_length.js";
2
+
1
3
  /**
2
4
  *
3
5
  * @param {number} x0
@@ -12,5 +14,5 @@ export function v3_distance(
12
14
  x0, y0, z0,
13
15
  x1, y1, z1
14
16
  ) {
15
- return Math.hypot(x1 - x0, y1 - y0, z1 - z0);
17
+ return v3_length(x1 - x0, y1 - y0, z1 - z0);
16
18
  }
@@ -6,5 +6,5 @@
6
6
  * @returns {number}
7
7
  */
8
8
  export function v3_length(x, y, z) {
9
- return Math.hypot(x, y, z);
9
+ return Math.sqrt(x * x + y * y + z * z);
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"v3_matrix4_rotate.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_matrix4_rotate.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,0CANW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,MACN,MAAM,EAAE,GAAC,YAAY,QAoB/B"}
1
+ {"version":3,"file":"v3_matrix4_rotate.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_matrix4_rotate.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,0CANW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,MACN,MAAM,EAAE,GAAC,YAAY,QAoB/B"}
@@ -1,3 +1,5 @@
1
+ import { v3_length } from "./v3_length.js";
2
+
1
3
  /**
2
4
  * Perform rotation on a direction vector using 3x3 portion of a 4x4 matrix
3
5
  * @param {number[]|Float32Array} output
@@ -19,7 +21,7 @@ export function v3_matrix4_rotate(
19
21
  const _y = m4[1] * x + m4[5] * y + m4[9] * z;
20
22
  const _z = m4[2] * x + m4[6] * y + m4[10] * z;
21
23
 
22
- const norm = 1 / Math.hypot(_x, _y, _z);
24
+ const norm = 1 / v3_length(_x, _y, _z);
23
25
 
24
26
  output[output_offset] = _x * norm;
25
27
  output[output_offset + 1] = _y * norm;
@@ -1 +1 @@
1
- {"version":3,"file":"v3_normalize_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_normalize_array.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,0CALW,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,QAqBhB"}
1
+ {"version":3,"file":"v3_normalize_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_normalize_array.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,0CALW,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,QAqBhB"}
@@ -1,3 +1,5 @@
1
+ import { v3_length } from "./v3_length.js";
2
+
1
3
  /**
2
4
  *
3
5
  * @param {number[]|Float32Array} input
@@ -17,7 +19,7 @@ export function v3_normalize_array(
17
19
  const z = input[input_offset + 2];
18
20
 
19
21
  // compute vector inverse magnitude
20
- const n = 1.0 / Math.hypot(x, y, z);
22
+ const n = 1.0 / v3_length(x, y, z);
21
23
 
22
24
  // write back
23
25
  output[output_offset] = x * n;
@@ -6,7 +6,7 @@
6
6
  * @param {boolean} [constructorNameFallback]
7
7
  */
8
8
  export function abstractJSONSerializer<T>(source: T, serializers: any, classNames: Map<any, string>, constructorNameFallback?: boolean): T | {
9
- type: string;
9
+ type: any;
10
10
  data: any;
11
11
  };
12
12
  //# sourceMappingURL=abstractJSONSerializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstractJSONSerializer.d.ts","sourceRoot":"","sources":["../../../../src/core/json/abstractJSONSerializer.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mFAHW,SAAM,MAAM,CAAC,4BACb,OAAO;;;EAiEjB"}
1
+ {"version":3,"file":"abstractJSONSerializer.d.ts","sourceRoot":"","sources":["../../../../src/core/json/abstractJSONSerializer.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AACH,mFAHW,SAAM,MAAM,CAAC,4BACb,OAAO;;;EA4DjB"}
@@ -1,3 +1,34 @@
1
+ /**
2
+ *
3
+ * @param {Function} Klass
4
+ * @param {Map<Function, string>} classNames
5
+ * @param {number} [max_depth] prevents infinite recursion
6
+ * @returns {*}
7
+ */
8
+ function resolve_class_name(Klass, classNames, max_depth = 64) {
9
+ let typeName = classNames.get(Klass);
10
+
11
+ if (typeName === undefined && Klass.hasOwnProperty("typeName")) {
12
+ // try fallback to "typeName" field on constructor
13
+ typeName = Klass.typeName;
14
+ }
15
+
16
+ if (typeName === undefined && max_depth > 0) {
17
+ // try walking up prototype chain
18
+
19
+ const proto = Object.getPrototypeOf(Klass);
20
+
21
+ if (proto !== null && typeof proto === "object") {
22
+
23
+ return resolve_class_name(proto, classNames, max_depth - 1);
24
+
25
+ }
26
+
27
+ }
28
+
29
+ return typeName;
30
+ }
31
+
1
32
  /**
2
33
  * @template T
3
34
  * @param {T} source
@@ -17,12 +48,7 @@ export function abstractJSONSerializer(source, serializers, classNames, construc
17
48
 
18
49
  // extract type name
19
50
  const Klass = source.constructor;
20
- let typeName = classNames.get(Klass);
21
-
22
- if (typeName === undefined && Klass.hasOwnProperty("typeName")) {
23
- // try fallback to "typeName" field on constructor
24
- typeName = Klass.typeName;
25
- }
51
+ let typeName = resolve_class_name(Klass, classNames);
26
52
 
27
53
  if (typeName === undefined && constructorNameFallback) {
28
54
  typeName = Klass.name;
@@ -1 +1 @@
1
- {"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH;;WAHoD,MAAM;YAAQ,MAAM;IAC5D,MAAM,CAuCjB;AA4CD;;;;GAIG;AACH,sCAHW,UAAQ,MAAM,OAAO,GACnB,MAAM,CAiClB"}
1
+ {"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH;;WAHoD,MAAM;YAAQ,MAAM;IAC5D,MAAM,CAuCjB;AA4CD;;;;GAIG;AACH,sCAHW,UAAQ,MAAM,OAAO,GACnB,MAAM,CAqClB"}
@@ -140,7 +140,11 @@ export function computeTextureHash(t) {
140
140
  t.premultiplyAlpha ? 1 : 0,
141
141
  t.flipY ? 1 : 0,
142
142
  t.unpackAlignment,
143
- t.encoding,
143
+ /*
144
+ we are excluding encoding from hash, as this property has disappeared in later version of three.js
145
+ This property is rarely going to have the deciding role for the hash anyway. This notice is left for historical purposes only
146
+ */
147
+ // t.encoding,
144
148
  specificHash
145
149
  );
146
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"canvas2d_draw_linear_scale.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/canvas/canvas2d_draw_linear_scale.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,0IAVW,wBAAwB,QAyDlC"}
1
+ {"version":3,"file":"canvas2d_draw_linear_scale.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/canvas/canvas2d_draw_linear_scale.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,0IAVW,wBAAwB,QAyDlC"}
@@ -1,3 +1,4 @@
1
+ import { v2_length } from "../../../core/geom/vec2/v2_length.js";
1
2
  import { lerp } from "../../../core/math/lerp.js";
2
3
  import { number_pretty_print } from "../../../core/primitives/numbers/number_pretty_print.js";
3
4
  import { canvas2d_draw_label } from "./canvas2d_draw_label.js";
@@ -31,7 +32,7 @@ export function canvas2d_draw_linear_scale({
31
32
  const delta_x = position_x1 - position_x0;
32
33
  const delta_y = position_y1 - position_y0;
33
34
 
34
- const distance = Math.hypot(delta_x, delta_y);
35
+ const distance = v2_length(delta_x, delta_y);
35
36
 
36
37
  if (distance === 0) {
37
38
  throw new Error(`Distance must be greater than 0`);
@@ -2,6 +2,9 @@ import {Color} from "../../../../core/color/Color";
2
2
 
3
3
  export class HighlightDefinition {
4
4
  readonly color: Color
5
+ /**
6
+ * @deprecated use {@link Color#a} instead
7
+ */
5
8
  opacity: number
6
9
 
7
10
  static rgba(r: number, g: number, b: number, a?: number): HighlightDefinition
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightDefinition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/highlight/HighlightDefinition.js"],"names":[],"mappings":"AAKA;IAmDI;;;;OAIG;IACH,yBAFY,mBAAmB,CAQ9B;IAED;;;;;;;OAOG;IACH,eANW,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,GACL,mBAAmB,CAS9B;IA5EG;;;OAGG;IACH,gBAFU,KAAK,CAES;IAExB;;;OAGG;IACH,SAFU,MAAM,CAEA;IAGpB;;;;OAIG;IACH,cAHW,mBAAmB,GACjB,OAAO,CAKnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;aAKC;IAED;;;MAKC;CA+BJ;sBArFqB,iCAAiC"}
1
+ {"version":3,"file":"HighlightDefinition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/highlight/HighlightDefinition.js"],"names":[],"mappings":"AAEA;IA0DI;;;;OAIG;IACH,yBAFY,mBAAmB,CAQ9B;IAED;;;;;;;OAOG;IACH,eANW,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,GACL,mBAAmB,CAQ9B;IAnFD;;;OAGG;IACH,gBAFU,KAAK,CAEK;IAWpB;;;OAGG;IACH,yBAEC;IAdD;;;OAGG;IACH,sBAEC;IAUD;;;;OAIG;IACH,cAHW,mBAAmB,GACjB,OAAO,CAInB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;aAQC;IAED;;MAIC;CA8BJ;sBAxFqB,iCAAiC"}
@@ -1,22 +1,28 @@
1
1
  import { Color } from "../../../../core/color/Color.js";
2
- import { assert } from "../../../../core/assert.js";
3
- import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
4
- import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
5
2
 
6
3
  export class HighlightDefinition {
7
- constructor() {
8
-
9
- /**
10
- * @readonly
11
- * @type {Color}
12
- */
13
- this.color = new Color();
14
-
15
- /**
16
- * Value from 0 to 1
17
- * @type {number}
18
- */
19
- this.opacity = 1;
4
+
5
+ /**
6
+ * @readonly
7
+ * @type {Color}
8
+ */
9
+ color = new Color();
10
+
11
+
12
+ /**
13
+ * @deprecated use {@link Color#a} instead
14
+ * @returns {number}
15
+ */
16
+ get opacity() {
17
+ return this.color.a;
18
+ }
19
+
20
+ /**
21
+ * @deprecated use {@link Color#a} instead
22
+ * @param {number} v
23
+ */
24
+ set opacity(v) {
25
+ this.color.a = v;
20
26
  }
21
27
 
22
28
  /**
@@ -25,8 +31,7 @@ export class HighlightDefinition {
25
31
  * @returns {boolean}
26
32
  */
27
33
  equals(other) {
28
- return this.opacity === other.opacity
29
- && this.color.equals(other.color);
34
+ return this.color.equals(other.color);
30
35
  }
31
36
 
32
37
  /**
@@ -34,22 +39,21 @@ export class HighlightDefinition {
34
39
  * @returns {number}
35
40
  */
36
41
  hash() {
37
- return computeHashIntegerArray(
38
- this.color.hash(),
39
- computeHashFloat(this.opacity)
40
- );
42
+ return this.color.hash()
41
43
  }
42
44
 
43
- fromJSON({ opacity = 1, color }) {
44
- assert.isNumber(opacity, 'opacity');
45
+ fromJSON({ opacity, color }) {
45
46
 
46
- this.opacity = opacity;
47
47
  this.color.fromJSON(color);
48
+
49
+ if (opacity !== undefined) {
50
+ // Deprecated behavior for backwards compatibility
51
+ this.color.setA(opacity);
52
+ }
48
53
  }
49
54
 
50
55
  toJSON() {
51
56
  return {
52
- opacity: this.opacity,
53
57
  color: this.color.toJSON()
54
58
  };
55
59
  }
@@ -78,8 +82,7 @@ export class HighlightDefinition {
78
82
  static rgba(r, g, b, a = 1) {
79
83
  const result = new HighlightDefinition();
80
84
 
81
- result.color.setRGB(r, g, b);
82
- result.opacity = a;
85
+ result.color.set(r, g, b, a);
83
86
 
84
87
  return result;
85
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build_geometry_catmullrom.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js"],"names":[],"mappings":"AAmFA;;;;;;;;;;GAUG;AACH,mFAPW,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,mBACrB,MAAM,EAAE,iBACR,MAAM,eACN,MAAM,GACL,MAAM,cAAc,CAoI/B"}
1
+ {"version":3,"file":"build_geometry_catmullrom.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js"],"names":[],"mappings":"AAoFA;;;;;;;;;;GAUG;AACH,mFAPW,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,mBACrB,MAAM,EAAE,iBACR,MAAM,eACN,MAAM,GACL,MAAM,cAAc,CAoI/B"}
@@ -1,4 +1,5 @@
1
1
  import { v3_dot } from "../../../../../../core/geom/vec3/v3_dot.js";
2
+ import { v3_length } from "../../../../../../core/geom/vec3/v3_length.js";
2
3
  import { clamp } from "../../../../../../core/math/clamp.js";
3
4
  import { max2 } from "../../../../../../core/math/max2.js";
4
5
  import {
@@ -68,7 +69,7 @@ function sample_path(positions, derivatives, result_offset, path, offset) {
68
69
  const dy = derivatives[result_offset + 1];
69
70
  const dz = derivatives[result_offset + 2];
70
71
 
71
- const mag = Math.hypot(dx, dy, dz);
72
+ const mag = v3_length(dx, dy, dz);
72
73
 
73
74
  if (mag !== 0) {
74
75
  const inv_mag = 1 / mag;
@@ -1 +1 @@
1
- {"version":3,"file":"compute_smooth_profile_normals.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sDAHW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,EAAE,GAAC,YAAY,QAqC/B"}
1
+ {"version":3,"file":"compute_smooth_profile_normals.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sDAHW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,EAAE,GAAC,YAAY,QAqC/B"}
@@ -1,3 +1,5 @@
1
+ import { v2_length } from "../../../../../../core/geom/vec2/v2_length.js";
2
+
1
3
  /**
2
4
  *
3
5
  * @param {number[]|Float32Array} shape
@@ -26,13 +28,13 @@ export function compute_smooth_profile_normals(shape, normals) {
26
28
  const d1_x = i1_x - i2_x;
27
29
  const d1_y = i1_y - i2_y;
28
30
 
29
- const d0_l_inv = 1 / Math.hypot(d0_x, d0_y);
30
- const d1_l_inv = 1 / Math.hypot(d1_x, d1_y);
31
+ const d0_l_inv = 1 / v2_length(d0_x, d0_y);
32
+ const d1_l_inv = 1 / v2_length(d1_x, d1_y);
31
33
 
32
34
  const nx = d0_x * d0_l_inv + d1_x * d1_l_inv;
33
35
  const ny = d0_y * d0_l_inv + d1_y * d1_l_inv;
34
36
 
35
- const dn_l_inv = 1 / Math.hypot(nx, ny);
37
+ const dn_l_inv = 1 / v2_length(nx, ny);
36
38
 
37
39
  // write out normal
38
40
  normals[i * 2] = nx * dn_l_inv;
@@ -1 +1 @@
1
- {"version":3,"file":"makeTubeGeometry.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;GAcG;AACH,+CAZW,YAAY,GAAC,MAAM,EAAE,cACrB,OAAO,EAAE,gBACT,OAAO,EAAE,eACT,OAAO,EAAE,SACT,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,WACrB,OAAO,aACP,OAAO,GACL,cAAc,CA0G1B;wBAnIuC,OAAO;wBAGvB,eAAe;+BAHC,OAAO"}
1
+ {"version":3,"file":"makeTubeGeometry.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;GAcG;AACH,+CAZW,YAAY,GAAC,MAAM,EAAE,cACrB,OAAO,EAAE,gBACT,OAAO,EAAE,eACT,OAAO,EAAE,SACT,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,WACrB,OAAO,aACP,OAAO,GACL,cAAc,CA0G1B;wBApIuC,OAAO;wBAIvB,eAAe;+BAJC,OAAO"}
@@ -1,6 +1,7 @@
1
1
  import { BufferGeometry, Vector3 } from "three";
2
2
  import { assert } from "../../../../../../core/assert.js";
3
3
  import { v3_angle_cos_between } from "../../../../../../core/geom/vec3/v3_angle_cos_between.js";
4
+ import { v3_length } from "../../../../../../core/geom/vec3/v3_length.js";
4
5
  import { CapType } from "../CapType.js";
5
6
  import { append_compute_cap_geometry_size, make_cap } from "./make_cap.js";
6
7
  import { make_ring_faces } from "./make_ring_faces.js";
@@ -190,7 +191,7 @@ function compute_bend_normal(
190
191
 
191
192
  const angle = v3_angle_cos_between(d0_x, d0_y, d0_z, d1_x, d1_y, d1_z);
192
193
 
193
- const length_inv = 1 / Math.hypot(cross_x, cross_y, cross_z);
194
+ const length_inv = 1 / v3_length(cross_x, cross_y, cross_z);
194
195
 
195
196
  out[0] = cross_x * length_inv;
196
197
  out[1] = cross_y * length_inv;
@@ -1 +1 @@
1
- {"version":3,"file":"make_cap.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/make_cap.js"],"names":[],"mappings":"AA+MA;;;;;;;;;;;;;;GAcG;AACH,4DAbW,MAAM,gBACN,YAAY,GAAC,MAAM,EAAE,cACrB,OAAO,EAAE,gBACT,OAAO,EAAE,eAET,OAAO,EAAE,SACT,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,aACrB,MAAM,QACN,OAAO,QA6BjB;AAED;;;;;;GAMG;AACH,wDALW,MAAM,OACN;IAAC,aAAa,EAAC,MAAM,CAAC;IAAC,YAAY,EAAC,MAAM,CAAA;CAAC,mBAC3C,MAAM,QACN,OAAO,QAiBjB;wBAjRuB,OAAO;wBAKP,eAAe"}
1
+ {"version":3,"file":"make_cap.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/make_cap.js"],"names":[],"mappings":"AAgNA;;;;;;;;;;;;;;GAcG;AACH,4DAbW,MAAM,gBACN,YAAY,GAAC,MAAM,EAAE,cACrB,OAAO,EAAE,gBACT,OAAO,EAAE,eAET,OAAO,EAAE,SACT,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,aACrB,MAAM,QACN,OAAO,QA6BjB;AAED;;;;;;GAMG;AACH,wDALW,MAAM,OACN;IAAC,aAAa,EAAC,MAAM,CAAC;IAAC,YAAY,EAAC,MAAM,CAAA;CAAC,mBAC3C,MAAM,QACN,OAAO,QAiBjB;wBAlRuB,OAAO;wBAMP,eAAe"}
@@ -2,6 +2,7 @@ import { Vector3 } from "three";
2
2
  import { m3_multiply } from "../../../../../../core/geom/mat3/m3_multiply.js";
3
3
  import { m3_rm_compose_transform } from "../../../../../../core/geom/mat3/m3_rm_compose_transform.js";
4
4
  import { v2_distance } from "../../../../../../core/geom/vec2/v2_distance.js";
5
+ import { v2_length } from "../../../../../../core/geom/vec2/v2_length.js";
5
6
  import { max2 } from "../../../../../../core/math/max2.js";
6
7
  import { CapType } from "../CapType.js";
7
8
  import { make_ring_faces } from "./make_ring_faces.js";
@@ -99,8 +100,8 @@ function make_cap_round(
99
100
  const radius_raw = compute_shape_radius(shape, shape_length);
100
101
 
101
102
  // extract scale from shape matrix
102
- const scale_x = Math.hypot(shape_transform[0], shape_transform[3]);
103
- const scale_y = Math.hypot(shape_transform[1], shape_transform[4]);
103
+ const scale_x = v2_length(shape_transform[0], shape_transform[3]);
104
+ const scale_y = v2_length(shape_transform[1], shape_transform[4]);
104
105
 
105
106
  const radius = radius_raw * max2(scale_x, scale_y);
106
107
 
@@ -1 +1 @@
1
- {"version":3,"file":"make_ring_vertices.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/make_ring_vertices.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,mEAbW,MAAM,MACN,MAAM,MACN,MAAM,yCAIN,MAAM,cACN,MAAM,EAAE,GAAC,YAAY,SACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,QAqI/B"}
1
+ {"version":3,"file":"make_ring_vertices.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/make_ring_vertices.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,mEAbW,MAAM,MACN,MAAM,MACN,MAAM,yCAIN,MAAM,cACN,MAAM,EAAE,GAAC,YAAY,SACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,QAqI/B"}
@@ -1,6 +1,7 @@
1
1
  //
2
2
 
3
3
  import { v3_dot } from "../../../../../../core/geom/vec3/v3_dot.js";
4
+ import { v3_length } from "../../../../../../core/geom/vec3/v3_length.js";
4
5
 
5
6
  /**
6
7
  *
@@ -55,7 +56,7 @@ export function make_ring_vertices(
55
56
  const radial_normal_z_raw = (n_cos_z - b_sin_z);
56
57
 
57
58
 
58
- const radial_normal_magnitude = Math.hypot(radial_normal_x_raw, radial_normal_y_raw, radial_normal_z_raw);
59
+ const radial_normal_magnitude = v3_length(radial_normal_x_raw, radial_normal_y_raw, radial_normal_z_raw);
59
60
 
60
61
  let normal_x;
61
62
  let normal_y;
@@ -96,16 +97,16 @@ export function make_ring_vertices(
96
97
  const n_normal_y_raw = (-nn_cos_y - nb_sin_y);
97
98
  const n_normal_z_raw = (-nn_cos_z - nb_sin_z);
98
99
 
99
- const n_normal_magnitude = Math.hypot(n_normal_x_raw, n_normal_y_raw, n_normal_z_raw);
100
+ const n_normal_magnitude = v3_length(n_normal_x_raw, n_normal_y_raw, n_normal_z_raw);
100
101
 
101
102
  const cv = out.cursor_vertices;
102
103
  const cv3 = cv * 3;
103
104
 
104
- if(n_normal_magnitude !== 0){
105
+ if (n_normal_magnitude !== 0) {
105
106
  out_normals[cv3] = n_normal_x_raw / n_normal_magnitude;
106
107
  out_normals[cv3 + 1] = n_normal_y_raw / n_normal_magnitude;
107
108
  out_normals[cv3 + 2] = n_normal_z_raw / n_normal_magnitude;
108
- }else {
109
+ } else {
109
110
 
110
111
  out_normals[cv3] = T.x;
111
112
  out_normals[cv3 + 1] = T.y;
@@ -120,7 +121,7 @@ export function make_ring_vertices(
120
121
  const cross_y = bend_angle[2] * T.x - bend_angle[0] * T.z;
121
122
  const cross_z = bend_angle[0] * T.y - bend_angle[1] * T.x;
122
123
 
123
- const rotated_bend_normal_length = Math.hypot(cross_x, cross_y, cross_z);
124
+ const rotated_bend_normal_length = v3_length(cross_x, cross_y, cross_z);
124
125
  const bend_normal_length_inv = 1 / rotated_bend_normal_length;
125
126
 
126
127
  // apply bend angle
@@ -203,29 +203,71 @@ vec2 lpv_sample_bilinear(sampler2D tex, ivec2 texel_position, vec2 fraction) {
203
203
  );
204
204
  }
205
205
 
206
+ ivec2 wrapOctahedralTexelCoordinates(const in ivec2 texel, const in int texture_size) {
207
+ ivec2 wrapped = ((texel % texture_size) + texture_size) % texture_size;
208
+
209
+ int fx = (abs(texel.x / texture_size) + int(texel.x < 0));
210
+ int fy = (abs(texel.y / texture_size) + int(texel.y < 0));
211
+
212
+ if (((fx ^ fy) & 1) != 0) {
213
+ return (texture_size - (wrapped + ivec2(1)));
214
+ return wrapped;
215
+ } else {
216
+ return wrapped;
217
+ }
218
+ }
219
+
206
220
  vec2 lpv_probe_getDepthBilinear(uint probe_index, vec3 direction) {
207
221
  // get offset
208
- uint depth_tile_resolution = lpv_u_probe_depth_resolution;
209
- uvec2 atlas_size = uvec2(4096u);
222
+ int depth_tile_resolution = int(lpv_u_probe_depth_resolution);
223
+ ivec2 tile_resolution = ivec2(depth_tile_resolution);
224
+ const ivec2 atlas_size = ivec2(4096);
210
225
 
211
- uint tiles_per_row = atlas_size.x / depth_tile_resolution;
226
+ int tiles_per_row = atlas_size.x / depth_tile_resolution;
212
227
 
213
- uint tile_x = probe_index % tiles_per_row;
214
- uint tile_y = probe_index / tiles_per_row;
228
+ int tile_x = int(probe_index) % tiles_per_row;
229
+ int tile_y = int(probe_index) / tiles_per_row;
215
230
 
216
- vec2 tile_offset = vec2(
231
+ ivec2 tile_offset = ivec2(
217
232
  tile_x * depth_tile_resolution,
218
233
  tile_y * depth_tile_resolution
219
234
  );
220
235
 
221
236
  // convert direction to UV
222
237
  vec2 octahedral_uv = clamp(VecToSphereOct(direction) * 0.5 + 0.5, 0.0, 1.0);
223
- vec2 grid = octahedral_uv * vec2(depth_tile_resolution - 1u);
238
+ vec2 grid = octahedral_uv * vec2(depth_tile_resolution) - 0.5;
224
239
 
225
240
  vec2 gridFrac = fract(grid);
226
- vec2 gridFloor = floor(grid);
227
241
 
228
- return lpv_sample_bilinear(lpv_t_probe_depth, ivec2(gridFloor+tile_offset),gridFrac);
242
+ ivec2 texel_position = ivec2(floor(grid));
243
+
244
+ ivec2 tile_p_00;
245
+ ivec2 tile_p_01;
246
+ ivec2 tile_p_10;
247
+ ivec2 tile_p_11;
248
+
249
+ tile_p_00 = wrapOctahedralTexelCoordinates(texel_position , depth_tile_resolution);
250
+ tile_p_01 = wrapOctahedralTexelCoordinates(texel_position + ivec2(1, 0), depth_tile_resolution);
251
+ tile_p_10 = wrapOctahedralTexelCoordinates(texel_position + ivec2(0, 1), depth_tile_resolution);
252
+ tile_p_11 = wrapOctahedralTexelCoordinates(texel_position + ivec2(1, 1), depth_tile_resolution);
253
+
254
+ float texel_00 = texelFetch(lpv_t_probe_depth, tile_offset + tile_p_00, 0).r;
255
+ float texel_01 = texelFetch(lpv_t_probe_depth, tile_offset + tile_p_01, 0).r;
256
+ float texel_10 = texelFetch(lpv_t_probe_depth, tile_offset + tile_p_10, 0).r;
257
+ float texel_11 = texelFetch(lpv_t_probe_depth, tile_offset + tile_p_11, 0).r;
258
+
259
+ return vec2(
260
+ lpv_bilinear_lerp(
261
+ texel_00, texel_01,
262
+ texel_10, texel_11,
263
+ gridFrac
264
+ ),
265
+ lpv_bilinear_lerp(
266
+ texel_00 * texel_00, texel_01 * texel_01,
267
+ texel_10 * texel_10, texel_11 * texel_11,
268
+ gridFrac
269
+ )
270
+ );
229
271
  }
230
272
 
231
273
  vec3 lpv_probe_getPosition(uint probe_index) {
@@ -1 +1 @@
1
- {"version":3,"file":"makeOctahedralDepthAtlas.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sDAHW,MAAM,GACJ,WAAW,CAsBvB;4BA3BoF,OAAO"}
1
+ {"version":3,"file":"makeOctahedralDepthAtlas.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sDAHW,MAAM,GACJ,WAAW,CAsBvB;4BA3BqF,OAAO"}
@@ -1,4 +1,4 @@
1
- import { ClampToEdgeWrapping, DataTexture, FloatType, NearestFilter, RGFormat } from "three";
1
+ import { ClampToEdgeWrapping, DataTexture, FloatType, NearestFilter, RedFormat } from "three";
2
2
 
3
3
  /**
4
4
  *
@@ -7,10 +7,10 @@ import { ClampToEdgeWrapping, DataTexture, FloatType, NearestFilter, RGFormat }
7
7
  */
8
8
  export function makeOctahedralDepthAtlas(resolution = 4096) {
9
9
  const texture = new DataTexture(
10
- new Float32Array(resolution * resolution * 2),
10
+ new Float32Array(resolution * resolution),
11
11
  resolution,
12
12
  resolution,
13
- RGFormat, // 2 channels
13
+ RedFormat,
14
14
  FloatType
15
15
  );
16
16