@woosh/meep-engine 2.48.19 → 2.48.21
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/package.json +1 -1
- package/src/core/binary/type/BinaryDataType.d.ts +15 -0
- package/src/{engine/graphics/render/forward_plus/data/computeDataType.js → core/binary/type/computeBinaryDataTypeByPrecision.js} +3 -3
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +62 -0
- package/src/core/graph/layout/computeDisconnectedSubGraphs.js +1 -0
- package/src/core/process/task/TaskGroup.js +1 -1
- package/src/core/process/task/util/task_tree_compute_leaf_tasks.js +21 -0
- package/src/engine/graphics/geometry/AttributeSpec.d.ts +2 -2
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -3
- package/src/engine/graphics/render/forward_plus/LightManager.js +9 -7
- package/src/engine/graphics/{micron/render/instanced → texture}/AttributeDataTexture.js +28 -19
- package/src/engine/graphics/{render/forward_plus/data → texture}/TextureBackedMemoryRegion.js +8 -8
- package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureFormat.js +2 -2
- package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureInternalFormatFromDataType.js +1 -1
- package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureTypeFromDataType.js +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D2Canvas.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.js +1 -3
- package/src/generation/GridTaskGroup.js +4 -4
- package/src/generation/filtering/numeric/util/populateSampler2DFromCellFilter.js +10 -2
- package/src/generation/filtering/numeric/util/sampler_from_filter.js +26 -0
- package/src/generation/filtering/numeric/util/visualise_filters_as_grid.js +81 -0
- package/src/generation/grid/generation/GridTaskSequence.js +3 -1
- package/src/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +0 -1
- package/src/engine/graphics/micron/MICRON_URI_FIELD.js +0 -1
- package/src/engine/graphics/micron/build/MICRON_PATCH_SIZE_MAX.js +0 -5
- package/src/engine/graphics/micron/build/PatchRepresentation.js +0 -424
- package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +0 -311
- package/src/engine/graphics/micron/build/build_geometry_info.js +0 -21
- package/src/engine/graphics/micron/build/clustering/assignInitialPatchNeighbours.js +0 -63
- package/src/engine/graphics/micron/build/clustering/assign_patch_neighbours_from_topology.js +0 -46
- package/src/engine/graphics/micron/build/clustering/build_clustering_2.js +0 -37
- package/src/engine/graphics/micron/build/clustering/build_leaf_patches.js +0 -326
- package/src/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +0 -76
- package/src/engine/graphics/micron/build/clustering/computeBorderLengthChange.js +0 -59
- package/src/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +0 -57
- package/src/engine/graphics/micron/build/clustering/computeOpenFaceFreedom.js +0 -35
- package/src/engine/graphics/micron/build/clustering/compute_face_connection_weight.js +0 -35
- package/src/engine/graphics/micron/build/clustering/populateOpenFaceNeighboursForPatch.js +0 -56
- package/src/engine/graphics/micron/build/clustering/validate_leaf_patch_connectivity.js +0 -44
- package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +0 -24
- package/src/engine/graphics/micron/build/compute_vertex_remap_cost.js +0 -29
- package/src/engine/graphics/micron/build/debug/build_clustering_info.js +0 -58
- package/src/engine/graphics/micron/build/debug/build_graph_info.js +0 -59
- package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +0 -270
- package/src/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +0 -196
- package/src/engine/graphics/micron/build/hierarchy/build_intermediate_patch_topology.js +0 -162
- package/src/engine/graphics/micron/build/hierarchy/build_merge_graph.js +0 -89
- package/src/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +0 -146
- package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertex_count.js +0 -32
- package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertices.js +0 -34
- package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +0 -581
- package/src/engine/graphics/micron/build/hierarchy/metis_cluster_clusters.js +0 -53
- package/src/engine/graphics/micron/build/hierarchy/optimize_graph_partitioning_balance.js +0 -515
- package/src/engine/graphics/micron/build/hierarchy/patch_combine.js +0 -180
- package/src/engine/graphics/micron/build/hierarchy/patch_fill_holes_by_uncollapse.js +0 -60
- package/src/engine/graphics/micron/build/hierarchy/patch_stitch_parent_border.js +0 -320
- package/src/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +0 -547
- package/src/engine/graphics/micron/build/hierarchy/qvdr_build_tree.js +0 -140
- package/src/engine/graphics/micron/buildPatchwork.js +0 -68
- package/src/engine/graphics/micron/convert_three_object_to_micron.js +0 -179
- package/src/engine/graphics/micron/debug/VirtualGeometryStats.js +0 -42
- package/src/engine/graphics/micron/format/MICRON_GEOMETRY_PROPERTY_NAME.js +0 -1
- package/src/engine/graphics/micron/format/MicronGeometry.d.ts +0 -21
- package/src/engine/graphics/micron/format/MicronGeometry.js +0 -334
- package/src/engine/graphics/micron/format/MicronGeometryPatch.d.ts +0 -3
- package/src/engine/graphics/micron/format/MicronGeometryPatch.js +0 -205
- package/src/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +0 -50
- package/src/engine/graphics/micron/format/ThreeMicronMesh.d.ts +0 -10
- package/src/engine/graphics/micron/format/ThreeMicronMesh.js +0 -45
- package/src/engine/graphics/micron/format/VirtualGeometry.js +0 -158
- package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +0 -205
- package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +0 -123
- package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +0 -63
- package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +0 -83
- package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +0 -51
- package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +0 -25
- package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +0 -106
- package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +0 -18
- package/src/engine/graphics/micron/format/serialization/serialize_patch.js +0 -84
- package/src/engine/graphics/micron/format/validate_patch_bounds.js +0 -69
- package/src/engine/graphics/micron/plugin/GLTFAssetTransformer.js +0 -265
- package/src/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +0 -5
- package/src/engine/graphics/micron/plugin/MicronRenderPlugin.d.ts +0 -8
- package/src/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -150
- package/src/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +0 -176
- package/src/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +0 -216
- package/src/engine/graphics/micron/prototypeMicronProxyBuild.js +0 -227
- package/src/engine/graphics/micron/prototypeVirtualGeometry.js +0 -911
- package/src/engine/graphics/micron/render/PatchCacheKey.js +0 -79
- package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.d.ts +0 -1
- package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.js +0 -1
- package/src/engine/graphics/micron/render/VirtualGeometryBuilder.js +0 -207
- package/src/engine/graphics/micron/render/approximateTriangleArea.js +0 -25
- package/src/engine/graphics/micron/render/culling/PatchCullingSystem.js +0 -129
- package/src/engine/graphics/micron/render/instanced/PatchDataTextures.js +0 -325
- package/src/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -175
- package/src/engine/graphics/micron/render/instanced/shader/constants.js +0 -3
- package/src/engine/graphics/micron/render/instanced/shader/gen_micron_vertex_attribute_texture_name.js +0 -8
- package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +0 -250
- package/src/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +0 -37
- package/src/engine/graphics/micron/render/refinement/ActivePatchFlags.js +0 -8
- package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +0 -241
- package/src/engine/graphics/micron/render/refinement/ActivePatchRecord.js +0 -154
- package/src/engine/graphics/micron/render/refinement/RefinementSpec.js +0 -84
- package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +0 -133
- package/src/engine/graphics/micron/render/refinement/is_patch_facing_back.js +0 -43
- package/src/engine/graphics/micron/render/refinement/is_patch_visible.js +0 -37
- package/src/engine/graphics/micron/render/v1/MaterialContext.js +0 -150
- package/src/engine/graphics/micron/render/v1/MaterialVertexSpec.js +0 -115
- package/src/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -145
- package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +0 -255
- package/src/engine/graphics/micron/render/v1/VGThreeRenderer.js +0 -142
- package/src/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +0 -54
- package/src/engine/graphics/micron/simplifyGeometry.js +0 -26
- package/src/engine/graphics/micron/util/patchToBufferGeometry.js +0 -19
- /package/src/{engine/graphics/render/forward_plus/data → core/math}/NumericType.js +0 -0
- /package/src/engine/graphics/{render/forward_plus/data → texture}/channelCountToThreIntegerTextureType.js +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export enum BinaryDataType {
|
|
2
|
+
Uint8= "uint8",
|
|
3
|
+
Uint16= "uint16",
|
|
4
|
+
Uint32= "uint32",
|
|
5
|
+
Uint64= "uint64",
|
|
6
|
+
|
|
7
|
+
Int8= "int8",
|
|
8
|
+
Int16= "int16",
|
|
9
|
+
Int32= "int32",
|
|
10
|
+
Int64= "int64",
|
|
11
|
+
|
|
12
|
+
Float16= 'float16',
|
|
13
|
+
Float32= "float32",
|
|
14
|
+
Float64= "float64"
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NumericType } from "
|
|
2
|
-
import { BinaryDataType } from "
|
|
1
|
+
import { NumericType } from "../../math/NumericType.js";
|
|
2
|
+
import { BinaryDataType } from "./BinaryDataType.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@ import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.j
|
|
|
7
7
|
* @param {number} precision
|
|
8
8
|
* @returns {BinaryDataType}
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function computeBinaryDataTypeByPrecision(type, precision) {
|
|
11
11
|
if (type === NumericType.Uint) {
|
|
12
12
|
if (precision <= 8) {
|
|
13
13
|
return BinaryDataType.Uint8;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { aabb2_sqrDistanceToPoint } from "../AABB2Math.js";
|
|
2
|
+
import { max2 } from "../../../math/max2.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @type {QuadTreeNode[]}
|
|
7
|
+
*/
|
|
8
|
+
const node_stack = [];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @template N
|
|
12
|
+
* @param {QuadTreeNode<N>} tree
|
|
13
|
+
* @param {number} x
|
|
14
|
+
* @param {number} y
|
|
15
|
+
* @param {number} [max_distance]
|
|
16
|
+
* @returns {QuadTreeDatum<N>}
|
|
17
|
+
*/
|
|
18
|
+
export function qt_query_data_nearest_to_point(tree, x, y, max_distance = Infinity) {
|
|
19
|
+
|
|
20
|
+
let stack_pointer = 0;
|
|
21
|
+
|
|
22
|
+
node_stack[stack_pointer] = tree;
|
|
23
|
+
stack_pointer++;
|
|
24
|
+
|
|
25
|
+
let best_leaf_data = undefined;
|
|
26
|
+
let best_distance_sqr = max_distance * max_distance;
|
|
27
|
+
|
|
28
|
+
while (stack_pointer > 0) {
|
|
29
|
+
|
|
30
|
+
--stack_pointer;
|
|
31
|
+
const node = node_stack[stack_pointer];
|
|
32
|
+
|
|
33
|
+
const distance_sqr = max2(0, aabb2_sqrDistanceToPoint(node.x0, node.y0, node.x1, node.y1, x, y));
|
|
34
|
+
|
|
35
|
+
if (distance_sqr >= best_distance_sqr) {
|
|
36
|
+
// too far
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const data = node.data;
|
|
41
|
+
|
|
42
|
+
for (let i = 0; i < data.length; i++) {
|
|
43
|
+
const datum = data[i];
|
|
44
|
+
|
|
45
|
+
const distance_sqr = max2(0, aabb2_sqrDistanceToPoint(datum.x0, datum.y0, datum.x1, datum.y1, x, y));
|
|
46
|
+
|
|
47
|
+
if (distance_sqr < best_distance_sqr) {
|
|
48
|
+
best_leaf_data = datum;
|
|
49
|
+
best_distance_sqr = distance_sqr;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (node.isSplit()) {
|
|
54
|
+
node_stack[stack_pointer++] = node.topLeft;
|
|
55
|
+
node_stack[stack_pointer++] = node.topRight;
|
|
56
|
+
node_stack[stack_pointer++] = node.bottomLeft;
|
|
57
|
+
node_stack[stack_pointer++] = node.bottomRight;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return best_leaf_data;
|
|
62
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {TaskGroup|Task} root
|
|
4
|
+
* @return {number}
|
|
5
|
+
*/
|
|
6
|
+
export function task_tree_compute_leaf_tasks(root) {
|
|
7
|
+
let result = 0;
|
|
8
|
+
|
|
9
|
+
if (root.isTaskGroup) {
|
|
10
|
+
|
|
11
|
+
const children = root.children;
|
|
12
|
+
const n = children.length;
|
|
13
|
+
for (let i = 0; i < n; i++) {
|
|
14
|
+
result += task_tree_compute_leaf_tasks(children[i]);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
result += 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {BinaryDataType} from "../../../core/binary/type/BinaryDataType";
|
|
2
2
|
|
|
3
3
|
export class AttributeSpec {
|
|
4
4
|
readonly name: string
|
|
5
|
-
readonly type:
|
|
5
|
+
readonly type: BinaryDataType
|
|
6
6
|
readonly itemSize: number
|
|
7
7
|
readonly normalized: boolean
|
|
8
8
|
}
|
|
@@ -21,9 +21,7 @@ import { convertTexture2Sampler2D } from "../../texture/sampler/convertTexture2S
|
|
|
21
21
|
import { BUFFER_GEOMETRY_UVS } from "./BUFFER_GEOMETRY_UVS.js";
|
|
22
22
|
import { is_compliant_mesh } from "./is_compliant_mesh.js";
|
|
23
23
|
import { MaterialDescriptor } from "./MaterialDescriptor.js";
|
|
24
|
-
import {
|
|
25
|
-
computeThreeTextureTypeFromDataType
|
|
26
|
-
} from "../../render/forward_plus/data/computeThreeTextureTypeFromDataType.js";
|
|
24
|
+
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
27
25
|
import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
|
|
28
26
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
29
27
|
import {
|
|
@@ -18,15 +18,17 @@ import { computeFrustumCorners } from "./computeFrustumCorners.js";
|
|
|
18
18
|
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
19
19
|
import { read_frustum_planes_to_array } from "../../../../core/geom/3d/frustum/read_frustum_planes_to_array.js";
|
|
20
20
|
import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
|
|
21
|
-
import { TextureBackedMemoryRegion } from "
|
|
21
|
+
import { TextureBackedMemoryRegion } from "../../texture/TextureBackedMemoryRegion.js";
|
|
22
22
|
import { assert } from "../../../../core/assert.js";
|
|
23
23
|
import {
|
|
24
24
|
DataType2TypedArrayConstructorMapping
|
|
25
25
|
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
26
|
-
import { NumericType } from "
|
|
27
|
-
import {
|
|
28
|
-
import { computeThreeTextureTypeFromDataType } from "
|
|
29
|
-
import {
|
|
26
|
+
import { NumericType } from "../../../../core/math/NumericType.js";
|
|
27
|
+
import { computeBinaryDataTypeByPrecision } from "../../../../core/binary/type/computeBinaryDataTypeByPrecision.js";
|
|
28
|
+
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
29
|
+
import {
|
|
30
|
+
computeThreeTextureInternalFormatFromDataType
|
|
31
|
+
} from "../../texture/computeThreeTextureInternalFormatFromDataType.js";
|
|
30
32
|
import { BinaryUint32BVH } from "../../../../core/bvh2/binary/2/BinaryUint32BVH.js";
|
|
31
33
|
import { mat4 } from "gl-matrix";
|
|
32
34
|
import { TextureAtlas } from "../../texture/atlas/TextureAtlas.js";
|
|
@@ -394,7 +396,7 @@ export class LightManager {
|
|
|
394
396
|
const rounded_value = Math.ceil(bit_count);
|
|
395
397
|
|
|
396
398
|
this.__cluster_texture_precision = rounded_value;
|
|
397
|
-
const dataType =
|
|
399
|
+
const dataType = computeBinaryDataTypeByPrecision(NumericType.Uint, rounded_value);
|
|
398
400
|
|
|
399
401
|
const threeTextureType = computeThreeTextureTypeFromDataType(dataType);
|
|
400
402
|
|
|
@@ -415,7 +417,7 @@ export class LightManager {
|
|
|
415
417
|
}
|
|
416
418
|
|
|
417
419
|
__build_cluster_texture() {
|
|
418
|
-
const dataType =
|
|
420
|
+
const dataType = computeBinaryDataTypeByPrecision(NumericType.Uint, this.__cluster_texture_precision);
|
|
419
421
|
|
|
420
422
|
const threeTextureType = computeThreeTextureTypeFromDataType(dataType);
|
|
421
423
|
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import { assert } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { channelCountToThreeTextureFormat } from "../../../texture/channelCountToThreeTextureFormat.js";
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { typed_array_copy } from "../../../core/collection/array/typed/typed_array_copy.js";
|
|
3
|
+
import { channelCountToThreeTextureFormat } from "./channelCountToThreeTextureFormat.js";
|
|
5
4
|
import { DataTexture, NearestFilter } from "three";
|
|
6
|
-
import {
|
|
5
|
+
import { computeThreeTextureTypeFromDataType } from "./computeThreeTextureTypeFromDataType.js";
|
|
6
|
+
import { computeThreeTextureInternalFormatFromDataType } from "./computeThreeTextureInternalFormatFromDataType.js";
|
|
7
|
+
import { DataTypeByteSizes } from "../../../core/binary/type/DataTypeByteSizes.js";
|
|
8
|
+
import { normalized_internal_format } from "./normalized_internal_format.js";
|
|
7
9
|
import {
|
|
8
|
-
|
|
9
|
-
} from "../../../
|
|
10
|
-
import {
|
|
11
|
-
computeThreeTextureInternalFormatFromDataType
|
|
12
|
-
} from "../../../render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js";
|
|
13
|
-
import { DataTypeByteSizes } from "../../../../../core/binary/type/DataTypeByteSizes.js";
|
|
14
|
-
import { normalized_internal_format } from "../../../texture/normalized_internal_format.js";
|
|
10
|
+
compute_typed_array_constructor_from_data_type
|
|
11
|
+
} from "../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
15
12
|
|
|
16
13
|
export class AttributeDataTexture {
|
|
17
14
|
/**
|
|
18
15
|
*
|
|
19
16
|
* @param {AttributeSpec} spec
|
|
20
17
|
* @param {number} column_count
|
|
18
|
+
* @param {number} slot_width number of data points stored per slot
|
|
21
19
|
*/
|
|
22
|
-
constructor(spec, column_count) {
|
|
20
|
+
constructor(spec, column_count, slot_width) {
|
|
23
21
|
assert.defined(spec, 'spec');
|
|
24
22
|
assert.equal(spec.isAttributeSpec, true, 'spec.isAttributeSpec !== true');
|
|
25
23
|
|
|
26
24
|
assert.isNonNegativeInteger(column_count, 'column_count');
|
|
25
|
+
assert.greaterThan(column_count, 0, 'column_count > 0');
|
|
26
|
+
|
|
27
|
+
assert.isNonNegativeInteger(slot_width, 'slot_width');
|
|
28
|
+
assert.greaterThan(slot_width, 0, 'slot_width > 0');
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
*
|
|
@@ -48,6 +50,13 @@ export class AttributeDataTexture {
|
|
|
48
50
|
*/
|
|
49
51
|
this.__texture = null;
|
|
50
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Number of data points stored per slot
|
|
55
|
+
* @type {number}
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
this.__slot_width = slot_width;
|
|
59
|
+
|
|
51
60
|
this.build();
|
|
52
61
|
}
|
|
53
62
|
|
|
@@ -76,8 +85,7 @@ export class AttributeDataTexture {
|
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
computeSlotWidth() {
|
|
79
|
-
|
|
80
|
-
return MICRON_PATCH_SIZE_MAX * VERTICES_PER_TRIANGLE;
|
|
88
|
+
return this.__slot_width;
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
/**
|
|
@@ -109,7 +117,7 @@ export class AttributeDataTexture {
|
|
|
109
117
|
|
|
110
118
|
const old_data = image.data;
|
|
111
119
|
|
|
112
|
-
const TypedArray =
|
|
120
|
+
const TypedArray = compute_typed_array_constructor_from_data_type(spec.type);
|
|
113
121
|
const new_data = new TypedArray(width * height * spec.itemSize);
|
|
114
122
|
|
|
115
123
|
// retain data
|
|
@@ -127,7 +135,7 @@ export class AttributeDataTexture {
|
|
|
127
135
|
build() {
|
|
128
136
|
const spec = this.__spec;
|
|
129
137
|
|
|
130
|
-
const TypedArray =
|
|
138
|
+
const TypedArray = compute_typed_array_constructor_from_data_type(spec.type);
|
|
131
139
|
|
|
132
140
|
const width = this.computeSlotWidth() * this.__column_count;
|
|
133
141
|
const height = Math.ceil(this.__capacity / this.__column_count);
|
|
@@ -287,8 +295,9 @@ export class AttributeDataTexture {
|
|
|
287
295
|
* @return {AttributeDataTexture}
|
|
288
296
|
* @param {AttributeSpec} spec
|
|
289
297
|
* @param {number} column_count
|
|
298
|
+
* @param {number} slot_width
|
|
290
299
|
*/
|
|
291
|
-
static from(spec, column_count) {
|
|
292
|
-
return new AttributeDataTexture(spec, column_count);
|
|
300
|
+
static from(spec, column_count, slot_width) {
|
|
301
|
+
return new AttributeDataTexture(spec, column_count, slot_width);
|
|
293
302
|
}
|
|
294
303
|
}
|
package/src/engine/graphics/{render/forward_plus/data → texture}/TextureBackedMemoryRegion.js
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, NearestFilter, RedFormat, UnsignedByteType } from "three";
|
|
2
|
-
import { BinaryDataType } from "
|
|
3
|
-
import { assert } from "
|
|
2
|
+
import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
|
|
3
|
+
import { assert } from "../../../core/assert.js";
|
|
4
4
|
import {
|
|
5
5
|
DataType2TypedArrayConstructorMapping
|
|
6
|
-
} from "
|
|
7
|
-
import { max2 } from "
|
|
8
|
-
import { NumericType } from "
|
|
9
|
-
import {
|
|
6
|
+
} from "../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
7
|
+
import { max2 } from "../../../core/math/max2.js";
|
|
8
|
+
import { NumericType } from "../../../core/math/NumericType.js";
|
|
9
|
+
import { computeBinaryDataTypeByPrecision } from "../../../core/binary/type/computeBinaryDataTypeByPrecision.js";
|
|
10
10
|
import { computeThreeTextureTypeFromDataType } from "./computeThreeTextureTypeFromDataType.js";
|
|
11
11
|
import { computeThreeTextureInternalFormatFromDataType } from "./computeThreeTextureInternalFormatFromDataType.js";
|
|
12
12
|
import { computeThreeTextureFormat } from "./computeThreeTextureFormat.js";
|
|
13
|
-
import { DataTypeByteSizes } from "
|
|
13
|
+
import { DataTypeByteSizes } from "../../../core/binary/type/DataTypeByteSizes.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* How wide a data texture is
|
|
@@ -168,7 +168,7 @@ export class TextureBackedMemoryRegion {
|
|
|
168
168
|
* @private
|
|
169
169
|
*/
|
|
170
170
|
__update_data_type() {
|
|
171
|
-
const new_data_type =
|
|
171
|
+
const new_data_type = computeBinaryDataTypeByPrecision(this.__type, this.__precision);
|
|
172
172
|
|
|
173
173
|
if (new_data_type !== this.__data_type) {
|
|
174
174
|
this.__data_type = new_data_type;
|
package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureFormat.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NumericType } from "
|
|
1
|
+
import { NumericType } from "../../../core/math/NumericType.js";
|
|
2
2
|
import { channelCountToThreIntegerTextureType } from "./channelCountToThreIntegerTextureType.js";
|
|
3
|
-
import { channelCountToThreeTextureFormat } from "
|
|
3
|
+
import { channelCountToThreeTextureFormat } from "./channelCountToThreeTextureFormat.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -23,7 +23,7 @@ function convertSampler2D2Canvas(sampler, scale = 255, offset = 0, canvas, fillD
|
|
|
23
23
|
canvas = document.createElement("canvas");
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const converted_sampler = Sampler2D.
|
|
26
|
+
const converted_sampler = Sampler2D.uint8clamped(4, sampler.width, sampler.height);
|
|
27
27
|
|
|
28
28
|
const width = sampler.width;
|
|
29
29
|
const height = sampler.height;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, FloatType, LinearFilter, NearestFilter } from "three";
|
|
2
2
|
import { assert } from "../../../../core/assert.js";
|
|
3
3
|
import { channelCountToThreeTextureFormat } from "../channelCountToThreeTextureFormat.js";
|
|
4
|
-
import {
|
|
5
|
-
computeThreeTextureInternalFormatFromDataType
|
|
6
|
-
} from "../../render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js";
|
|
4
|
+
import { computeThreeTextureInternalFormatFromDataType } from "../computeThreeTextureInternalFormatFromDataType.js";
|
|
7
5
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
8
6
|
|
|
9
7
|
/**
|
|
@@ -46,7 +46,7 @@ export class GridTaskGroup extends GridTaskGenerator {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
*
|
|
49
|
-
* @type {TaskGroup[]}
|
|
49
|
+
* @type {(TaskGroup|Task)[]}
|
|
50
50
|
*/
|
|
51
51
|
const tasks = [];
|
|
52
52
|
|
|
@@ -85,13 +85,13 @@ export class GridTaskGroup extends GridTaskGenerator {
|
|
|
85
85
|
const dependencyTask = tasks[dependencyIndex];
|
|
86
86
|
|
|
87
87
|
task.addDependency(dependencyTask);
|
|
88
|
-
}
|
|
89
88
|
|
|
90
|
-
if (!ENV_PRODUCTION) {
|
|
91
|
-
catchGeneratorErrors(generator, task);
|
|
92
89
|
}
|
|
90
|
+
|
|
91
|
+
catchGeneratorErrors(generator, task);
|
|
93
92
|
}
|
|
94
93
|
|
|
94
|
+
|
|
95
95
|
return new TaskGroup(tasks, 'Grid Generator');
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Utility function, mainly useful for visualizing filter values
|
|
3
5
|
* @param {Sampler2D} result
|
|
@@ -5,14 +7,20 @@
|
|
|
5
7
|
* @param {GridData} grid
|
|
6
8
|
*/
|
|
7
9
|
export function populateSampler2DFromCellFilter({ result, filter, grid }) {
|
|
10
|
+
assert.defined(result,'result');
|
|
11
|
+
assert.defined(filter,'filter');
|
|
12
|
+
assert.defined(grid,'grid');
|
|
8
13
|
|
|
9
14
|
if (!filter.initialized) {
|
|
10
15
|
filter.initialize(grid, 0);
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
const result_height = result.height;
|
|
19
|
+
const v_scale_result = 1 / (result_height - 1);
|
|
20
|
+
|
|
21
|
+
for (let y = 0; y < result_height; y++) {
|
|
14
22
|
|
|
15
|
-
const v = y
|
|
23
|
+
const v = y * v_scale_result;
|
|
16
24
|
|
|
17
25
|
const grid_y = v * (grid.height - 1);
|
|
18
26
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { Sampler2D } from "../../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
+
import { populateSampler2DFromCellFilter } from "./populateSampler2DFromCellFilter.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {GridData} grid
|
|
8
|
+
* @param {CellFilter} filter
|
|
9
|
+
* @param {number} resolution_scale must be a positive integer
|
|
10
|
+
*/
|
|
11
|
+
export function sampler_from_filter(grid, filter, resolution_scale = 1) {
|
|
12
|
+
assert.isNonNegativeInteger(resolution_scale, 'scale');
|
|
13
|
+
assert.defined(grid, 'grid');
|
|
14
|
+
assert.defined(filter, 'filter');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const result = Sampler2D.uint8(1, grid.width * resolution_scale, grid.height * resolution_scale);
|
|
18
|
+
|
|
19
|
+
populateSampler2DFromCellFilter({
|
|
20
|
+
result: result,
|
|
21
|
+
filter: filter,
|
|
22
|
+
grid
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import EmptyView from "../../../../view/elements/EmptyView.js";
|
|
3
|
+
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
4
|
+
import { sampler_from_filter } from "./sampler_from_filter.js";
|
|
5
|
+
import sampler2D2Canvas from "../../../../engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
6
|
+
import LabelView from "../../../../view/common/LabelView.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {GridData} grid
|
|
11
|
+
* @param {{name:string, filter:CellFilter}[]} projections
|
|
12
|
+
* @param {number} [resolution_scale]
|
|
13
|
+
* @param {number} [grid_width]
|
|
14
|
+
* @returns {View}
|
|
15
|
+
*/
|
|
16
|
+
export function visualise_filters_as_grid({
|
|
17
|
+
grid,
|
|
18
|
+
projections,
|
|
19
|
+
resolution_scale = 4,
|
|
20
|
+
grid_width = 4
|
|
21
|
+
}) {
|
|
22
|
+
|
|
23
|
+
assert.defined(grid, 'grid');
|
|
24
|
+
assert.defined(projections, 'projections');
|
|
25
|
+
assert.isArray(projections, 'projections');
|
|
26
|
+
|
|
27
|
+
const tile_size = [
|
|
28
|
+
grid.width * resolution_scale,
|
|
29
|
+
grid.height * resolution_scale
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const vContainer = new EmptyView();
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < projections.length; i++) {
|
|
35
|
+
|
|
36
|
+
const x = i % grid_width;
|
|
37
|
+
const y = Math.floor(i / grid_width);
|
|
38
|
+
|
|
39
|
+
const { filter, name = "unnamed" } = projections[i];
|
|
40
|
+
|
|
41
|
+
const tile = new EmptyView();
|
|
42
|
+
|
|
43
|
+
const vCanvas = new CanvasView();
|
|
44
|
+
|
|
45
|
+
const sampler = sampler_from_filter(grid, filter, resolution_scale);
|
|
46
|
+
|
|
47
|
+
vCanvas.size.set(sampler.width, sampler.height);
|
|
48
|
+
vCanvas.transformOrigin.set(0, 0);
|
|
49
|
+
|
|
50
|
+
sampler2D2Canvas(sampler, 255, 0, vCanvas.el)
|
|
51
|
+
|
|
52
|
+
tile.css({
|
|
53
|
+
position: "absolute",
|
|
54
|
+
left: "0",
|
|
55
|
+
top: "0"
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
tile.position.set((tile_size[0] + 1) * x, (tile_size[1] + 1) * y);
|
|
59
|
+
|
|
60
|
+
const label = new LabelView(name, {
|
|
61
|
+
css: {
|
|
62
|
+
top: "0",
|
|
63
|
+
left: "0",
|
|
64
|
+
position: "absolute",
|
|
65
|
+
padding: "4px",
|
|
66
|
+
color: "white",
|
|
67
|
+
textShadow: "0 0 2px black"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
tile.addChild(vCanvas);
|
|
72
|
+
tile.addChild(label);
|
|
73
|
+
|
|
74
|
+
tile.size.set(vCanvas.size.x * resolution_scale, vCanvas.size.y * resolution_scale)
|
|
75
|
+
|
|
76
|
+
vContainer.addChild(tile);
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return vContainer;
|
|
81
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const MICRON_GEOMETRY_FIELD = '@micron_geometry';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const MICRON_URI_FIELD = '@micron_path';
|