@woosh/meep-engine 2.109.0 → 2.109.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/meep.cjs +28 -13
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +28 -13
- package/package.json +1 -1
- package/src/core/binary/BitSet.d.ts +6 -0
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +14 -42
- package/src/core/binary/align_32.d.ts +7 -0
- package/src/core/binary/align_32.d.ts.map +1 -0
- package/src/core/binary/align_32.js +8 -0
- package/src/core/binary/align_32.spec.d.ts +2 -0
- package/src/core/binary/align_32.spec.d.ts.map +1 -0
- package/src/core/binary/align_32.spec.js +11 -0
- package/src/core/binary/align_4.js +2 -1
- package/src/core/binary/lsb_32.d.ts +9 -0
- package/src/core/binary/lsb_32.d.ts.map +1 -0
- package/src/core/binary/lsb_32.js +12 -0
- package/src/core/binary/msb_32.d.ts +2 -0
- package/src/core/binary/msb_32.d.ts.map +1 -0
- package/src/core/binary/msb_32.js +20 -0
- package/src/core/binary/msb_lut_de_bruijn.d.ts +7 -0
- package/src/core/binary/msb_lut_de_bruijn.d.ts.map +1 -0
- package/src/core/binary/msb_lut_de_bruijn.js +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.js +2 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts +12 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js +40 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.js +27 -0
- package/src/core/geom/vec/vector_copy.d.ts +10 -0
- package/src/core/geom/vec/vector_copy.d.ts.map +1 -0
- package/src/core/geom/vec/vector_copy.js +13 -0
- package/src/core/{math/vector_nd_dot.d.ts → geom/vec/vector_dot.d.ts} +2 -2
- package/src/core/geom/vec/vector_dot.d.ts.map +1 -0
- package/src/core/{math/vector_nd_dot.js → geom/vec/vector_dot.js} +1 -1
- package/src/core/{math/vector_nd_normalize.d.ts → geom/vec/vector_normalize.d.ts} +2 -2
- package/src/core/geom/vec/vector_normalize.d.ts.map +1 -0
- package/src/core/{math/vector_nd_normalize.js → geom/vec/vector_normalize.js} +1 -1
- package/src/core/geom/vec/vector_normalize.spec.d.ts +2 -0
- package/src/core/geom/vec/vector_normalize.spec.d.ts.map +1 -0
- package/src/core/{math/vector_nd_normalize.spec.js → geom/vec/vector_normalize.spec.js} +3 -3
- package/src/core/geom/vec/vector_scale_array.d.ts +11 -0
- package/src/core/geom/vec/vector_scale_array.d.ts.map +1 -0
- package/src/core/geom/vec/vector_scale_array.js +31 -0
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +18 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -1
- package/src/engine/graphics/sh3/fromCubeRenderTarget.js +14 -17
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +3 -2
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +21 -11
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +8 -15
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +19 -3
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +11 -1
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -1
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +33 -16
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.d.ts.map +1 -1
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +6 -6
- package/src/core/math/vector_nd_dot.d.ts.map +0 -1
- package/src/core/math/vector_nd_normalize.d.ts.map +0 -1
- package/src/core/math/vector_nd_normalize.spec.d.ts +0 -2
- package/src/core/math/vector_nd_normalize.spec.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromCubeRenderTarget.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/fromCubeRenderTarget.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fromCubeRenderTarget.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/fromCubeRenderTarget.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,2CALW,UAAU,YACV,MAAM,aAAa,oBACnB,MAAM,qBAAqB,GAC1B,YAAY,CAgIvB"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { sh3_basis_at } from "../../../core/geom/3d/sphere/harmonics/sh3_basis_at.js";
|
|
2
2
|
import { sh3_dering_optimize_positive } from "../../../core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js";
|
|
3
|
+
import { sh3_vector_accumulate } from "../../../core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js";
|
|
4
|
+
import { vector_scale_array } from "../../../core/geom/vec/vector_scale_array.js";
|
|
3
5
|
import { v3_length_sqr } from "../../../core/geom/vec3/v3_length_sqr.js";
|
|
4
6
|
|
|
7
|
+
const scratch_color = new Float32Array(3);
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
*
|
|
7
11
|
* @param {Uint8Array} data
|
|
@@ -110,20 +114,17 @@ export function fromCubeRenderTarget(
|
|
|
110
114
|
// 0.003921 constant value is 1/255, a conversion value from UINT8 to normalized float
|
|
111
115
|
const weight_conv = weight * 0.00392156862745098;
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
scratch_color[0] = data[i] * weight_conv;
|
|
118
|
+
scratch_color[1] = data[i + 1] * weight_conv;
|
|
119
|
+
scratch_color[2] = data[i + 2] * weight_conv;
|
|
116
120
|
|
|
117
121
|
// accumulate
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
coefficients[j3 + 2] += sh_basis[j] * color_b;
|
|
125
|
-
|
|
126
|
-
}
|
|
122
|
+
sh3_vector_accumulate(
|
|
123
|
+
coefficients, 0,
|
|
124
|
+
sh_basis, 0,
|
|
125
|
+
scratch_color, 0,
|
|
126
|
+
3
|
|
127
|
+
);
|
|
127
128
|
|
|
128
129
|
}
|
|
129
130
|
|
|
@@ -132,11 +133,7 @@ export function fromCubeRenderTarget(
|
|
|
132
133
|
// normalize
|
|
133
134
|
const norm = (4 * Math.PI) / total_weight;
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
coefficients[j] *= norm;
|
|
138
|
-
|
|
139
|
-
}
|
|
136
|
+
vector_scale_array(coefficients, 0, coefficients, 0, 27, norm);
|
|
140
137
|
|
|
141
138
|
sh3_dering_optimize_positive(coefficients, 0, coefficients, 0, 3);
|
|
142
139
|
|
|
@@ -40,11 +40,11 @@ export class LightProbeVolume {
|
|
|
40
40
|
bake(ecd: EntityComponentDataset): TaskGroup;
|
|
41
41
|
/**
|
|
42
42
|
*
|
|
43
|
-
* @param {EntityComponentDataset} ecd
|
|
44
43
|
* @param {number} size
|
|
45
44
|
* @param {boolean} shadow
|
|
45
|
+
* @returns {EntityNode}
|
|
46
46
|
*/
|
|
47
|
-
visualize_probes({
|
|
47
|
+
visualize_probes({ size, shadow }: number): EntityNode;
|
|
48
48
|
/**
|
|
49
49
|
*
|
|
50
50
|
* @param {EntityComponentDataset} ecd
|
|
@@ -62,4 +62,5 @@ export class LightProbeVolume {
|
|
|
62
62
|
}
|
|
63
63
|
import { TetrahedralMesh } from "../../../../core/geom/3d/tetrahedra/TetrahedralMesh.js";
|
|
64
64
|
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
65
|
+
import { EntityNode } from "../../../ecs/parent/EntityNode.js";
|
|
65
66
|
//# sourceMappingURL=LightProbeVolume.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightProbeVolume.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolume.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LightProbeVolume.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolume.js"],"names":[],"mappings":"AA6DA;IAGI,sBAEC;IAGG,mBAAqB;IAErB,wBAAmC;IAEnC,oBAAsB;IAEtB,iBAAiB;IAGrB,cAQC;IAED;;;OAGG;IACH,4BAEC;IAED,oBAEC;IAED,uBAEC;IAMD,uBAEC;IAND,oBAEC;IAMD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,mBAJW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAIhB;IAED;;OAEG;IACH,mBAaC;IAGD;;;;OAIG;IACH,mCAHa,SAAS,CA8CrB;IAED;;;;;OAKG;IACH,mCAJW,MAAM,GAEJ,UAAU,CAsBtB;IAED;;;;;OAKG;IACH,sEAkBC;IAED;;;;OAIG;IACH,oCAFa,SAAS,CAKrB;;CACJ;gCA1Q+B,wDAAwD;sBAClE,4CAA4C;2BAKvC,mCAAmC"}
|
|
@@ -12,11 +12,12 @@ import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
|
12
12
|
import { countTask } from "../../../../core/process/task/util/countTask.js";
|
|
13
13
|
import { promiseTask } from "../../../../core/process/task/util/promiseTask.js";
|
|
14
14
|
import Entity from "../../../ecs/Entity.js";
|
|
15
|
+
import { EntityNode } from "../../../ecs/parent/EntityNode.js";
|
|
15
16
|
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
16
17
|
import { DrawMode } from "../../ecs/mesh-v2/DrawMode.js";
|
|
17
18
|
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
18
19
|
import { ShadedGeometryFlags } from "../../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
19
|
-
import {
|
|
20
|
+
import { sh3_make_shaded_geometry } from "../visualise_spherical_harmonic_sphere.js";
|
|
20
21
|
import { PathTracerProbeRenderer } from "./PathTracerProbeRenderer.js";
|
|
21
22
|
|
|
22
23
|
|
|
@@ -210,21 +211,30 @@ export class LightProbeVolume {
|
|
|
210
211
|
|
|
211
212
|
/**
|
|
212
213
|
*
|
|
213
|
-
* @param {EntityComponentDataset} ecd
|
|
214
214
|
* @param {number} size
|
|
215
215
|
* @param {boolean} shadow
|
|
216
|
+
* @returns {EntityNode}
|
|
216
217
|
*/
|
|
217
|
-
visualize_probes({
|
|
218
|
+
visualize_probes({ size = 0.2, shadow = false }) {
|
|
219
|
+
const parent = new EntityNode();
|
|
220
|
+
parent.entity.add(new Transform());
|
|
221
|
+
|
|
218
222
|
for (let i = 0; i < this.__length; i++) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
const probe_node = new EntityNode();
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
probe_node.entity.add(new Transform());
|
|
227
|
+
probe_node.entity.add(
|
|
228
|
+
sh3_make_shaded_geometry(this.__probe_data, i * 3 * 9, shadow)
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
probe_node.transform.position.fromArray(this.__positions, i * 3);
|
|
232
|
+
probe_node.transform.scale.setScalar(size);
|
|
233
|
+
|
|
234
|
+
parent.addChild(probe_node);
|
|
227
235
|
}
|
|
236
|
+
|
|
237
|
+
return parent;
|
|
228
238
|
}
|
|
229
239
|
|
|
230
240
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAyBA;IACI,mBAA0B;IAC1B,qBAAmB;IACnB,qBAAyB;IAEzB,uBAA6B;IAE7B,iFAkCC;IASD,4BAsCC;CACJ;8BAlG6B,oBAAoB;2BADvB,8BAA8B;gCADzB,mCAAmC"}
|
|
@@ -3,7 +3,9 @@ import { sh3_basis_at } from "../../../../core/geom/3d/sphere/harmonics/sh3_basi
|
|
|
3
3
|
import {
|
|
4
4
|
sh3_dering_optimize_positive
|
|
5
5
|
} from "../../../../core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js";
|
|
6
|
+
import { sh3_vector_accumulate } from "../../../../core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js";
|
|
6
7
|
import { randomPointOnSphere } from "../../../../core/geom/random/randomPointOnSphere.js";
|
|
8
|
+
import { vector_scale_array } from "../../../../core/geom/vec/vector_scale_array.js";
|
|
7
9
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
8
10
|
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
9
11
|
import { Light } from "../../ecs/light/Light.js";
|
|
@@ -47,26 +49,17 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
47
49
|
sh3_basis_at(ray[3], ray[4], ray[5], sh_basis);
|
|
48
50
|
|
|
49
51
|
// accumulate
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
coefficients[j3] += projected_coefficient * sampled_irradiance[0];
|
|
57
|
-
coefficients[j3 + 1] += projected_coefficient * sampled_irradiance[1];
|
|
58
|
-
coefficients[j3 + 2] += projected_coefficient * sampled_irradiance[2];
|
|
59
|
-
|
|
60
|
-
}
|
|
52
|
+
sh3_vector_accumulate(
|
|
53
|
+
coefficients, 0,
|
|
54
|
+
sh_basis, 0,
|
|
55
|
+
sampled_irradiance, 0, 3
|
|
56
|
+
);
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
// Area of a unit sphere is (4*PI)
|
|
64
|
-
|
|
65
60
|
const normalization_weight = (4 * Math.PI) / this.sample_count;
|
|
66
61
|
|
|
67
|
-
|
|
68
|
-
coefficients[i] *= normalization_weight;
|
|
69
|
-
}
|
|
62
|
+
vector_scale_array(coefficients, 0, coefficients, 0, 27, normalization_weight);
|
|
70
63
|
|
|
71
64
|
sh3_dering_optimize_positive(coefficients, 0, coefficients, 0, 3);
|
|
72
65
|
|
|
@@ -368,13 +368,13 @@ async function main(engine) {
|
|
|
368
368
|
// const path = 'data/models/samples/cyberpunk_bike/scene.gltf';
|
|
369
369
|
// const path = 'data/models/samples/sd_macross_city_standoff_diorama/scene.gltf';
|
|
370
370
|
// const path = 'data/models/Slaughter Mech/Slaugter Mech.gltf';
|
|
371
|
-
const path = 'data/models/samples/gi_box_01/model.glb';
|
|
372
371
|
// const path = 'data/models/samples/gi_box_01/model-thick-1.glb';
|
|
373
372
|
// const path = 'data/models/sibenik/3-window-less/model.gltf';
|
|
374
373
|
// const path = 'data/models/samples/ancient_bath_house_-_modular_set/scene.gltf';
|
|
375
374
|
// const path = 'data/models/samples/environment_-_library/scene.gltf';
|
|
376
375
|
// const path = 'data/models/samples/the_attic_environment/scene1.gltf';
|
|
377
|
-
|
|
376
|
+
const path = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
377
|
+
// const path = 'data/models/samples/gi_box_01/model.glb';
|
|
378
378
|
|
|
379
379
|
const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
|
|
380
380
|
const gltf = mesh_asset.gltf;
|
|
@@ -483,7 +483,9 @@ async function main(engine) {
|
|
|
483
483
|
transformer.update();
|
|
484
484
|
|
|
485
485
|
|
|
486
|
-
volume.visualize_probes({
|
|
486
|
+
const probe_viz = volume.visualize_probes({ size: model_footprint * 0.002 });
|
|
487
|
+
probe_viz.build(ecd);
|
|
488
|
+
|
|
487
489
|
// volume.visualize_mesh({ ecd, opacity: 0.5 });
|
|
488
490
|
|
|
489
491
|
const gui = new GUI();
|
|
@@ -497,6 +499,19 @@ async function main(engine) {
|
|
|
497
499
|
}
|
|
498
500
|
}, "capture_camera");
|
|
499
501
|
|
|
502
|
+
gui.add({
|
|
503
|
+
get probe_vis() {
|
|
504
|
+
return probe_viz.isBuilt
|
|
505
|
+
},
|
|
506
|
+
set probe_vis(v){
|
|
507
|
+
if(v){
|
|
508
|
+
probe_viz.build(ecd);
|
|
509
|
+
}else{
|
|
510
|
+
probe_viz.destroy();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}, "probe_vis").name("Visualise Probes");
|
|
514
|
+
|
|
500
515
|
|
|
501
516
|
// mesh_entity.addEventListener(SGMeshEvents.AssetLoaded, build);
|
|
502
517
|
//
|
|
@@ -511,6 +526,7 @@ new EngineHarness().initialize({
|
|
|
511
526
|
shadowResolution: 8192
|
|
512
527
|
}));
|
|
513
528
|
config.addSystem(new SGMeshSystem(engine));
|
|
529
|
+
config.addSystem(new TransformAttachmentSystem());
|
|
514
530
|
config.addSystem(new GUIElementSystem(engine.gui.view, engine));
|
|
515
531
|
config.addSystem(new ViewportPositionSystem(engine.gui.view.size));
|
|
516
532
|
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} sh
|
|
4
|
+
* @param {number} sh_offset
|
|
5
|
+
* @param {boolean} shadow
|
|
6
|
+
* @returns {ShadedGeometry}
|
|
7
|
+
*/
|
|
8
|
+
export function sh3_make_shaded_geometry(sh: number[], sh_offset: number, shadow: boolean): ShadedGeometry;
|
|
1
9
|
/**
|
|
2
10
|
*
|
|
3
11
|
* @param {number} [size]
|
|
@@ -6,8 +14,10 @@
|
|
|
6
14
|
* @param [position_offset]
|
|
7
15
|
* @param sh
|
|
8
16
|
* @param [sh_offset]
|
|
17
|
+
* @param {Entity} [entity]
|
|
9
18
|
* @return {Entity}
|
|
10
19
|
*/
|
|
11
|
-
export function visualise_spherical_harmonic_sphere({ size, shadow, position, position_offset, sh, sh_offset }?: number): Entity;
|
|
20
|
+
export function visualise_spherical_harmonic_sphere({ size, shadow, position, position_offset, sh, sh_offset, entity }?: number): Entity;
|
|
21
|
+
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
12
22
|
import Entity from "../../ecs/Entity.js";
|
|
13
23
|
//# sourceMappingURL=visualise_spherical_harmonic_sphere.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visualise_spherical_harmonic_sphere.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"visualise_spherical_harmonic_sphere.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,6CALW,MAAM,EAAE,aACR,MAAM,UACN,OAAO,GACL,cAAc,CAmB1B;AAED;;;;;;;;;;GAUG;AACH,yHATW,MAAM,GAOL,MAAM,CA0BjB;+BAnE8B,kCAAkC;mBAF9C,qBAAqB"}
|
|
@@ -7,6 +7,32 @@ import { SH3VisualisationMaterial } from "./SH3VisualisationMaterial.js";
|
|
|
7
7
|
|
|
8
8
|
const geometry = new OctahedronBufferGeometry(1, 5);
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number[]} sh
|
|
13
|
+
* @param {number} sh_offset
|
|
14
|
+
* @param {boolean} shadow
|
|
15
|
+
* @returns {ShadedGeometry}
|
|
16
|
+
*/
|
|
17
|
+
export function sh3_make_shaded_geometry(sh, sh_offset, shadow) {
|
|
18
|
+
const mat = new SH3VisualisationMaterial();
|
|
19
|
+
|
|
20
|
+
const uniform_value = mat.uniforms.sh.value;
|
|
21
|
+
for (let i = 0; i < 9; i++) {
|
|
22
|
+
uniform_value[i].fromArray(sh, sh_offset + i * 3);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const shadedGeometry = ShadedGeometry.from(geometry, mat);
|
|
26
|
+
|
|
27
|
+
// prevent instanced rendering
|
|
28
|
+
shadedGeometry.setFlag(ShadedGeometryFlags.DrawMethodLocked);
|
|
29
|
+
|
|
30
|
+
shadedGeometry.writeFlag(ShadedGeometryFlags.ReceiveShadow, shadow);
|
|
31
|
+
shadedGeometry.writeFlag(ShadedGeometryFlags.CastShadow, shadow);
|
|
32
|
+
|
|
33
|
+
return shadedGeometry;
|
|
34
|
+
}
|
|
35
|
+
|
|
10
36
|
/**
|
|
11
37
|
*
|
|
12
38
|
* @param {number} [size]
|
|
@@ -15,6 +41,7 @@ const geometry = new OctahedronBufferGeometry(1, 5);
|
|
|
15
41
|
* @param [position_offset]
|
|
16
42
|
* @param sh
|
|
17
43
|
* @param [sh_offset]
|
|
44
|
+
* @param {Entity} [entity]
|
|
18
45
|
* @return {Entity}
|
|
19
46
|
*/
|
|
20
47
|
export function visualise_spherical_harmonic_sphere({
|
|
@@ -23,25 +50,13 @@ export function visualise_spherical_harmonic_sphere({
|
|
|
23
50
|
position,
|
|
24
51
|
position_offset = 0,
|
|
25
52
|
sh,
|
|
26
|
-
sh_offset = 0
|
|
53
|
+
sh_offset = 0,
|
|
54
|
+
entity = new Entity()
|
|
27
55
|
}) {
|
|
28
56
|
|
|
29
|
-
const
|
|
57
|
+
const shadedGeometry = sh3_make_shaded_geometry(sh, sh_offset, shadow);
|
|
30
58
|
|
|
31
|
-
|
|
32
|
-
for (let i = 0; i < 9; i++) {
|
|
33
|
-
uniform_value[i].fromArray(sh, sh_offset + i * 3);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const shadedGeometry = ShadedGeometry.from(geometry, mat);
|
|
37
|
-
|
|
38
|
-
// prevent instanced rendering
|
|
39
|
-
shadedGeometry.setFlag(ShadedGeometryFlags.DrawMethodLocked);
|
|
40
|
-
|
|
41
|
-
shadedGeometry.writeFlag(ShadedGeometryFlags.ReceiveShadow, shadow);
|
|
42
|
-
shadedGeometry.writeFlag(ShadedGeometryFlags.CastShadow, shadow);
|
|
43
|
-
|
|
44
|
-
return new Entity()
|
|
59
|
+
entity
|
|
45
60
|
.add(Transform.fromJSON({
|
|
46
61
|
position: {
|
|
47
62
|
x: position[position_offset],
|
|
@@ -51,4 +66,6 @@ export function visualise_spherical_harmonic_sphere({
|
|
|
51
66
|
scale: size
|
|
52
67
|
}))
|
|
53
68
|
.add(shadedGeometry);
|
|
69
|
+
|
|
70
|
+
return entity;
|
|
54
71
|
}
|
package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainSoundMaterialSurfaceDetector.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js"],"names":[],"mappings":"AAWA;IACI,cAyBC;IArBG;;;OAGG;IACH,WAFU,iCAAiC,CAExB;IAEnB;;;;OAIG;IACH,kBAAqB;IAGrB;;;;OAIG;IACH,oBAAiD;IAIrD,uCAUC;IAED;;;OAGG;IACH,mCAuBC;IAED;;;;OAIG;IACH,8BAHW,MAAM,mDAUhB;IAED,wDAyBC;CACJ;
|
|
1
|
+
{"version":3,"file":"TerrainSoundMaterialSurfaceDetector.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js"],"names":[],"mappings":"AAWA;IACI,cAyBC;IArBG;;;OAGG;IACH,WAFU,iCAAiC,CAExB;IAEnB;;;;OAIG;IACH,kBAAqB;IAGrB;;;;OAIG;IACH,oBAAiD;IAIrD,uCAUC;IAED;;;OAGG;IACH,mCAuBC;IAED;;;;OAIG;IACH,8BAHW,MAAM,mDAUhB;IAED,wDAyBC;CACJ;6CAjH4C,oCAAoC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import { vector_normalize } from "../../../../../core/geom/vec/vector_normalize.js";
|
|
2
3
|
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
3
|
-
import {
|
|
4
|
+
import { deserializeSoundMaterialFromJSON } from "../../concrete/json/deserializeSoundMaterialFromJSON.js";
|
|
4
5
|
import { SilentSoundMaterial } from "../../concrete/SilentSoundMaterial.js";
|
|
5
6
|
import { SingleSoundMaterial } from "../../concrete/SingleSoundMaterial.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { vector_nd_normalize } from "../../../../../core/math/vector_nd_normalize.js";
|
|
7
|
+
import { SoundMaterialComposition } from "../../concrete/SoundMaterialComposition.js";
|
|
8
|
+
import { SoundMaterialSurfaceDetector } from "../SoundMaterialSurfaceDetector.js";
|
|
9
9
|
|
|
10
10
|
const v2_temp = new Vector2();
|
|
11
11
|
|
|
@@ -112,7 +112,7 @@ export class TerrainSoundMaterialSurfaceDetector extends SoundMaterialSurfaceDet
|
|
|
112
112
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
vector_normalize(this.__composite.weights, this.__composite.weights, layer_count);
|
|
116
116
|
|
|
117
117
|
const additions = this.__composite.computeInteractionSounds(result, 0, interaction);
|
|
118
118
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector_nd_dot.d.ts","sourceRoot":"","sources":["../../../../src/core/math/vector_nd_dot.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,iCALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,GACL,MAAM,CAUjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector_nd_normalize.d.ts","sourceRoot":"","sources":["../../../../src/core/math/vector_nd_normalize.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,4CAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,WAClC,MAAM,QAoBhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector_nd_normalize.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/math/vector_nd_normalize.spec.js"],"names":[],"mappings":""}
|