@woosh/meep-engine 2.47.42 → 2.48.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.
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +44161 -44112
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +44162 -44112
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +3 -3
- package/editor/view/node-graph/NodeGraphView.js +1 -1
- package/package.json +1 -1
- package/samples/terrain/editor.js +4 -4
- package/src/core/{collection/table/DataType.js → binary/type/BinaryDataType.js} +1 -1
- package/src/core/binary/type/DataType2TypedArrayConstructorMapping.js +34 -0
- package/src/core/binary/type/DataTypeByteSizes.js +37 -0
- package/src/core/binary/type/DataTypeIndices.js +17 -0
- package/src/core/{collection/table → binary/type}/computeDataTypeByIndex.js +1 -1
- package/src/core/binary/type/dataTypeFromTypedArray.js +31 -0
- package/src/core/collection/array/typedArrayToDataType.js +10 -10
- package/src/core/collection/table/RowFirstTable.js +1 -1
- package/src/core/collection/table/RowFirstTable.spec.js +16 -16
- package/src/core/collection/table/RowFirstTableSpec.js +9 -9
- package/src/core/collection/table/deserializeRowFirstTable.js +1 -1
- package/src/core/collection/table/serializeRowFirstTable.js +1 -1
- package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.js +2 -1
- package/src/core/geom/3d/matrix/m4_multiply.js +67 -0
- package/src/core/geom/Quaternion.js +0 -85
- package/src/core/graph/SquareMatrix.js +3 -3
- package/src/core/graph/SquareMatrix.spec.js +5 -5
- package/src/core/graph/eigen/eigen.spec.js +2 -2
- package/src/core/graph/graph_k_means_cluster.js +2 -2
- package/src/core/graph/graph_laplacian_matrix.js +3 -3
- package/src/core/model/node-graph/node/NodeDescription.js +1 -1
- package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
- package/src/engine/ecs/foliage/InstancedFoliage.js +4 -4
- package/src/engine/ecs/fow/FogOfWar.js +4 -4
- package/src/engine/ecs/terrain/ecs/PromiseSamplerHeight.js +1 -1
- package/src/engine/ecs/transform/Transform.d.ts +2 -0
- package/src/engine/ecs/transform/Transform.js +51 -58
- package/src/engine/ecs/transform/Transform.spec.js +22 -0
- package/src/engine/graphics/ecs/light/binding/three/applyRotation.js +1 -1
- package/src/engine/graphics/ecs/mesh/applyTransformToThreeObject.js +3 -1
- package/src/engine/graphics/ecs/mesh-v2/allocate_transform_m4.js +3 -12
- package/src/engine/graphics/geometry/AttributeSpec.js +5 -5
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +8 -8
- package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +4 -4
- package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +7 -7
- package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +6 -6
- package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +4 -4
- package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +1 -1
- package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +2 -2
- package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +2 -2
- package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/src/engine/graphics/micron/format/serialization/serialize_patch.js +1 -1
- package/src/engine/graphics/micron/render/instanced/AttributeDataTexture.js +1 -1
- package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +2 -2
- package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionParameterSpecification.js +2 -2
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionSignature.js +2 -2
- package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.js +4 -4
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +13 -13
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +3 -3
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +8 -8
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +1 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
- package/src/engine/graphics/render/forward_plus/data/TextureBackedMemoryRegion.js +5 -5
- package/src/engine/graphics/render/forward_plus/data/computeDataType.js +10 -10
- package/src/engine/graphics/render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js +11 -11
- package/src/engine/graphics/render/forward_plus/data/computeThreeTextureTypeFromDataType.js +11 -11
- package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +4 -4
- package/src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.js +3 -3
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +5 -5
- package/src/engine/graphics/texture/normalized_internal_format.js +5 -5
- package/src/engine/graphics/texture/sampler/Sampler2D.js +25 -51
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.js +2 -2
- package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +3 -3
- package/src/engine/graphics/texture/sampler/{TextureBinaryBufferSerializer.js → serialization/TextureBinaryBufferSerializer.js} +17 -46
- package/src/engine/graphics/texture/sampler/{TextureBinaryBufferSerializer.spec.js → serialization/TextureBinaryBufferSerializer.spec.js} +2 -2
- package/src/engine/graphics/trail/TemporalPath.js +3 -3
- package/src/engine/graphics/trail/x/ribbon_attributes_spec.js +18 -18
- package/src/engine/intelligence/behavior/util/behavior_traverse_tree.js +2 -2
- package/src/engine/navigation/ecs/components/Path.js +5 -5
- package/src/generation/example/grid/configureMirGrid.js +6 -6
- package/src/generation/filtering/numeric/process/computeCellFilterGradient.spec.js +10 -10
- package/src/generation/grid/layers/GridDataLayer.js +4 -4
- package/src/generation/placement/action/GridCellActionPlaceTags.spec.js +2 -2
- package/src/generation/rules/CellMatcherContainsTag.spec.js +2 -2
- package/src/generation/rules/cell/GridPatternMatcher.spec.js +8 -8
- package/src/view/elements/image/HTMLElementCacheKey.js +111 -2
- package/src/view/elements/image/ImageView.js +1 -1
- package/src/view/elements/video/VideoView.js +1 -1
- package/src/core/collection/table/DataType2TypedArrayConstructorMapping.js +0 -34
- package/src/core/collection/table/DataTypeByteSizes.js +0 -37
- 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 {
|
|
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:
|
|
33
|
+
numeric_type: BinaryDataType.Uint32
|
|
34
34
|
},
|
|
35
35
|
emissionImmediate: {
|
|
36
36
|
type: Number,
|
|
37
|
-
numeric_type:
|
|
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 {
|
|
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
|
@@ -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 {
|
|
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/
|
|
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 {
|
|
73
|
+
* @param {BinaryDataType} [dataType]
|
|
74
74
|
* @return {EditorTextureSlot}
|
|
75
75
|
*/
|
|
76
|
-
static from({ read, write, itemSize = 1, dataType =
|
|
76
|
+
static from({ read, write, itemSize = 1, dataType = BinaryDataType.Uint8 }) {
|
|
77
77
|
const r = new EditorTextureSlot();
|
|
78
78
|
|
|
79
79
|
r.__read = read;
|
|
@@ -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
|
+
};
|
|
@@ -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 {
|
|
1
|
+
import { BinaryDataType } from "../../binary/type/BinaryDataType.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {*} v
|
|
6
|
-
* @returns {
|
|
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
|
|
14
|
+
return BinaryDataType.Uint8;
|
|
15
15
|
case Uint16Array:
|
|
16
|
-
return
|
|
16
|
+
return BinaryDataType.Uint16;
|
|
17
17
|
case Uint32Array:
|
|
18
|
-
return
|
|
18
|
+
return BinaryDataType.Uint32;
|
|
19
19
|
|
|
20
20
|
case Int8Array:
|
|
21
|
-
return
|
|
21
|
+
return BinaryDataType.Int8;
|
|
22
22
|
case Int16Array:
|
|
23
|
-
return
|
|
23
|
+
return BinaryDataType.Int16;
|
|
24
24
|
case Int32Array:
|
|
25
|
-
return
|
|
25
|
+
return BinaryDataType.Int32;
|
|
26
26
|
|
|
27
27
|
case Float32Array:
|
|
28
|
-
return
|
|
28
|
+
return BinaryDataType.Float32;
|
|
29
29
|
case Float64Array:
|
|
30
|
-
return
|
|
30
|
+
return BinaryDataType.Float64;
|
|
31
31
|
default:
|
|
32
32
|
throw new Error('unsupported constructor type');
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BinaryBuffer } from "../../binary/BinaryBuffer.js";
|
|
2
|
-
import {
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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([
|
|
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 {
|
|
11
|
-
import { DataTypeByteSizes } from "
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
253
|
+
* @param {BinaryDataType[]} types
|
|
254
254
|
* @param {EndianType} [endianType]
|
|
255
255
|
* @returns {RowFirstTableSpec}
|
|
256
256
|
*/
|
|
@@ -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
|
+
}
|