@woosh/meep-engine 2.134.4 → 2.135.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.
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/tools/v2/TransformControlsGizmo.js +1 -1
- package/editor/view/node-graph/NodeGraphEditorView.js +2 -2
- package/package.json +1 -1
- package/src/core/assert.d.ts +0 -2
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +0 -6
- package/src/core/color/Color.d.ts +0 -5
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +1 -7
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.js +386 -386
- package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_2d.js +1 -1
- package/src/core/geom/2d/quad-tree-binary/QuadTree.js +714 -714
- package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +160 -160
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +96 -96
- package/src/core/geom/packing/max-rect/MaxRectanglesPacker.js +1 -1
- package/src/core/geom/packing/max-rect/findBestContainer.js +4 -4
- package/src/core/geom/packing/max-rect/packOneBox.js +2 -2
- package/src/core/geom/vec3/v3_rigid_align_paired_unit_vectors.d.ts +23 -0
- package/src/core/geom/vec3/v3_rigid_align_paired_unit_vectors.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_rigid_align_paired_unit_vectors.js +96 -0
- package/src/core/graph/layout/box/BoxLayouter.js +7 -7
- package/src/core/graph/layout/box/position_box_next_to_box.js +6 -6
- package/src/core/math/computeWholeDivisorLow.js +33 -33
- package/src/core/math/linalg/eigen/eigen_values_find_spectral_gap.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_eigenvalues_in_place.d.ts +10 -0
- package/src/core/math/linalg/eigen/matrix_eigenvalues_in_place.d.ts.map +1 -0
- package/src/core/{graph → math/linalg}/eigen/matrix_eigenvalues_in_place.js +8 -7
- package/src/core/math/linalg/eigen/matrix_householder_in_place.d.ts.map +1 -0
- package/src/core/{graph → math/linalg}/eigen/matrix_householder_in_place.js +11 -5
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts +15 -0
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts.map +1 -0
- package/src/core/{graph → math/linalg}/eigen/matrix_qr_in_place.js +8 -2
- package/src/core/math/linalg/eigen/matrix_top_eigenvector_power_iteration.d.ts +17 -0
- package/src/core/math/linalg/eigen/matrix_top_eigenvector_power_iteration.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_top_eigenvector_power_iteration.js +107 -0
- package/src/core/math/linalg/polynomial_complex_roots_aberth_ehrlich.d.ts +19 -0
- package/src/core/math/linalg/polynomial_complex_roots_aberth_ehrlich.d.ts.map +1 -0
- package/src/core/math/linalg/polynomial_complex_roots_aberth_ehrlich.js +161 -0
- package/src/core/math/linalg/polynomial_real_roots_in_interval.d.ts +15 -0
- package/src/core/math/linalg/polynomial_real_roots_in_interval.d.ts.map +1 -0
- package/src/core/math/linalg/polynomial_real_roots_in_interval.js +200 -0
- package/src/core/math/solveCubic.d.ts +15 -0
- package/src/core/math/solveCubic.d.ts.map +1 -0
- package/src/core/math/solveCubic.js +82 -0
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts +23 -0
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_bounds_t.js +109 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts +25 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.js +44 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_1d.d.ts +16 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_1d.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_1d.js +120 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts +11 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.js +451 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts +12 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.js +339 -0
- package/src/core/math/spline/spline3_hermite_intersects_spline3_hermite.d.ts +15 -0
- package/src/core/math/spline/spline3_hermite_intersects_spline3_hermite.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersects_spline3_hermite.js +21 -0
- package/src/core/math/spline/spline3_hermite_to_monomial.d.ts +24 -0
- package/src/core/math/spline/spline3_hermite_to_monomial.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_to_monomial.js +37 -0
- package/src/core/math/spline/v3_computeCatmullRomSplineUniformDistance.js +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +1 -1
- package/src/core/model/reactive/model/util/createRandomReactiveExpression.js +185 -185
- package/src/core/process/delay.js +16 -16
- package/src/engine/animation/async/TimeSeries.js +300 -300
- package/src/engine/animation/curve/AnimationCurve.d.ts +3 -2
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +3 -2
- package/src/engine/animation/curve/draw/position_canvas_to_curve.js +2 -2
- package/src/engine/animation/curve/draw/position_curve_to_canvas.js +2 -2
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +145 -145
- package/src/engine/ecs/gui/position/ViewportPositionSystem.js +2 -2
- package/src/engine/ecs/parent/entity_node_compute_bounding_box.js +1 -1
- package/src/engine/ecs/transform/Transform.d.ts +0 -10
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +0 -12
- package/src/engine/graphics/composit/CompositLayer.js +254 -254
- package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_linear.js +2 -2
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +201 -201
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +2 -2
- package/src/engine/graphics/render/forward_plus/LightManager.js +1226 -1226
- package/src/engine/graphics/render/forward_plus/model/PointLight.js +1 -1
- package/src/engine/graphics/sh3/lpv/lpv_obtain_storage_cached_volume.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +2 -2
- package/src/engine/graphics/texture/atlas/TextureAtlasDebugger.js +1 -1
- package/src/engine/graphics/texture/sampler/HarmonicDiffusionGrid.js +145 -145
- package/src/engine/graphics/texture/sampler/serialization/TextureBinaryBufferSerializer.js +2 -2
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +2 -6
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +0 -10
- package/src/engine/intelligence/mcts/MonteCarlo.js +275 -275
- package/src/engine/navigation/ecs/path_following/PathFollower.js +222 -222
- package/src/generation/grid/GridData.js +220 -220
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +385 -385
- package/src/view/elements/image/SvgImageView.js +1 -1
- package/src/view/elements/windrose/WindRoseDiagram.js +369 -369
- package/src/view/minimap/gl/MinimapFogOfWar.js +3 -3
- package/src/view/util/DomSizeObserver.js +1 -1
- package/src/core/binary/clz32.d.ts +0 -6
- package/src/core/binary/clz32.d.ts.map +0 -1
- package/src/core/binary/clz32.js +0 -5
- package/src/core/binary/type/dataTypeFromTypedArray.d.ts +0 -8
- package/src/core/binary/type/dataTypeFromTypedArray.d.ts.map +0 -1
- package/src/core/binary/type/dataTypeFromTypedArray.js +0 -11
- package/src/core/collection/array/computeHashIntegerArray.d.ts +0 -1
- package/src/core/collection/array/computeHashIntegerArray.d.ts.map +0 -1
- package/src/core/collection/array/computeHashIntegerArray.js +0 -7
- package/src/core/collection/array/typed/typedArrayToDataType.d.ts +0 -6
- package/src/core/collection/array/typed/typedArrayToDataType.d.ts.map +0 -1
- package/src/core/collection/array/typed/typedArrayToDataType.js +0 -6
- package/src/core/geom/3d/mat4/MATRIX_4_IDENTITY.d.ts +0 -6
- package/src/core/geom/3d/mat4/MATRIX_4_IDENTITY.d.ts.map +0 -1
- package/src/core/geom/3d/mat4/MATRIX_4_IDENTITY.js +0 -7
- package/src/core/graph/eigen/eigen_values_find_spectral_gap.d.ts.map +0 -1
- package/src/core/graph/eigen/matrix_eigenvalues_in_place.d.ts +0 -8
- package/src/core/graph/eigen/matrix_eigenvalues_in_place.d.ts.map +0 -1
- package/src/core/graph/eigen/matrix_householder_in_place.d.ts.map +0 -1
- package/src/core/graph/eigen/matrix_qr_in_place.d.ts +0 -9
- package/src/core/graph/eigen/matrix_qr_in_place.d.ts.map +0 -1
- package/src/core/math/spline/cubicCurve.d.ts +0 -6
- package/src/core/math/spline/cubicCurve.d.ts.map +0 -1
- package/src/core/math/spline/cubicCurve.js +0 -6
- package/src/core/math/spline/spline_bezier2.d.ts +0 -6
- package/src/core/math/spline/spline_bezier2.d.ts.map +0 -1
- package/src/core/math/spline/spline_bezier2.js +0 -6
- package/src/core/math/spline/spline_bezier3.d.ts +0 -6
- package/src/core/math/spline/spline_bezier3.d.ts.map +0 -1
- package/src/core/math/spline/spline_bezier3.js +0 -6
- package/src/core/math/spline/spline_bezier3_bounds.d.ts +0 -6
- package/src/core/math/spline/spline_bezier3_bounds.d.ts.map +0 -1
- package/src/core/math/spline/spline_bezier3_bounds.js +0 -6
- package/src/core/math/spline/spline_hermite3.d.ts +0 -6
- package/src/core/math/spline/spline_hermite3.d.ts.map +0 -1
- package/src/core/math/spline/spline_hermite3.js +0 -6
- package/src/core/math/spline/spline_hermite3_bounds.d.ts +0 -6
- package/src/core/math/spline/spline_hermite3_bounds.d.ts.map +0 -1
- package/src/core/math/spline/spline_hermite3_bounds.js +0 -6
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts +0 -2
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts.map +0 -1
- package/src/core/math/spline/spline_hermite3_to_bezier.js +0 -6
- package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.d.ts +0 -37
- package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.d.ts.map +0 -1
- package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.js +0 -70
- /package/src/core/{graph → math/linalg}/eigen/eigen_values_find_spectral_gap.d.ts +0 -0
- /package/src/core/{graph → math/linalg}/eigen/eigen_values_find_spectral_gap.js +0 -0
- /package/src/core/{graph → math/linalg}/eigen/matrix_householder_in_place.d.ts +0 -0
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
import Signal from "../../../../../../../core/events/signal/Signal.js";
|
|
2
|
-
import {
|
|
3
|
-
DataType2TypedArrayConstructorMapping
|
|
4
|
-
} from "../../../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
5
|
-
import { array_copy } from "../../../../../../../core/collection/array/array_copy.js";
|
|
6
|
-
import { min2 } from "../../../../../../../core/math/min2.js";
|
|
7
|
-
import { assert } from "../../../../../../../core/assert.js";
|
|
8
|
-
import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
|
|
9
|
-
|
|
10
|
-
export class AttributeValue {
|
|
11
|
-
constructor() {
|
|
12
|
-
/**
|
|
13
|
-
* Attribute spec
|
|
14
|
-
* @type {AttributeSpec}
|
|
15
|
-
*/
|
|
16
|
-
this.__spec = null;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @type {number[]}
|
|
21
|
-
*/
|
|
22
|
-
this.__value = [];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @type {ParameterLookupTable}
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
this.__lut = null;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @type {Signal}
|
|
34
|
-
*/
|
|
35
|
-
this.onValueChange = new Signal();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @param {AttributeSpec} s
|
|
40
|
-
*/
|
|
41
|
-
set spec(s) {
|
|
42
|
-
this.__spec = s;
|
|
43
|
-
this.init();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @returns {AttributeSpec}
|
|
49
|
-
*/
|
|
50
|
-
get spec() {
|
|
51
|
-
return this.__spec;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Will generate actual typed value storage
|
|
56
|
-
*/
|
|
57
|
-
init() {
|
|
58
|
-
const spec = this.__spec;
|
|
59
|
-
|
|
60
|
-
const TAC = DataType2TypedArrayConstructorMapping[spec.type];
|
|
61
|
-
|
|
62
|
-
const new_storage = new TAC(spec.itemSize);
|
|
63
|
-
|
|
64
|
-
array_copy(this.__value, 0, new_storage, 0, min2(this.__value.length, new_storage.length));
|
|
65
|
-
|
|
66
|
-
this.__value = new_storage;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @param {ParameterLookupTable} v
|
|
71
|
-
*/
|
|
72
|
-
set lookup(v) {
|
|
73
|
-
this.__lut = v;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
* @returns {ParameterLookupTable}
|
|
79
|
-
*/
|
|
80
|
-
get lookup() {
|
|
81
|
-
return this.__lut;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
set lookup_value(v) {
|
|
85
|
-
this.write_lookup_value(v);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* @param {number} v
|
|
91
|
-
*/
|
|
92
|
-
write_lookup_value(v) {
|
|
93
|
-
assert.isNumber(v, 'v');
|
|
94
|
-
|
|
95
|
-
if (this.__lut === null) {
|
|
96
|
-
throw new Error('No lookup table attached');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const r = [];
|
|
100
|
-
|
|
101
|
-
this.__lut.sample(v, r);
|
|
102
|
-
|
|
103
|
-
this.write_value(r);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
*
|
|
108
|
-
* @param {number[]} v
|
|
109
|
-
*/
|
|
110
|
-
write_value_silent(v) {
|
|
111
|
-
this.onValueChange.mute();
|
|
112
|
-
this.write_value(v);
|
|
113
|
-
this.onValueChange.unmute();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
* @param {number[]} v
|
|
119
|
-
*/
|
|
120
|
-
write_value(v) {
|
|
121
|
-
let change_flag = false;
|
|
122
|
-
|
|
123
|
-
const itemSize = this.__spec.itemSize;
|
|
124
|
-
|
|
125
|
-
for (let i = 0; i < itemSize; i++) {
|
|
126
|
-
const old = this.__value[i];
|
|
127
|
-
|
|
128
|
-
this.__value[i] = v[i];
|
|
129
|
-
|
|
130
|
-
if (this.__value[i] !== old) {
|
|
131
|
-
// stored value has changed
|
|
132
|
-
change_flag = true;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (change_flag) {
|
|
137
|
-
this.onValueChange.send0();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
*
|
|
143
|
-
* @param {number[]} destination
|
|
144
|
-
*/
|
|
145
|
-
read_value(destination) {
|
|
146
|
-
array_copy(this.__value, 0, destination, 0, this.spec.itemSize);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
*
|
|
151
|
-
* @param {number[]} [value]
|
|
152
|
-
* @param {Object} [lookup]
|
|
153
|
-
* @param {number} [lookup_value]
|
|
154
|
-
*/
|
|
155
|
-
fromJSON({
|
|
156
|
-
value,
|
|
157
|
-
lookup,
|
|
158
|
-
lookup_value
|
|
159
|
-
}) {
|
|
160
|
-
|
|
161
|
-
if (value !== undefined) {
|
|
162
|
-
if (Array.isArray(value)) {
|
|
163
|
-
|
|
164
|
-
if (lookup !== undefined) {
|
|
165
|
-
console.warn("Both 'lookup' and 'value' were specified, expected one or the other. Ignoring the value attribute.");
|
|
166
|
-
} else {
|
|
167
|
-
this.write_value(value);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
} else {
|
|
171
|
-
throw new Error(`Expected 'value' to be an array, instead got something else (=${value})`);
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
// retain current value
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (lookup !== undefined) {
|
|
178
|
-
const lut = new ParameterLookupTable();
|
|
179
|
-
|
|
180
|
-
lut.fromJSON(lookup);
|
|
181
|
-
|
|
182
|
-
this.lookup = lut;
|
|
183
|
-
} else {
|
|
184
|
-
this.lookup = null;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (lookup_value !== undefined) {
|
|
188
|
-
assert.isNumber(lookup_value, 'lookup_value');
|
|
189
|
-
assert.
|
|
190
|
-
|
|
191
|
-
if (lookup === undefined) {
|
|
192
|
-
console.warn("found 'lookup_value' attribute, but no 'lookup' table. Ignoring lookup value");
|
|
193
|
-
} else {
|
|
194
|
-
this.lookup_value = lookup_value;
|
|
195
|
-
}
|
|
196
|
-
} else if (lookup !== undefined) {
|
|
197
|
-
// supply a default lookup value
|
|
198
|
-
this.lookup_value = 0;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
1
|
+
import Signal from "../../../../../../../core/events/signal/Signal.js";
|
|
2
|
+
import {
|
|
3
|
+
DataType2TypedArrayConstructorMapping
|
|
4
|
+
} from "../../../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
5
|
+
import { array_copy } from "../../../../../../../core/collection/array/array_copy.js";
|
|
6
|
+
import { min2 } from "../../../../../../../core/math/min2.js";
|
|
7
|
+
import { assert } from "../../../../../../../core/assert.js";
|
|
8
|
+
import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
|
|
9
|
+
|
|
10
|
+
export class AttributeValue {
|
|
11
|
+
constructor() {
|
|
12
|
+
/**
|
|
13
|
+
* Attribute spec
|
|
14
|
+
* @type {AttributeSpec}
|
|
15
|
+
*/
|
|
16
|
+
this.__spec = null;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {number[]}
|
|
21
|
+
*/
|
|
22
|
+
this.__value = [];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {ParameterLookupTable}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
this.__lut = null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {Signal}
|
|
34
|
+
*/
|
|
35
|
+
this.onValueChange = new Signal();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {AttributeSpec} s
|
|
40
|
+
*/
|
|
41
|
+
set spec(s) {
|
|
42
|
+
this.__spec = s;
|
|
43
|
+
this.init();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @returns {AttributeSpec}
|
|
49
|
+
*/
|
|
50
|
+
get spec() {
|
|
51
|
+
return this.__spec;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Will generate actual typed value storage
|
|
56
|
+
*/
|
|
57
|
+
init() {
|
|
58
|
+
const spec = this.__spec;
|
|
59
|
+
|
|
60
|
+
const TAC = DataType2TypedArrayConstructorMapping[spec.type];
|
|
61
|
+
|
|
62
|
+
const new_storage = new TAC(spec.itemSize);
|
|
63
|
+
|
|
64
|
+
array_copy(this.__value, 0, new_storage, 0, min2(this.__value.length, new_storage.length));
|
|
65
|
+
|
|
66
|
+
this.__value = new_storage;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {ParameterLookupTable} v
|
|
71
|
+
*/
|
|
72
|
+
set lookup(v) {
|
|
73
|
+
this.__lut = v;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @returns {ParameterLookupTable}
|
|
79
|
+
*/
|
|
80
|
+
get lookup() {
|
|
81
|
+
return this.__lut;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
set lookup_value(v) {
|
|
85
|
+
this.write_lookup_value(v);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @param {number} v
|
|
91
|
+
*/
|
|
92
|
+
write_lookup_value(v) {
|
|
93
|
+
assert.isNumber(v, 'v');
|
|
94
|
+
|
|
95
|
+
if (this.__lut === null) {
|
|
96
|
+
throw new Error('No lookup table attached');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const r = [];
|
|
100
|
+
|
|
101
|
+
this.__lut.sample(v, r);
|
|
102
|
+
|
|
103
|
+
this.write_value(r);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* @param {number[]} v
|
|
109
|
+
*/
|
|
110
|
+
write_value_silent(v) {
|
|
111
|
+
this.onValueChange.mute();
|
|
112
|
+
this.write_value(v);
|
|
113
|
+
this.onValueChange.unmute();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @param {number[]} v
|
|
119
|
+
*/
|
|
120
|
+
write_value(v) {
|
|
121
|
+
let change_flag = false;
|
|
122
|
+
|
|
123
|
+
const itemSize = this.__spec.itemSize;
|
|
124
|
+
|
|
125
|
+
for (let i = 0; i < itemSize; i++) {
|
|
126
|
+
const old = this.__value[i];
|
|
127
|
+
|
|
128
|
+
this.__value[i] = v[i];
|
|
129
|
+
|
|
130
|
+
if (this.__value[i] !== old) {
|
|
131
|
+
// stored value has changed
|
|
132
|
+
change_flag = true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (change_flag) {
|
|
137
|
+
this.onValueChange.send0();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param {number[]} destination
|
|
144
|
+
*/
|
|
145
|
+
read_value(destination) {
|
|
146
|
+
array_copy(this.__value, 0, destination, 0, this.spec.itemSize);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
*
|
|
151
|
+
* @param {number[]} [value]
|
|
152
|
+
* @param {Object} [lookup]
|
|
153
|
+
* @param {number} [lookup_value]
|
|
154
|
+
*/
|
|
155
|
+
fromJSON({
|
|
156
|
+
value,
|
|
157
|
+
lookup,
|
|
158
|
+
lookup_value
|
|
159
|
+
}) {
|
|
160
|
+
|
|
161
|
+
if (value !== undefined) {
|
|
162
|
+
if (Array.isArray(value)) {
|
|
163
|
+
|
|
164
|
+
if (lookup !== undefined) {
|
|
165
|
+
console.warn("Both 'lookup' and 'value' were specified, expected one or the other. Ignoring the value attribute.");
|
|
166
|
+
} else {
|
|
167
|
+
this.write_value(value);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
} else {
|
|
171
|
+
throw new Error(`Expected 'value' to be an array, instead got something else (=${value})`);
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
// retain current value
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (lookup !== undefined) {
|
|
178
|
+
const lut = new ParameterLookupTable();
|
|
179
|
+
|
|
180
|
+
lut.fromJSON(lookup);
|
|
181
|
+
|
|
182
|
+
this.lookup = lut;
|
|
183
|
+
} else {
|
|
184
|
+
this.lookup = null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (lookup_value !== undefined) {
|
|
188
|
+
assert.isNumber(lookup_value, 'lookup_value');
|
|
189
|
+
assert.isFinite(lookup_value, 'lookup_value');
|
|
190
|
+
|
|
191
|
+
if (lookup === undefined) {
|
|
192
|
+
console.warn("found 'lookup_value' attribute, but no 'lookup' table. Ignoring lookup value");
|
|
193
|
+
} else {
|
|
194
|
+
this.lookup_value = lookup_value;
|
|
195
|
+
}
|
|
196
|
+
} else if (lookup !== undefined) {
|
|
197
|
+
// supply a default lookup value
|
|
198
|
+
this.lookup_value = 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js
CHANGED
|
@@ -1016,7 +1016,7 @@ function make_box_editor(engine, transform = new Transform()) {
|
|
|
1016
1016
|
t.rotation.onChanged.mute();
|
|
1017
1017
|
t.scale.onChanged.mute();
|
|
1018
1018
|
|
|
1019
|
-
t.
|
|
1019
|
+
t.fromMatrix(matrix.elements);
|
|
1020
1020
|
|
|
1021
1021
|
t.position.onChanged.unmute();
|
|
1022
1022
|
t.rotation.onChanged.unmute();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { combine_hash } from "../../../../../../core/collection/array/combine_hash.js";
|
|
2
2
|
|
|
3
3
|
export class ProgramValueSlotParameterSet {
|
|
4
4
|
constructor() {
|
|
@@ -39,6 +39,6 @@ export class ProgramValueSlotParameterSet {
|
|
|
39
39
|
* @return {number}
|
|
40
40
|
*/
|
|
41
41
|
hash() {
|
|
42
|
-
return
|
|
42
|
+
return combine_hash.apply(null, this.data.map(p => p.hash()));
|
|
43
43
|
}
|
|
44
44
|
}
|