@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
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {BinaryDataType} type
|
|
6
6
|
* @returns {constructor}
|
|
7
7
|
*/
|
|
8
8
|
export function compute_micron_buffer_array_constructor(type) {
|
|
9
9
|
switch (type) {
|
|
10
|
-
case
|
|
10
|
+
case BinaryDataType.Float32:
|
|
11
11
|
return Float32Array;
|
|
12
|
-
case
|
|
12
|
+
case BinaryDataType.Float16:
|
|
13
13
|
// using uint16 to store half-float as half-float array is not implemented in browsers currently
|
|
14
14
|
return Uint16Array;
|
|
15
|
-
case
|
|
15
|
+
case BinaryDataType.Uint16:
|
|
16
16
|
return Uint16Array;
|
|
17
|
-
case
|
|
17
|
+
case BinaryDataType.Uint8:
|
|
18
18
|
return Uint8Array;
|
|
19
|
-
case
|
|
19
|
+
case BinaryDataType.Int8:
|
|
20
20
|
return Int8Array;
|
|
21
21
|
default:
|
|
22
22
|
throw new Error(`Unsupported data type '${type}'`);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
2
2
|
import { passThrough } from "../../../../core/function/Functions.js";
|
|
3
3
|
import { to_half_float_uint16 } from "../../../../core/binary/to_half_float_uint16.js";
|
|
4
4
|
import { compute_micron_buffer_array_constructor } from "./compute_micron_buffer_array_constructor.js";
|
|
5
5
|
import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
|
|
6
|
-
import { dataTypeByteSize } from "../../../../core/
|
|
6
|
+
import { dataTypeByteSize } from "../../../../core/binary/type/DataTypeByteSizes.js";
|
|
7
7
|
import { UintArrayForCount } from "../../../../core/collection/array/typed/uint_array_for_count.js";
|
|
8
8
|
import { clamp01 } from "../../../../core/math/clamp01.js";
|
|
9
9
|
|
|
@@ -124,13 +124,13 @@ const DataConverterType = {
|
|
|
124
124
|
*/
|
|
125
125
|
function compute_attribute_data_converter(source, spec) {
|
|
126
126
|
const target_type = spec.type;
|
|
127
|
-
if (target_type ===
|
|
127
|
+
if (target_type === BinaryDataType.Float16) {
|
|
128
128
|
return DataConverterType.Number2HalfFloat;
|
|
129
129
|
} else if (spec.normalized && !source.normalized) {
|
|
130
130
|
// source data can be normalized but isn't
|
|
131
|
-
if (target_type ===
|
|
131
|
+
if (target_type === BinaryDataType.Int8) {
|
|
132
132
|
return DataConverterType.Normalize2Int8;
|
|
133
|
-
} else if (target_type ===
|
|
133
|
+
} else if (target_type === BinaryDataType.Uint8) {
|
|
134
134
|
return DataConverterType.Normalize2Uint8;
|
|
135
135
|
} else {
|
|
136
136
|
throw new Error(`Unsupported normalized type '${target_type}'`);
|
|
@@ -146,7 +146,7 @@ function compute_attribute_data_converter(source, spec) {
|
|
|
146
146
|
if (target_byte_size !== source_byte_size) {
|
|
147
147
|
// wrong data size
|
|
148
148
|
|
|
149
|
-
if (target_type ===
|
|
149
|
+
if (target_type === BinaryDataType.Uint8 && source_type === BinaryDataType.Uint16) {
|
|
150
150
|
return DataConverterType.ResampleNormalized_Uint16_to_Uint8;
|
|
151
151
|
} else {
|
|
152
152
|
throw new Error(`Unsupported conversion ${source_type} -> ${target_type}`);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
deep_copy_vertex_quadratics
|
|
12
12
|
} from "../../../../../core/geom/3d/topology/simplify/quadratic/build_vertex_quadratics.js";
|
|
13
13
|
import { SquareMatrix } from "../../../../../core/graph/SquareMatrix.js";
|
|
14
|
-
import {
|
|
14
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
15
15
|
import { matrix_eigenvalues_in_place } from "../../../../../core/graph/eigen/eigen.js";
|
|
16
16
|
import { min2 } from "../../../../../core/math/min2.js";
|
|
17
17
|
import { PatchRepresentation } from "../PatchRepresentation.js";
|
|
@@ -136,13 +136,13 @@ function cluster_mesh(mesh, k,) {
|
|
|
136
136
|
const face_count = face_set.size;
|
|
137
137
|
|
|
138
138
|
// build laplacian matrix
|
|
139
|
-
const m_adjacency = new SquareMatrix(face_count,
|
|
140
|
-
const m_degree = new SquareMatrix(face_count,
|
|
139
|
+
const m_adjacency = new SquareMatrix(face_count, BinaryDataType.Uint8);
|
|
140
|
+
const m_degree = new SquareMatrix(face_count, BinaryDataType.Uint8);
|
|
141
141
|
|
|
142
142
|
build_face_adjacency_matrix(m_adjacency, mesh, face_index_map);
|
|
143
143
|
build_face_degree_matrix(m_degree, face_set, face_index_map);
|
|
144
144
|
|
|
145
|
-
const mat_laplace = new SquareMatrix(face_count,
|
|
145
|
+
const mat_laplace = new SquareMatrix(face_count, BinaryDataType.Float64);
|
|
146
146
|
|
|
147
147
|
mat_laplace.subtractMatrices(m_degree, m_adjacency);
|
|
148
148
|
|
|
@@ -5,7 +5,7 @@ import { BufferAttribute, BufferGeometry } from "three";
|
|
|
5
5
|
import { UintArrayForCount } from "../../../../core/collection/array/typed/uint_array_for_count.js";
|
|
6
6
|
import {
|
|
7
7
|
compute_typed_array_constructor_from_data_type
|
|
8
|
-
} from "../../../../core/
|
|
8
|
+
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
9
9
|
import { BitSet } from "../../../../core/binary/BitSet.js";
|
|
10
10
|
import { min2 } from "../../../../core/math/min2.js";
|
|
11
11
|
import { max2 } from "../../../../core/math/max2.js";
|
|
@@ -3,7 +3,7 @@ import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
|
|
|
3
3
|
import { MicronGeometry } from "../MicronGeometry.js";
|
|
4
4
|
import { VertexDataSpec } from "../../../geometry/VertexDataSpec.js";
|
|
5
5
|
import { AttributeSpec } from "../../../geometry/AttributeSpec.js";
|
|
6
|
-
import {
|
|
6
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
7
7
|
import { MicronGeometryBinarySerializationAdapter } from "./MicronGeometryBinarySerializationAdapter.js";
|
|
8
8
|
|
|
9
9
|
function sampleGeometry() {
|
|
@@ -31,7 +31,7 @@ function sampleGeometry() {
|
|
|
31
31
|
const vertex_spec = new VertexDataSpec();
|
|
32
32
|
vertex_spec.add(AttributeSpec.fromJSON({
|
|
33
33
|
name: 'position',
|
|
34
|
-
type:
|
|
34
|
+
type: BinaryDataType.Uint8,
|
|
35
35
|
itemSize: 3,
|
|
36
36
|
normalized: false
|
|
37
37
|
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { aabb3_build_corners } from "../../../../../core/geom/3d/aabb/aabb3_build_corners.js";
|
|
2
|
-
import { DataTypeByteSizes } from "../../../../../core/
|
|
2
|
+
import { DataTypeByteSizes } from "../../../../../core/binary/type/DataTypeByteSizes.js";
|
|
3
3
|
import {
|
|
4
4
|
DataType2TypedArrayConstructorMapping
|
|
5
|
-
} from "../../../../../core/
|
|
5
|
+
} from "../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
computeThreeTextureInternalFormatFromDataType
|
|
12
12
|
} from "../../../render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js";
|
|
13
|
-
import { DataTypeByteSizes } from "../../../../../core/
|
|
13
|
+
import { DataTypeByteSizes } from "../../../../../core/binary/type/DataTypeByteSizes.js";
|
|
14
14
|
import { normalized_internal_format } from "../../../texture/normalized_internal_format.js";
|
|
15
15
|
|
|
16
16
|
export class AttributeDataTexture {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import LineBuilder from "../../../../../../core/codegen/LineBuilder.js";
|
|
2
|
-
import {
|
|
2
|
+
import { BinaryDataType } from "../../../../../../core/binary/type/BinaryDataType.js";
|
|
3
3
|
import { gen_micron_vertex_attribute_texture_name } from "./gen_micron_vertex_attribute_texture_name.js";
|
|
4
4
|
import { MICRON_PATCH_SIZE_MAX } from "../../../build/MICRON_PATCH_SIZE_MAX.js";
|
|
5
5
|
|
|
@@ -40,7 +40,7 @@ export function shader_rewrite_standard(shader, uniforms, spec, column_count) {
|
|
|
40
40
|
let type;
|
|
41
41
|
|
|
42
42
|
switch (attribute.type) {
|
|
43
|
-
case
|
|
43
|
+
case BinaryDataType.Int8:
|
|
44
44
|
type = 'isampler2D';
|
|
45
45
|
break;
|
|
46
46
|
default:
|
|
@@ -2,7 +2,7 @@ import { BufferAttribute, BufferGeometry, DynamicDrawUsage } from "three";
|
|
|
2
2
|
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
3
3
|
import {
|
|
4
4
|
DataType2TypedArrayConstructorMapping
|
|
5
|
-
} from "../../../../../core/
|
|
5
|
+
} from "../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
6
6
|
import { getTransformedPositionsCached } from "./getTransformedPositionsCached.js";
|
|
7
7
|
import { Color } from "../../../../../core/color/Color.js";
|
|
8
8
|
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
package/src/engine/graphics/particles/node-based/codegen/modules/FunctionParameterSpecification.js
CHANGED
|
@@ -12,7 +12,7 @@ export class FunctionParameterSpecification {
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @type {
|
|
15
|
+
* @type {BinaryDataType}
|
|
16
16
|
*/
|
|
17
17
|
this.type = null;
|
|
18
18
|
}
|
|
@@ -20,7 +20,7 @@ export class FunctionParameterSpecification {
|
|
|
20
20
|
/**
|
|
21
21
|
*
|
|
22
22
|
* @param {PortDirection} direction
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {BinaryDataType} type
|
|
24
24
|
*
|
|
25
25
|
* @returns {FunctionParameterSpecification}
|
|
26
26
|
*/
|
|
@@ -11,7 +11,7 @@ export class FunctionSignature {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
|
-
* @type {
|
|
14
|
+
* @type {BinaryDataType}
|
|
15
15
|
*/
|
|
16
16
|
this.return_type = null;
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ export class FunctionSignature {
|
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
21
|
* @param {FunctionSignature} parameters
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {BinaryDataType} return_type
|
|
23
23
|
* @returns {FunctionSignature}
|
|
24
24
|
*/
|
|
25
25
|
static from(parameters, return_type) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AABB3 } from "../../../../../core/bvh2/aabb3/AABB3.js";
|
|
2
2
|
import { RowFirstTable } from "../../../../../core/collection/table/RowFirstTable.js";
|
|
3
3
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
4
|
-
import {
|
|
4
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
5
5
|
import { RowFirstTableSpec } from "../../../../../core/collection/table/RowFirstTableSpec.js";
|
|
6
6
|
|
|
7
7
|
const tempSequenceRecord = [];
|
|
8
8
|
|
|
9
9
|
const positionSequenceSpec = new RowFirstTableSpec([
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
BinaryDataType.Float32,
|
|
11
|
+
BinaryDataType.Float32, BinaryDataType.Float32, BinaryDataType.Float32,
|
|
12
|
+
BinaryDataType.Float32, BinaryDataType.Float32, BinaryDataType.Float32
|
|
13
13
|
]);
|
|
14
14
|
|
|
15
15
|
/**
|
package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VertexDataSpec } from "../../../../geometry/VertexDataSpec.js";
|
|
2
2
|
import { AttributeSpec } from "../../../../geometry/AttributeSpec.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BinaryDataType } from "../../../../../../core/binary/type/BinaryDataType.js";
|
|
4
4
|
|
|
5
5
|
//build particle spec
|
|
6
6
|
export const PARTICULAR_PARTICLE_SPECIFICATION = new VertexDataSpec();
|
|
@@ -8,26 +8,26 @@ export const PARTICULAR_PARTICLE_SPECIFICATION = new VertexDataSpec();
|
|
|
8
8
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
9
9
|
name: 'position',
|
|
10
10
|
itemSize: 3,
|
|
11
|
-
type:
|
|
11
|
+
type: BinaryDataType.Float32,
|
|
12
12
|
normalized: false
|
|
13
13
|
}));
|
|
14
14
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
15
15
|
name: 'age',
|
|
16
16
|
itemSize: 1,
|
|
17
|
-
type:
|
|
17
|
+
type: BinaryDataType.Float32,
|
|
18
18
|
normalized: false
|
|
19
19
|
}));
|
|
20
20
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
21
21
|
name: 'deathAge',
|
|
22
22
|
itemSize: 1,
|
|
23
|
-
type:
|
|
23
|
+
type: BinaryDataType.Float32,
|
|
24
24
|
normalized: false
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
27
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
28
28
|
name: 'atlasPatch',
|
|
29
29
|
itemSize: 4,
|
|
30
|
-
type:
|
|
30
|
+
type: BinaryDataType.Uint16,
|
|
31
31
|
normalized: true
|
|
32
32
|
}));
|
|
33
33
|
|
|
@@ -35,50 +35,50 @@ PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
|
35
35
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
36
36
|
name: 'size',
|
|
37
37
|
itemSize: 1,
|
|
38
|
-
type:
|
|
38
|
+
type: BinaryDataType.Float32,
|
|
39
39
|
normalized: false
|
|
40
40
|
}));
|
|
41
41
|
|
|
42
42
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
43
43
|
name: 'layerPosition',
|
|
44
44
|
itemSize: 1,
|
|
45
|
-
type:
|
|
45
|
+
type: BinaryDataType.Uint8,
|
|
46
46
|
normalized: false
|
|
47
47
|
}));
|
|
48
48
|
|
|
49
49
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
50
50
|
name: 'velocity',
|
|
51
51
|
itemSize: 3,
|
|
52
|
-
type:
|
|
52
|
+
type: BinaryDataType.Float32,
|
|
53
53
|
normalized: false
|
|
54
54
|
}));
|
|
55
55
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
56
56
|
name: 'rotation',
|
|
57
57
|
itemSize: 1,
|
|
58
|
-
type:
|
|
58
|
+
type: BinaryDataType.Float32,
|
|
59
59
|
normalized: false
|
|
60
60
|
}));
|
|
61
61
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
62
62
|
name: 'rotationSpeed',
|
|
63
63
|
itemSize: 1,
|
|
64
|
-
type:
|
|
64
|
+
type: BinaryDataType.Float32,
|
|
65
65
|
normalized: false
|
|
66
66
|
}));
|
|
67
67
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
68
68
|
name: 'color',
|
|
69
69
|
itemSize: 4,
|
|
70
|
-
type:
|
|
70
|
+
type: BinaryDataType.Uint8,
|
|
71
71
|
normalized: true
|
|
72
72
|
}));
|
|
73
73
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
74
74
|
name: 'blending',
|
|
75
75
|
itemSize: 1,
|
|
76
|
-
type:
|
|
76
|
+
type: BinaryDataType.Float32,
|
|
77
77
|
normalized: false
|
|
78
78
|
}));
|
|
79
79
|
PARTICULAR_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
80
80
|
name: 'size_initial',
|
|
81
81
|
itemSize: 1,
|
|
82
|
-
type:
|
|
82
|
+
type: BinaryDataType.Float32,
|
|
83
83
|
normalized: false
|
|
84
84
|
}));
|
|
@@ -6,7 +6,7 @@ import { typed_array_copy } from "../../../../../../core/collection/array/typed/
|
|
|
6
6
|
import { assert } from "../../../../../../core/assert.js";
|
|
7
7
|
import {
|
|
8
8
|
compute_typed_array_constructor_from_data_type
|
|
9
|
-
} from "../../../../../../core/
|
|
9
|
+
} from "../../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
10
10
|
import { min2 } from "../../../../../../core/math/min2.js";
|
|
11
11
|
import { max2 } from "../../../../../../core/math/max2.js";
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParticlePool } from "./ParticlePool.js";
|
|
2
2
|
import { VertexDataSpec } from "../../../../geometry/VertexDataSpec.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BinaryDataType } from "../../../../../../core/binary/type/BinaryDataType.js";
|
|
4
4
|
import { AttributeSpec } from "../../../../geometry/AttributeSpec.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,8 +10,8 @@ import { AttributeSpec } from "../../../../geometry/AttributeSpec.js";
|
|
|
10
10
|
function samplePool() {
|
|
11
11
|
const specification = new VertexDataSpec();
|
|
12
12
|
|
|
13
|
-
specification.add(AttributeSpec.fromJSON({name:'a', type:
|
|
14
|
-
specification.add(AttributeSpec.fromJSON({name:'b', type:
|
|
13
|
+
specification.add(AttributeSpec.fromJSON({name:'a', type:BinaryDataType.Float32, itemSize:1}));
|
|
14
|
+
specification.add(AttributeSpec.fromJSON({name:'b', type:BinaryDataType.Float32, itemSize:4}));
|
|
15
15
|
|
|
16
16
|
const pool = new ParticlePool(specification);
|
|
17
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VertexDataSpec } from "../../../../../geometry/VertexDataSpec.js";
|
|
2
2
|
import { AttributeSpec } from "../../../../../geometry/AttributeSpec.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BinaryDataType } from "../../../../../../../core/binary/type/BinaryDataType.js";
|
|
4
4
|
|
|
5
5
|
export const BILLBOARD_PARTICLE_ATTRIBUTE_POSITION = 0;
|
|
6
6
|
export const BILLBOARD_PARTICLE_ATTRIBUTE_UV = 1;
|
|
@@ -11,14 +11,14 @@ export const BILLBOARD_PARTICLE_ATTRIBUTE_BLEND = 6;
|
|
|
11
11
|
|
|
12
12
|
export const BILLBOARD_PARTICLE_SPECIFICATION = new VertexDataSpec();
|
|
13
13
|
|
|
14
|
-
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'position', itemSize: 3, type:
|
|
14
|
+
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'position', itemSize: 3, type: BinaryDataType.Float32 }));
|
|
15
15
|
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({
|
|
16
16
|
name: 'atlasPatch',
|
|
17
17
|
itemSize: 4,
|
|
18
|
-
type:
|
|
18
|
+
type: BinaryDataType.Float32
|
|
19
19
|
}));
|
|
20
|
-
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'size', itemSize: 1, type:
|
|
21
|
-
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'velocity', itemSize: 3, type:
|
|
22
|
-
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'rotation', itemSize: 1, type:
|
|
23
|
-
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'color', itemSize: 1, type:
|
|
24
|
-
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'blending', itemSize: 1, type:
|
|
20
|
+
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'size', itemSize: 1, type: BinaryDataType.Float32 }));
|
|
21
|
+
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'velocity', itemSize: 3, type: BinaryDataType.Float32 }));
|
|
22
|
+
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'rotation', itemSize: 1, type: BinaryDataType.Float32 }));
|
|
23
|
+
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'color', itemSize: 1, type: BinaryDataType.Float32 }));
|
|
24
|
+
BILLBOARD_PARTICLE_SPECIFICATION.add(AttributeSpec.fromJSON({ name: 'blending', itemSize: 1, type: BinaryDataType.Uint8 }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Signal from "../../../../../../../core/events/signal/Signal.js";
|
|
2
2
|
import {
|
|
3
3
|
DataType2TypedArrayConstructorMapping
|
|
4
|
-
} from "../../../../../../../core/
|
|
4
|
+
} from "../../../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
5
5
|
import { array_copy } from "../../../../../../../core/collection/array/copyArray.js";
|
|
6
6
|
import { min2 } from "../../../../../../../core/math/min2.js";
|
|
7
7
|
import { assert } from "../../../../../../../core/assert.js";
|
|
@@ -22,7 +22,7 @@ import { TextureBackedMemoryRegion } from "./data/TextureBackedMemoryRegion.js";
|
|
|
22
22
|
import { assert } from "../../../../core/assert.js";
|
|
23
23
|
import {
|
|
24
24
|
DataType2TypedArrayConstructorMapping
|
|
25
|
-
} from "../../../../core/
|
|
25
|
+
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
26
26
|
import { NumericType } from "./data/NumericType.js";
|
|
27
27
|
import { computeDataType } from "./data/computeDataType.js";
|
|
28
28
|
import { computeThreeTextureTypeFromDataType } from "./data/computeThreeTextureTypeFromDataType.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, NearestFilter, RedFormat, UnsignedByteType } from "three";
|
|
2
|
-
import {
|
|
2
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
3
3
|
import { assert } from "../../../../../core/assert.js";
|
|
4
4
|
import {
|
|
5
5
|
DataType2TypedArrayConstructorMapping
|
|
6
|
-
} from "../../../../../core/
|
|
6
|
+
} from "../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
7
7
|
import { max2 } from "../../../../../core/math/max2.js";
|
|
8
8
|
import { NumericType } from "./NumericType.js";
|
|
9
9
|
import { computeDataType } from "./computeDataType.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 "../../../../../core/
|
|
13
|
+
import { DataTypeByteSizes } from "../../../../../core/binary/type/DataTypeByteSizes.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* How wide a data texture is
|
|
@@ -84,10 +84,10 @@ export class TextureBackedMemoryRegion {
|
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
*
|
|
87
|
-
* @type {
|
|
87
|
+
* @type {BinaryDataType|string}
|
|
88
88
|
* @private
|
|
89
89
|
*/
|
|
90
|
-
this.__data_type =
|
|
90
|
+
this.__data_type = BinaryDataType.Uint8;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
get concrete_type() {
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { NumericType } from "./NumericType.js";
|
|
2
|
-
import {
|
|
2
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @param {NumericType} type
|
|
7
7
|
* @param {number} precision
|
|
8
|
-
* @returns {
|
|
8
|
+
* @returns {BinaryDataType}
|
|
9
9
|
*/
|
|
10
10
|
export function computeDataType(type, precision) {
|
|
11
11
|
if (type === NumericType.Uint) {
|
|
12
12
|
if (precision <= 8) {
|
|
13
|
-
return
|
|
13
|
+
return BinaryDataType.Uint8;
|
|
14
14
|
} else if (precision <= 16) {
|
|
15
|
-
return
|
|
15
|
+
return BinaryDataType.Uint16;
|
|
16
16
|
} else if (precision <= 32) {
|
|
17
|
-
return
|
|
17
|
+
return BinaryDataType.Uint32;
|
|
18
18
|
}
|
|
19
19
|
} else if (type === NumericType.Int) {
|
|
20
20
|
if (precision <= 8) {
|
|
21
|
-
return
|
|
21
|
+
return BinaryDataType.Int8;
|
|
22
22
|
} else if (precision <= 16) {
|
|
23
|
-
return
|
|
23
|
+
return BinaryDataType.Int16;
|
|
24
24
|
} else if (precision <= 32) {
|
|
25
|
-
return
|
|
25
|
+
return BinaryDataType.Int32;
|
|
26
26
|
}
|
|
27
27
|
} else if (type === NumericType.Float) {
|
|
28
28
|
if (precision <= 32) {
|
|
29
|
-
return
|
|
29
|
+
return BinaryDataType.Float32;
|
|
30
30
|
} else if (precision <= 64) {
|
|
31
|
-
return
|
|
31
|
+
return BinaryDataType.Float64;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {BinaryDataType} dt
|
|
6
6
|
* @param {number} channel_count
|
|
7
7
|
* @returns {string|THREE.PixelFormatGPU}
|
|
8
8
|
*/
|
|
9
9
|
export function computeThreeTextureInternalFormatFromDataType(dt, channel_count) {
|
|
10
10
|
let suffix = '';
|
|
11
11
|
switch (dt) {
|
|
12
|
-
case
|
|
12
|
+
case BinaryDataType.Uint8:
|
|
13
13
|
suffix = '8UI';
|
|
14
14
|
break;
|
|
15
|
-
case
|
|
15
|
+
case BinaryDataType.Uint16:
|
|
16
16
|
suffix = '16UI';
|
|
17
17
|
break;
|
|
18
|
-
case
|
|
18
|
+
case BinaryDataType.Uint32:
|
|
19
19
|
suffix = '32UI';
|
|
20
20
|
break;
|
|
21
|
-
case
|
|
21
|
+
case BinaryDataType.Int8:
|
|
22
22
|
suffix = '8I';
|
|
23
23
|
break;
|
|
24
|
-
case
|
|
24
|
+
case BinaryDataType.Int16:
|
|
25
25
|
suffix = '16I';
|
|
26
26
|
break;
|
|
27
|
-
case
|
|
27
|
+
case BinaryDataType.Int32:
|
|
28
28
|
suffix = '32I';
|
|
29
29
|
break;
|
|
30
|
-
case
|
|
30
|
+
case BinaryDataType.Float16:
|
|
31
31
|
suffix = '16F';
|
|
32
32
|
break;
|
|
33
|
-
case
|
|
33
|
+
case BinaryDataType.Float32:
|
|
34
34
|
suffix = '32F';
|
|
35
35
|
break;
|
|
36
|
-
case
|
|
36
|
+
case BinaryDataType.Float64:
|
|
37
37
|
suffix = '64F';
|
|
38
38
|
break;
|
|
39
39
|
default:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
2
2
|
import {
|
|
3
3
|
ByteType,
|
|
4
4
|
FloatType,
|
|
@@ -12,28 +12,28 @@ import {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {BinaryDataType} dt
|
|
16
16
|
* @returns {number}
|
|
17
17
|
*/
|
|
18
18
|
export function computeThreeTextureTypeFromDataType(dt) {
|
|
19
19
|
switch (dt) {
|
|
20
|
-
case
|
|
20
|
+
case BinaryDataType.Uint8:
|
|
21
21
|
return UnsignedByteType;
|
|
22
|
-
case
|
|
22
|
+
case BinaryDataType.Uint16:
|
|
23
23
|
return UnsignedShortType;
|
|
24
|
-
case
|
|
24
|
+
case BinaryDataType.Uint32:
|
|
25
25
|
return UnsignedIntType;
|
|
26
|
-
case
|
|
26
|
+
case BinaryDataType.Int8:
|
|
27
27
|
return ByteType;
|
|
28
|
-
case
|
|
28
|
+
case BinaryDataType.Int16:
|
|
29
29
|
return ShortType;
|
|
30
|
-
case
|
|
30
|
+
case BinaryDataType.Int32:
|
|
31
31
|
return IntType;
|
|
32
|
-
case
|
|
32
|
+
case BinaryDataType.Float16:
|
|
33
33
|
return HalfFloatType;
|
|
34
|
-
case
|
|
34
|
+
case BinaryDataType.Float32:
|
|
35
35
|
return FloatType;
|
|
36
|
-
case
|
|
36
|
+
case BinaryDataType.Float64:
|
|
37
37
|
return FloatType;
|
|
38
38
|
default:
|
|
39
39
|
throw new Error(`Unsupported data type '${dt}'`);
|