@woosh/meep-engine 2.47.42 → 2.48.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 (91) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +44161 -44112
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +44162 -44112
  5. package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +3 -3
  6. package/editor/view/node-graph/NodeGraphView.js +1 -1
  7. package/package.json +1 -1
  8. package/samples/terrain/editor.js +4 -4
  9. package/src/core/{collection/table/DataType.js → binary/type/BinaryDataType.js} +1 -1
  10. package/src/core/binary/type/DataType2TypedArrayConstructorMapping.js +34 -0
  11. package/src/core/binary/type/DataTypeByteSizes.js +37 -0
  12. package/src/core/binary/type/DataTypeIndices.js +17 -0
  13. package/src/core/{collection/table → binary/type}/computeDataTypeByIndex.js +1 -1
  14. package/src/core/binary/type/dataTypeFromTypedArray.js +31 -0
  15. package/src/core/collection/array/typedArrayToDataType.js +10 -10
  16. package/src/core/collection/table/RowFirstTable.js +1 -1
  17. package/src/core/collection/table/RowFirstTable.spec.js +16 -16
  18. package/src/core/collection/table/RowFirstTableSpec.js +9 -9
  19. package/src/core/collection/table/deserializeRowFirstTable.js +1 -1
  20. package/src/core/collection/table/serializeRowFirstTable.js +1 -1
  21. package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.js +2 -1
  22. package/src/core/geom/3d/matrix/m4_multiply.js +67 -0
  23. package/src/core/geom/Quaternion.js +0 -85
  24. package/src/core/graph/SquareMatrix.js +3 -3
  25. package/src/core/graph/SquareMatrix.spec.js +5 -5
  26. package/src/core/graph/eigen/eigen.spec.js +2 -2
  27. package/src/core/graph/graph_k_means_cluster.js +2 -2
  28. package/src/core/graph/graph_laplacian_matrix.js +3 -3
  29. package/src/core/model/node-graph/node/NodeDescription.js +1 -1
  30. package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
  31. package/src/engine/ecs/foliage/InstancedFoliage.js +4 -4
  32. package/src/engine/ecs/fow/FogOfWar.js +4 -4
  33. package/src/engine/ecs/terrain/ecs/PromiseSamplerHeight.js +1 -1
  34. package/src/engine/ecs/transform/Transform.d.ts +2 -0
  35. package/src/engine/ecs/transform/Transform.js +51 -58
  36. package/src/engine/ecs/transform/Transform.spec.js +22 -0
  37. package/src/engine/graphics/ecs/light/binding/three/applyRotation.js +1 -1
  38. package/src/engine/graphics/ecs/mesh/applyTransformToThreeObject.js +3 -1
  39. package/src/engine/graphics/ecs/mesh-v2/allocate_transform_m4.js +3 -12
  40. package/src/engine/graphics/geometry/AttributeSpec.js +5 -5
  41. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +8 -8
  42. package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +4 -4
  43. package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +7 -7
  44. package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +6 -6
  45. package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +4 -4
  46. package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +1 -1
  47. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +2 -2
  48. package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
  49. package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +2 -2
  50. package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
  51. package/src/engine/graphics/micron/format/serialization/serialize_patch.js +1 -1
  52. package/src/engine/graphics/micron/render/instanced/AttributeDataTexture.js +1 -1
  53. package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +2 -2
  54. package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
  55. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionParameterSpecification.js +2 -2
  56. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionSignature.js +2 -2
  57. package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.js +4 -4
  58. package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +13 -13
  59. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
  60. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +3 -3
  61. package/src/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +8 -8
  62. package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +1 -1
  63. package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
  64. package/src/engine/graphics/render/forward_plus/data/TextureBackedMemoryRegion.js +5 -5
  65. package/src/engine/graphics/render/forward_plus/data/computeDataType.js +10 -10
  66. package/src/engine/graphics/render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js +11 -11
  67. package/src/engine/graphics/render/forward_plus/data/computeThreeTextureTypeFromDataType.js +11 -11
  68. package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +4 -4
  69. package/src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.js +3 -3
  70. package/src/engine/graphics/texture/atlas/TextureAtlas.js +5 -5
  71. package/src/engine/graphics/texture/normalized_internal_format.js +5 -5
  72. package/src/engine/graphics/texture/sampler/Sampler2D.js +25 -51
  73. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.js +2 -2
  74. package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +3 -3
  75. package/src/engine/graphics/texture/sampler/{TextureBinaryBufferSerializer.js → serialization/TextureBinaryBufferSerializer.js} +17 -46
  76. package/src/engine/graphics/texture/sampler/{TextureBinaryBufferSerializer.spec.js → serialization/TextureBinaryBufferSerializer.spec.js} +2 -2
  77. package/src/engine/graphics/trail/TemporalPath.js +3 -3
  78. package/src/engine/graphics/trail/x/ribbon_attributes_spec.js +18 -18
  79. package/src/engine/navigation/ecs/components/Path.js +5 -5
  80. package/src/generation/example/grid/configureMirGrid.js +6 -6
  81. package/src/generation/filtering/numeric/process/computeCellFilterGradient.spec.js +10 -10
  82. package/src/generation/grid/layers/GridDataLayer.js +4 -4
  83. package/src/generation/placement/action/GridCellActionPlaceTags.spec.js +2 -2
  84. package/src/generation/rules/CellMatcherContainsTag.spec.js +2 -2
  85. package/src/generation/rules/cell/GridPatternMatcher.spec.js +8 -8
  86. package/src/view/elements/image/HTMLElementCacheKey.js +111 -2
  87. package/src/view/elements/image/ImageView.js +1 -1
  88. package/src/view/elements/video/VideoView.js +1 -1
  89. package/src/core/collection/table/DataType2TypedArrayConstructorMapping.js +0 -34
  90. package/src/core/collection/table/DataTypeByteSizes.js +0 -37
  91. package/src/core/collection/table/DataTypeIndices.js +0 -17
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  EmissionFromType
13
13
  } from "../../../../../src/engine/graphics/particles/particular/engine/emitter/EmissionFromType.js";
14
- import { DataType } from "../../../../../src/core/collection/table/DataType.js";
14
+ import { BinaryDataType } from "../../../../../src/core/binary/type/BinaryDataType.js";
15
15
  import { ParameterTrackSetEditor } from "./ParameterTrackSetEditor.js";
16
16
 
17
17
  export class ParticleEmitterLayerEditor extends ObjectEditor {
@@ -30,11 +30,11 @@ export class ParticleEmitterLayerEditor extends ObjectEditor {
30
30
  },
31
31
  emissionRate: {
32
32
  type: Number,
33
- numeric_type: DataType.Uint32
33
+ numeric_type: BinaryDataType.Uint32
34
34
  },
35
35
  emissionImmediate: {
36
36
  type: Number,
37
- numeric_type: DataType.Uint32
37
+ numeric_type: BinaryDataType.Uint32
38
38
  },
39
39
  parameterTracks: {
40
40
  editor: new ParameterTrackSetEditor()
@@ -356,7 +356,7 @@ export class NodeGraphView extends View {
356
356
  * @param {CanvasRenderingContext2D} ctx
357
357
  * @param {Vector2} source
358
358
  * @param {Vector2} target
359
- * @param {DataType} dataType
359
+ * @param {BinaryDataType} dataType
360
360
  */
361
361
  drawConnection(ctx, source, target, dataType) {
362
362
  //check that the connection is visible
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.47.42",
8
+ "version": "2.48.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -14,10 +14,10 @@ import { computeStringHash } from "../../src/core/primitives/strings/computeStri
14
14
  import { noop, strictEquals } from "../../src/core/function/Functions.js";
15
15
  import { scaleSampler2D } from "../../src/engine/graphics/texture/sampler/scaleSampler2D.js";
16
16
  import { Sampler2D } from "../../src/engine/graphics/texture/sampler/Sampler2D.js";
17
- import { DataType } from "../../src/core/collection/table/DataType.js";
17
+ import { BinaryDataType } from "../../src/core/binary/type/BinaryDataType.js";
18
18
  import {
19
19
  compute_typed_array_constructor_from_data_type
20
- } from "../../src/core/collection/table/DataType2TypedArrayConstructorMapping.js";
20
+ } from "../../src/core/binary/type/DataType2TypedArrayConstructorMapping.js";
21
21
  import { copy_Sampler2D_channel_data } from "../../src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js";
22
22
  import { TextureAssetLoader } from "../../src/engine/asset/loaders/texture/TextureAssetLoader.js";
23
23
  import { CanvasView } from "../../src/view/elements/CanvasView.js";
@@ -70,10 +70,10 @@ class EditorTextureSlot {
70
70
  * @param {(Sampler2D)=>any} read
71
71
  * @param {(Sampler2D)=>any} write
72
72
  * @param {number} [itemSize]
73
- * @param {DataType} [dataType]
73
+ * @param {BinaryDataType} [dataType]
74
74
  * @return {EditorTextureSlot}
75
75
  */
76
- static from({ read, write, itemSize = 1, dataType = DataType.Uint8 }) {
76
+ static from({ read, write, itemSize = 1, dataType = BinaryDataType.Uint8 }) {
77
77
  const r = new EditorTextureSlot();
78
78
 
79
79
  r.__read = read;
@@ -2,7 +2,7 @@
2
2
  * @readonly
3
3
  * @enum {string}
4
4
  */
5
- export const DataType = {
5
+ export const BinaryDataType = {
6
6
  Uint8: "uint8",
7
7
  Uint16: "uint16",
8
8
  Uint32: "uint32",
@@ -0,0 +1,34 @@
1
+ import { BinaryDataType } from "./BinaryDataType.js";
2
+
3
+
4
+ /**
5
+ * Mapping from {@DataType} to TypedArray constructors
6
+ * @enum {function}
7
+ */
8
+ export const DataType2TypedArrayConstructorMapping = {
9
+ [BinaryDataType.Uint8]: Uint8Array,
10
+ [BinaryDataType.Uint16]: Uint16Array,
11
+ [BinaryDataType.Uint32]: Uint32Array,
12
+ [BinaryDataType.Int8]: Int8Array,
13
+ [BinaryDataType.Int16]: Int16Array,
14
+ [BinaryDataType.Int32]: Int32Array,
15
+ // No float16 array type, using uint16 as a backing instead
16
+ [BinaryDataType.Float16]: Uint16Array,
17
+ [BinaryDataType.Float32]: Float32Array,
18
+ [BinaryDataType.Float64]: Float64Array,
19
+ };
20
+
21
+ /**
22
+ *
23
+ * @param {BinaryDataType} dt
24
+ * @returns {constructor|function}
25
+ */
26
+ export function compute_typed_array_constructor_from_data_type(dt) {
27
+ const r = DataType2TypedArrayConstructorMapping[dt];
28
+
29
+ if (r === undefined) {
30
+ throw new Error(`Unsupported data type '${dt}'`);
31
+ }
32
+
33
+ return r;
34
+ }
@@ -0,0 +1,37 @@
1
+ import { BinaryDataType } from "./BinaryDataType.js";
2
+
3
+ /**
4
+ * @readonly
5
+ * @enum {number}
6
+ */
7
+ export const DataTypeByteSizes = {
8
+ [BinaryDataType.Uint8]: 1,
9
+ [BinaryDataType.Uint16]: 2,
10
+ [BinaryDataType.Uint32]: 4,
11
+ [BinaryDataType.Uint64]: 8,
12
+
13
+ [BinaryDataType.Int8]: 1,
14
+ [BinaryDataType.Int16]: 2,
15
+ [BinaryDataType.Int32]: 4,
16
+ [BinaryDataType.Int64]: 8,
17
+
18
+ [BinaryDataType.Float16]: 2,
19
+ [BinaryDataType.Float32]: 4,
20
+ [BinaryDataType.Float64]: 8
21
+ };
22
+
23
+
24
+ /**
25
+ *
26
+ * @param {BinaryDataType} type
27
+ * @return {number}
28
+ */
29
+ export function dataTypeByteSize(type) {
30
+ const size = DataTypeByteSizes[type];
31
+
32
+ if (size === undefined) {
33
+ throw new Error(`Unsupported type '${type}'`);
34
+ }
35
+
36
+ return size;
37
+ }
@@ -0,0 +1,17 @@
1
+ import { BinaryDataType } from "./BinaryDataType.js";
2
+
3
+ /***
4
+ *
5
+ * @enum {number}
6
+ */
7
+ export const DataTypeIndices = {
8
+ [BinaryDataType.Uint8]: 0,
9
+ [BinaryDataType.Uint16]: 1,
10
+ [BinaryDataType.Uint32]: 2,
11
+ [BinaryDataType.Int8]: 3,
12
+ [BinaryDataType.Int16]: 4,
13
+ [BinaryDataType.Int32]: 5,
14
+ [BinaryDataType.Float32]: 6,
15
+ [BinaryDataType.Float64]: 7,
16
+ [BinaryDataType.Float16]: 8
17
+ };
@@ -3,7 +3,7 @@ import { DataTypeIndices } from "./DataTypeIndices.js";
3
3
  /**
4
4
  *
5
5
  * @param {number} index
6
- * @returns {DataType|undefined}
6
+ * @returns {BinaryDataType|undefined}
7
7
  */
8
8
  export function computeDataTypeByIndex(index) {
9
9
  for (let type in DataTypeIndices) {
@@ -0,0 +1,31 @@
1
+ import { BinaryDataType } from "./BinaryDataType.js";
2
+
3
+ /**
4
+ *
5
+ * @param {TypedArray} arr
6
+ * @returns {BinaryDataType}
7
+ */
8
+ export function dataTypeFromTypedArray(arr) {
9
+ if (arr instanceof Float32Array) {
10
+ return BinaryDataType.Float32;
11
+ } else if (arr instanceof Float64Array) {
12
+ return BinaryDataType.Float64;
13
+ } else if (arr instanceof Uint8Array) {
14
+ return BinaryDataType.Uint8;
15
+ } else if (arr instanceof Uint16Array) {
16
+ return BinaryDataType.Uint16;
17
+ } else if (arr instanceof Uint32Array) {
18
+ return BinaryDataType.Uint32;
19
+ } else if (arr instanceof Int8Array) {
20
+ return BinaryDataType.Int8;
21
+ } else if (arr instanceof Int16Array) {
22
+ return BinaryDataType.Int16;
23
+ } else if (arr instanceof Int32Array) {
24
+ return BinaryDataType.Int32;
25
+ } else if (arr instanceof Array) {
26
+ //if array is untyped, use Float64 as numbers in JS are 64 bit
27
+ return BinaryDataType.Float64;
28
+ } else {
29
+ throw new TypeError(`Unknown array type`);
30
+ }
31
+ }
@@ -1,9 +1,9 @@
1
- import { DataType } from "../table/DataType.js";
1
+ import { BinaryDataType } from "../../binary/type/BinaryDataType.js";
2
2
 
3
3
  /**
4
4
  *
5
5
  * @param {*} v
6
- * @returns {DataType}
6
+ * @returns {BinaryDataType}
7
7
  */
8
8
  export function typedArrayToDataType(v) {
9
9
  const ctor = Object.getPrototypeOf(v).constructor;
@@ -11,23 +11,23 @@ export function typedArrayToDataType(v) {
11
11
  switch (ctor) {
12
12
  case Uint8Array:
13
13
  case Uint8ClampedArray:
14
- return DataType.Uint8;
14
+ return BinaryDataType.Uint8;
15
15
  case Uint16Array:
16
- return DataType.Uint16;
16
+ return BinaryDataType.Uint16;
17
17
  case Uint32Array:
18
- return DataType.Uint32;
18
+ return BinaryDataType.Uint32;
19
19
 
20
20
  case Int8Array:
21
- return DataType.Int8;
21
+ return BinaryDataType.Int8;
22
22
  case Int16Array:
23
- return DataType.Int16;
23
+ return BinaryDataType.Int16;
24
24
  case Int32Array:
25
- return DataType.Int32;
25
+ return BinaryDataType.Int32;
26
26
 
27
27
  case Float32Array:
28
- return DataType.Float32;
28
+ return BinaryDataType.Float32;
29
29
  case Float64Array:
30
- return DataType.Float64;
30
+ return BinaryDataType.Float64;
31
31
  default:
32
32
  throw new Error('unsupported constructor type');
33
33
  }
@@ -26,7 +26,7 @@ function RowFirstTable(spec) {
26
26
 
27
27
  /**
28
28
  * @readonly
29
- * @type {Array.<DataType>}
29
+ * @type {Array.<BinaryDataType>}
30
30
  */
31
31
  this.types = spec.types;
32
32
 
@@ -1,5 +1,5 @@
1
1
  import { BinaryBuffer } from "../../binary/BinaryBuffer.js";
2
- import { DataType } from "./DataType.js";
2
+ import { BinaryDataType } from "../../binary/type/BinaryDataType.js";
3
3
  import { RowFirstTable } from "./RowFirstTable.js";
4
4
  import { RowFirstTableSpec } from "./RowFirstTableSpec.js";
5
5
  import { serializeRowFirstTable } from "./serializeRowFirstTable.js";
@@ -10,7 +10,7 @@ test("constructor doesn't throw", () => {
10
10
  });
11
11
 
12
12
  test("add row then read back", () => {
13
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
13
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
14
14
 
15
15
  sut.addRow([1.4, 8]);
16
16
 
@@ -21,7 +21,7 @@ test("add row then read back", () => {
21
21
  });
22
22
 
23
23
  test("add two rows, then read back", () => {
24
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
24
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
25
25
 
26
26
  sut.addRow([1.4, 8]);
27
27
  sut.addRow([1.5, 9]);
@@ -41,7 +41,7 @@ test("add two rows, then read back", () => {
41
41
 
42
42
  test("serialization deserialization consistency", () => {
43
43
 
44
- const expected = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
44
+ const expected = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
45
45
 
46
46
  expected.addRow([1.4, 8]);
47
47
  expected.addRow([1.5, 9]);
@@ -66,7 +66,7 @@ test("serialization deserialization consistency", () => {
66
66
 
67
67
  test("removeRows 1 in the middle", () => {
68
68
 
69
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
69
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
70
70
 
71
71
  sut.addRow([1.4, 8]);
72
72
  sut.addRow([1.5, 9]);
@@ -89,7 +89,7 @@ test("removeRows 1 in the middle", () => {
89
89
 
90
90
  test("removeRows 2 in the middle", () => {
91
91
 
92
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
92
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
93
93
 
94
94
  sut.addRow([1.4, 8]);
95
95
  sut.addRow([1.5, 9]);
@@ -113,7 +113,7 @@ test("removeRows 2 in the middle", () => {
113
113
 
114
114
  test("removeRows 1 at the start", () => {
115
115
 
116
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
116
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
117
117
 
118
118
  sut.addRow([1.4, 8]);
119
119
  sut.addRow([1.5, 9]);
@@ -131,7 +131,7 @@ test("removeRows 1 at the start", () => {
131
131
  });
132
132
 
133
133
  test("removeRows 1 at the end", () => {
134
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
134
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
135
135
 
136
136
  sut.addRow([1.4, 8]);
137
137
  sut.addRow([1.5, 9]);
@@ -150,7 +150,7 @@ test("removeRows 1 at the end", () => {
150
150
 
151
151
  test("writeCellValue", () => {
152
152
 
153
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
153
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
154
154
 
155
155
  sut.addRow([1.4, 8]);
156
156
  sut.addRow([1.5, 9]);
@@ -175,7 +175,7 @@ test("writeCellValue", () => {
175
175
  });
176
176
 
177
177
  test("readCellValue", () => {
178
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64, DataType.Uint8]));
178
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]));
179
179
 
180
180
  sut.addRow([1.4, 8]);
181
181
  sut.addRow([1.5, 9]);
@@ -189,7 +189,7 @@ test("readCellValue", () => {
189
189
 
190
190
 
191
191
  test('insertRows', () => {
192
- const sut = new RowFirstTable(new RowFirstTableSpec([DataType.Float64]));
192
+ const sut = new RowFirstTable(new RowFirstTableSpec([BinaryDataType.Float64]));
193
193
 
194
194
  // insert into empty table
195
195
  sut.insertRows(0, 1);
@@ -216,7 +216,7 @@ test('insertRows', () => {
216
216
 
217
217
  test('copy', () => {
218
218
 
219
- const spec = new RowFirstTableSpec([DataType.Float64, DataType.Uint8]);
219
+ const spec = new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]);
220
220
 
221
221
  const a = new RowFirstTable(spec);
222
222
  a.addRow([3.1, 7]);
@@ -231,7 +231,7 @@ test('copy', () => {
231
231
 
232
232
  test('reverse_rows 3 rows (odd number)', () => {
233
233
 
234
- const spec = new RowFirstTableSpec([DataType.Uint8]);
234
+ const spec = new RowFirstTableSpec([BinaryDataType.Uint8]);
235
235
 
236
236
  const a = new RowFirstTable(spec);
237
237
  a.addRow([1]);
@@ -247,7 +247,7 @@ test('reverse_rows 3 rows (odd number)', () => {
247
247
 
248
248
  test('reverse_rows 2 rows', () => {
249
249
 
250
- const spec = new RowFirstTableSpec([DataType.Float64, DataType.Uint8]);
250
+ const spec = new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]);
251
251
 
252
252
  const a = new RowFirstTable(spec);
253
253
  a.addRow([3.1, 7]);
@@ -264,7 +264,7 @@ test('reverse_rows 2 rows', () => {
264
264
 
265
265
  test('reverse_rows 1 row', () => {
266
266
 
267
- const spec = new RowFirstTableSpec([DataType.Float64, DataType.Uint8]);
267
+ const spec = new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]);
268
268
 
269
269
  const a = new RowFirstTable(spec);
270
270
 
@@ -277,7 +277,7 @@ test('reverse_rows 1 row', () => {
277
277
 
278
278
  test('reverse_rows empty', () => {
279
279
 
280
- const spec = new RowFirstTableSpec([DataType.Float64, DataType.Uint8]);
280
+ const spec = new RowFirstTableSpec([BinaryDataType.Float64, BinaryDataType.Uint8]);
281
281
 
282
282
  const a = new RowFirstTable(spec);
283
283
 
@@ -7,8 +7,8 @@ import { Cache } from "../../cache/Cache.js";
7
7
  import { FunctionCompiler } from "../../function/FunctionCompiler.js";
8
8
  import { computeStringHash } from "../../primitives/strings/computeStringHash.js";
9
9
  import { isArrayEqualStrict } from "../array/isArrayEqualStrict.js";
10
- import { DataType } from "./DataType.js";
11
- import { DataTypeByteSizes } from "./DataTypeByteSizes.js";
10
+ import { BinaryDataType } from "../../binary/type/BinaryDataType.js";
11
+ import { DataTypeByteSizes } from "../../binary/type/DataTypeByteSizes.js";
12
12
 
13
13
  /**
14
14
  * @readonly
@@ -50,7 +50,7 @@ export const DataType2DataViewWriters = {
50
50
 
51
51
  /**
52
52
  *
53
- * @param {DataType[]} types
53
+ * @param {BinaryDataType[]} types
54
54
  * @param {EndianType} [endianType]
55
55
  * @returns {(data_view:DataView, byte_offset:number, result:number[])=>void}
56
56
  */
@@ -84,7 +84,7 @@ function genRowReader(types, endianType = EndianType.BigEndian) {
84
84
 
85
85
  /**
86
86
  *
87
- * @param {DataType[]} types
87
+ * @param {BinaryDataType[]} types
88
88
  * @param {EndianType} [endianType]
89
89
  * @returns {(data_view:DataView, byte_offset:number, record:number[])=>void}
90
90
  */
@@ -117,7 +117,7 @@ function genRowWriter(types, endianType = EndianType.BigEndian) {
117
117
 
118
118
  /**
119
119
  *
120
- * @param {DataType} type
120
+ * @param {BinaryDataType} type
121
121
  * @param {number} offset
122
122
  * @param {EndianType} [endianType]
123
123
  * @returns {Function}
@@ -135,7 +135,7 @@ function genCellWriter(type, offset, endianType = EndianType.BigEndian) {
135
135
 
136
136
  /**
137
137
  *
138
- * @param {DataType} type
138
+ * @param {BinaryDataType} type
139
139
  * @param {number} offset
140
140
  * @param {EndianType} [endianType]
141
141
  * @returns {Function}
@@ -153,7 +153,7 @@ function genCellReader(type, offset, endianType = EndianType.BigEndian) {
153
153
 
154
154
  /**
155
155
  *
156
- * @param {DataType[]} types
156
+ * @param {BinaryDataType[]} types
157
157
  * @param {EndianType} [endianType]
158
158
  * @constructor
159
159
  */
@@ -162,7 +162,7 @@ export function RowFirstTableSpec(types, endianType = EndianType.BigEndian) {
162
162
 
163
163
  /**
164
164
  * @readonly
165
- * @type {DataType[]}
165
+ * @type {BinaryDataType[]}
166
166
  */
167
167
  this.types = types;
168
168
 
@@ -250,7 +250,7 @@ const cache = new Cache({
250
250
 
251
251
  /**
252
252
  *
253
- * @param {DataType[]} types
253
+ * @param {BinaryDataType[]} types
254
254
  * @param {EndianType} [endianType]
255
255
  * @returns {RowFirstTableSpec}
256
256
  */
@@ -1,5 +1,5 @@
1
1
  import { RowFirstTableSpec } from "./RowFirstTableSpec.js";
2
- import { computeDataTypeByIndex } from "./computeDataTypeByIndex.js";
2
+ import { computeDataTypeByIndex } from "../../binary/type/computeDataTypeByIndex.js";
3
3
 
4
4
  /**
5
5
  *
@@ -1,4 +1,4 @@
1
- import { DataTypeIndices } from "./DataTypeIndices.js";
1
+ import { DataTypeIndices } from "../../binary/type/DataTypeIndices.js";
2
2
 
3
3
  /**
4
4
  *
@@ -2,7 +2,8 @@
2
2
  *
3
3
  * @type {number[]|mat4}
4
4
  */
5
- export const MATRIX_4_IDENTITY = Object.freeze([1, 0, 0, 0,
5
+ export const MATRIX_4_IDENTITY = Object.freeze([
6
+ 1, 0, 0, 0,
6
7
  0, 1, 0, 0,
7
8
  0, 0, 1, 0,
8
9
  0, 0, 0, 1
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Multiplies two mat4s
3
+ * Adapter from gl-matrix
4
+ *
5
+ * @param {ArrayLike<number>|Float32Array} out the receiving matrix
6
+ * @param {ArrayLike<number>|Float32Array} a the first operand
7
+ * @param {ArrayLike<number>|Float32Array} b the second operand
8
+ */
9
+ export function m4_multiply(out, a, b) {
10
+ const a00 = a[0],
11
+ a01 = a[1],
12
+ a02 = a[2],
13
+ a03 = a[3],
14
+ a10 = a[4],
15
+ a11 = a[5],
16
+ a12 = a[6],
17
+ a13 = a[7],
18
+ a20 = a[8],
19
+ a21 = a[9],
20
+ a22 = a[10],
21
+ a23 = a[11],
22
+ a30 = a[12],
23
+ a31 = a[13],
24
+ a32 = a[14],
25
+ a33 = a[15];
26
+
27
+ // Cache only the current line of the second matrix
28
+ let b0 = b[0],
29
+ b1 = b[1],
30
+ b2 = b[2],
31
+ b3 = b[3];
32
+
33
+ out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
34
+ out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
35
+ out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
36
+ out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
37
+
38
+ b0 = b[4];
39
+ b1 = b[5];
40
+ b2 = b[6];
41
+ b3 = b[7];
42
+
43
+ out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
44
+ out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
45
+ out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
46
+ out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
47
+
48
+ b0 = b[8];
49
+ b1 = b[9];
50
+ b2 = b[10];
51
+ b3 = b[11];
52
+
53
+ out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
54
+ out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
55
+ out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
56
+ out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
57
+
58
+ b0 = b[12];
59
+ b1 = b[13];
60
+ b2 = b[14];
61
+ b3 = b[15];
62
+
63
+ out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
64
+ out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
65
+ out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
66
+ out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
67
+ }