@onerjs/core 8.51.7 → 8.51.9
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/AudioV2/abstractAudio/audioEngineV2.d.ts +34 -1
- package/AudioV2/abstractAudio/audioEngineV2.js +54 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +12 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +18 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
- package/AudioV2/abstractAudio/index.d.ts +1 -0
- package/AudioV2/abstractAudio/index.js +1 -0
- package/AudioV2/abstractAudio/index.js.map +1 -1
- package/AudioV2/abstractAudio/pure.d.ts +1 -0
- package/AudioV2/abstractAudio/pure.js +1 -0
- package/AudioV2/abstractAudio/pure.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +7 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +12 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +14 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +4 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +12 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +2 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +4 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +2 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Engines/abstractEngine.pure.js +11 -4
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.pure.d.ts +23 -0
- package/Engines/engine.pure.js +96 -1
- package/Engines/engine.pure.js.map +1 -1
- package/Engines/nativeEngine.pure.d.ts +4 -0
- package/Engines/nativeEngine.pure.js +6 -0
- package/Engines/nativeEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +21 -0
- package/Engines/thinNativeEngine.pure.js +119 -4
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +21 -0
- package/Engines/webgpuEngine.pure.js +46 -1
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/Gizmos/index.d.ts +1 -0
- package/Gizmos/index.js +1 -0
- package/Gizmos/index.js.map +1 -1
- package/Gizmos/pure.d.ts +1 -0
- package/Gizmos/pure.js +1 -0
- package/Gizmos/pure.js.map +1 -1
- package/Gizmos/spatialAudioGizmo.d.ts +55 -0
- package/Gizmos/spatialAudioGizmo.js +151 -0
- package/Gizmos/spatialAudioGizmo.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +5 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +54 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +11 -1
- package/Materials/Textures/internalTexture.js +16 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +42 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +93 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/instancedMesh.pure.js +1 -1
- package/Meshes/instancedMesh.pure.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +54 -5
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +14 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +56 -5
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +14 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/SmartAssets/index.d.ts +2 -2
- package/SmartAssets/index.js +2 -1
- package/SmartAssets/index.js.map +1 -1
- package/SmartAssets/pure.d.ts +1 -1
- package/SmartAssets/pure.js +2 -1
- package/SmartAssets/pure.js.map +1 -1
- package/SmartAssets/smartAssetManager.js +9 -0
- package/SmartAssets/smartAssetManager.js.map +1 -1
- package/package.json +1 -1
package/Gizmos/index.d.ts
CHANGED
package/Gizmos/index.js
CHANGED
package/Gizmos/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./axisDragGizmo\";\r\nexport * from \"./axisScaleGizmo\";\r\nexport * from \"./boundingBoxGizmo\";\r\nexport * from \"./gizmo\";\r\nexport * from \"./gizmoManager\";\r\nexport * from \"./planeRotationGizmo\";\r\nexport * from \"./positionGizmo\";\r\nexport * from \"./rotationGizmo\";\r\nexport * from \"./scaleGizmo\";\r\nexport * from \"./lightGizmo\";\r\nexport * from \"./cameraGizmo\";\r\nexport * from \"./planeDragGizmo\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from \"./axisDragGizmo\";\r\nexport * from \"./axisScaleGizmo\";\r\nexport * from \"./boundingBoxGizmo\";\r\nexport * from \"./gizmo\";\r\nexport * from \"./gizmoManager\";\r\nexport * from \"./planeRotationGizmo\";\r\nexport * from \"./positionGizmo\";\r\nexport * from \"./rotationGizmo\";\r\nexport * from \"./scaleGizmo\";\r\nexport * from \"./lightGizmo\";\r\nexport * from \"./cameraGizmo\";\r\nexport * from \"./planeDragGizmo\";\r\nexport * from \"./spatialAudioGizmo\";\r\n"]}
|
package/Gizmos/pure.d.ts
CHANGED
package/Gizmos/pure.js
CHANGED
package/Gizmos/pure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./axisDragGizmo\";\nexport * from \"./axisScaleGizmo\";\nexport * from \"./boundingBoxGizmo\";\nexport * from \"./gizmo\";\nexport * from \"./gizmoManager\";\nexport * from \"./planeRotationGizmo.pure\";\nexport * from \"./positionGizmo\";\nexport * from \"./rotationGizmo\";\nexport * from \"./scaleGizmo\";\nexport * from \"./lightGizmo\";\nexport * from \"./cameraGizmo\";\nexport * from \"./planeDragGizmo\";\n"]}
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./axisDragGizmo\";\nexport * from \"./axisScaleGizmo\";\nexport * from \"./boundingBoxGizmo\";\nexport * from \"./gizmo\";\nexport * from \"./gizmoManager\";\nexport * from \"./planeRotationGizmo.pure\";\nexport * from \"./positionGizmo\";\nexport * from \"./rotationGizmo\";\nexport * from \"./scaleGizmo\";\nexport * from \"./lightGizmo\";\nexport * from \"./cameraGizmo\";\nexport * from \"./planeDragGizmo\";\nexport * from \"./spatialAudioGizmo\";\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Nullable } from "../types.js";
|
|
2
|
+
import { Mesh } from "../Meshes/mesh.js";
|
|
3
|
+
import { type IGizmo, Gizmo } from "./gizmo.js";
|
|
4
|
+
import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer.js";
|
|
5
|
+
import { StandardMaterial } from "../Materials/standardMaterial.js";
|
|
6
|
+
import { type PointerInfo } from "../Events/pointerEvents.js";
|
|
7
|
+
import { type Observer, Observable } from "../Misc/observable.js";
|
|
8
|
+
import { type AbstractSoundSource } from "../AudioV2/abstractAudio/abstractSoundSource.js";
|
|
9
|
+
/**
|
|
10
|
+
* Interface for a spatial audio gizmo.
|
|
11
|
+
*/
|
|
12
|
+
export interface ISpatialAudioGizmo extends IGizmo {
|
|
13
|
+
/** Event that fires each time the gizmo is clicked. */
|
|
14
|
+
onClickedObservable: Observable<AbstractSoundSource>;
|
|
15
|
+
/** The sound source the gizmo is attached to. */
|
|
16
|
+
soundSource: Nullable<AbstractSoundSource>;
|
|
17
|
+
/** The material used to render the gizmo. */
|
|
18
|
+
readonly material: StandardMaterial;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gizmo that visualizes the position and orientation of a v2 spatial sound source.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SpatialAudioGizmo extends Gizmo implements ISpatialAudioGizmo {
|
|
24
|
+
private static readonly _Scale;
|
|
25
|
+
protected _soundSource: Nullable<AbstractSoundSource>;
|
|
26
|
+
protected _audioMesh: Mesh;
|
|
27
|
+
protected _material: StandardMaterial;
|
|
28
|
+
protected _pointerObserver: Nullable<Observer<PointerInfo>>;
|
|
29
|
+
/** Event that fires each time the gizmo is clicked. */
|
|
30
|
+
readonly onClickedObservable: Observable<AbstractSoundSource>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a SpatialAudioGizmo.
|
|
33
|
+
* @param gizmoLayer The utility layer the gizmo will be added to.
|
|
34
|
+
*/
|
|
35
|
+
constructor(gizmoLayer?: UtilityLayerRenderer);
|
|
36
|
+
/**
|
|
37
|
+
* The sound source the gizmo is attached to.
|
|
38
|
+
*/
|
|
39
|
+
get soundSource(): Nullable<AbstractSoundSource>;
|
|
40
|
+
set soundSource(soundSource: Nullable<AbstractSoundSource>);
|
|
41
|
+
/**
|
|
42
|
+
* Gets the material used to render the gizmo.
|
|
43
|
+
*/
|
|
44
|
+
get material(): StandardMaterial;
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
* Mirrors the attached mesh to the sound source's spatial position and rotation.
|
|
48
|
+
*/
|
|
49
|
+
protected _update(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Disposes of the gizmo.
|
|
52
|
+
*/
|
|
53
|
+
dispose(): void;
|
|
54
|
+
private static _CreateSpeakerMesh;
|
|
55
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Quaternion, TmpVectors } from "../Maths/math.vector.js";
|
|
2
|
+
import { Color3 } from "../Maths/math.color.js";
|
|
3
|
+
import { Mesh } from "../Meshes/mesh.js";
|
|
4
|
+
import { Gizmo } from "./gizmo.js";
|
|
5
|
+
import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer.js";
|
|
6
|
+
import { StandardMaterial } from "../Materials/standardMaterial.js";
|
|
7
|
+
import { CreateCylinder } from "../Meshes/Builders/cylinderBuilder.js";
|
|
8
|
+
import { CreateSphere } from "../Meshes/Builders/sphereBuilder.js";
|
|
9
|
+
import { PointerEventTypes } from "../Events/pointerEvents.js";
|
|
10
|
+
import { Observable } from "../Misc/observable.js";
|
|
11
|
+
/**
|
|
12
|
+
* Gizmo that visualizes the position and orientation of a v2 spatial sound source.
|
|
13
|
+
*/
|
|
14
|
+
export class SpatialAudioGizmo extends Gizmo {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a SpatialAudioGizmo.
|
|
17
|
+
* @param gizmoLayer The utility layer the gizmo will be added to.
|
|
18
|
+
*/
|
|
19
|
+
constructor(gizmoLayer = UtilityLayerRenderer.DefaultUtilityLayer) {
|
|
20
|
+
super(gizmoLayer);
|
|
21
|
+
this._soundSource = null;
|
|
22
|
+
this._pointerObserver = null;
|
|
23
|
+
/** Event that fires each time the gizmo is clicked. */
|
|
24
|
+
this.onClickedObservable = new Observable();
|
|
25
|
+
const utilityScene = this.gizmoLayer.utilityLayerScene;
|
|
26
|
+
// Parent under _rootMesh so super.dispose() — which only disposes _rootMesh —
|
|
27
|
+
// also tears down our attachedMesh and avoids leaking it in the utility layer scene.
|
|
28
|
+
this.attachedMesh = new Mesh("spatialAudioGizmo", utilityScene);
|
|
29
|
+
this.attachedMesh.parent = this._rootMesh;
|
|
30
|
+
this._material = new StandardMaterial("spatialAudio", utilityScene);
|
|
31
|
+
this._material.diffuseColor = new Color3(0.5, 0.5, 0.5);
|
|
32
|
+
this._material.specularColor = new Color3(0.1, 0.1, 0.1);
|
|
33
|
+
this._audioMesh = SpatialAudioGizmo._CreateSpeakerMesh(utilityScene);
|
|
34
|
+
this._audioMesh.parent = this._rootMesh;
|
|
35
|
+
for (const child of this._audioMesh.getChildMeshes(false)) {
|
|
36
|
+
child.material = this._material;
|
|
37
|
+
}
|
|
38
|
+
const gizmoLight = this.gizmoLayer._getSharedGizmoLight();
|
|
39
|
+
gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._audioMesh.getChildMeshes(false));
|
|
40
|
+
this._pointerObserver = utilityScene.onPointerObservable.add((pointerInfo) => {
|
|
41
|
+
if (!this._soundSource) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const picked = pointerInfo.pickInfo?.pickedMesh;
|
|
45
|
+
this._isHovered = !!picked && this._rootMesh.getChildMeshes().indexOf(picked) !== -1;
|
|
46
|
+
if (this._isHovered && pointerInfo.type === PointerEventTypes.POINTERDOWN && pointerInfo.event.button === 0) {
|
|
47
|
+
this.onClickedObservable.notifyObservers(this._soundSource);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The sound source the gizmo is attached to.
|
|
53
|
+
*/
|
|
54
|
+
get soundSource() {
|
|
55
|
+
return this._soundSource;
|
|
56
|
+
}
|
|
57
|
+
set soundSource(soundSource) {
|
|
58
|
+
var _a;
|
|
59
|
+
this._soundSource = soundSource;
|
|
60
|
+
if (soundSource && this.attachedMesh) {
|
|
61
|
+
if (!this.attachedMesh.reservedDataStore) {
|
|
62
|
+
this.attachedMesh.reservedDataStore = {};
|
|
63
|
+
}
|
|
64
|
+
this.attachedMesh.reservedDataStore.spatialAudioGizmo = this;
|
|
65
|
+
(_a = this.attachedMesh).rotationQuaternion ?? (_a.rotationQuaternion = new Quaternion());
|
|
66
|
+
this._update();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets the material used to render the gizmo.
|
|
71
|
+
*/
|
|
72
|
+
get material() {
|
|
73
|
+
return this._material;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
* Mirrors the attached mesh to the sound source's spatial position and rotation.
|
|
78
|
+
*/
|
|
79
|
+
_update() {
|
|
80
|
+
super._update();
|
|
81
|
+
const source = this._soundSource;
|
|
82
|
+
const attachedMesh = this.attachedMesh;
|
|
83
|
+
if (!source || !attachedMesh || !source._isSpatial) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
attachedMesh.rotationQuaternion ?? (attachedMesh.rotationQuaternion = new Quaternion());
|
|
87
|
+
// When the sound is attached to a scene node, the actual world transform is on the node;
|
|
88
|
+
// the spatial facade only caches the most recent user-set position/rotation. Decompose
|
|
89
|
+
// the node's world matrix directly so the gizmo tracks movement of the attached entity,
|
|
90
|
+
// and honor the spatial sub-property's attachment options (useBoundingBox, attachmentType).
|
|
91
|
+
const spatial = source.spatial;
|
|
92
|
+
const attachedNode = spatial.attachedNode;
|
|
93
|
+
if (attachedNode) {
|
|
94
|
+
const worldRotation = TmpVectors.Quaternion[0];
|
|
95
|
+
const worldPosition = TmpVectors.Vector3[0];
|
|
96
|
+
attachedNode.getWorldMatrix().decompose(undefined, worldRotation, worldPosition);
|
|
97
|
+
if (spatial.attachmentType & 1 /* SpatialAudioAttachmentType.Position */) {
|
|
98
|
+
if (spatial.useBoundingBox && attachedNode.getBoundingInfo) {
|
|
99
|
+
attachedMesh.position.copyFrom(attachedNode.getBoundingInfo().boundingBox.centerWorld);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
attachedMesh.position.copyFrom(worldPosition);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
attachedMesh.position.copyFrom(spatial.position);
|
|
107
|
+
}
|
|
108
|
+
if (spatial.attachmentType & 2 /* SpatialAudioAttachmentType.Rotation */) {
|
|
109
|
+
attachedMesh.rotationQuaternion.copyFrom(worldRotation);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
attachedMesh.rotationQuaternion.copyFrom(spatial.rotationQuaternion);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
attachedMesh.position.copyFrom(spatial.position);
|
|
117
|
+
attachedMesh.rotationQuaternion.copyFrom(spatial.rotationQuaternion);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Disposes of the gizmo.
|
|
122
|
+
*/
|
|
123
|
+
dispose() {
|
|
124
|
+
this.onClickedObservable.clear();
|
|
125
|
+
this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);
|
|
126
|
+
this._material.dispose();
|
|
127
|
+
// _audioMesh and attachedMesh are children of _rootMesh, so super.dispose() handles them.
|
|
128
|
+
super.dispose();
|
|
129
|
+
}
|
|
130
|
+
static _CreateSpeakerMesh(scene) {
|
|
131
|
+
const root = new Mesh("spatialAudioRoot", scene);
|
|
132
|
+
// Spherical body for the source point.
|
|
133
|
+
const body = CreateSphere("spatialAudioBody", { diameter: 1, segments: 8 }, scene);
|
|
134
|
+
body.parent = root;
|
|
135
|
+
// A flared cone pointing along +Z to indicate the sound's facing direction.
|
|
136
|
+
const cone = CreateCylinder("spatialAudioCone", {
|
|
137
|
+
height: 1.4,
|
|
138
|
+
diameterTop: 1.6,
|
|
139
|
+
diameterBottom: 0.2,
|
|
140
|
+
tessellation: 12,
|
|
141
|
+
subdivisions: 1,
|
|
142
|
+
}, scene);
|
|
143
|
+
cone.parent = root;
|
|
144
|
+
cone.rotation.x = Math.PI / 2;
|
|
145
|
+
cone.position.z = 0.9;
|
|
146
|
+
root.scaling.scaleInPlace(SpatialAudioGizmo._Scale);
|
|
147
|
+
return root;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
SpatialAudioGizmo._Scale = 0.035;
|
|
151
|
+
//# sourceMappingURL=spatialAudioGizmo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatialAudioGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/spatialAudioGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAoB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAiB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiB/D;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAWxC;;;OAGG;IACH,YA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B,EACD,KAAK,CACR,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;QAEtB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;;AA9JuB,wBAAM,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { type IGizmo, Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { type PointerInfo, PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type AbstractSoundSource } from \"../AudioV2/abstractAudio/abstractSoundSource\";\r\nimport { SpatialAudioAttachmentType } from \"../AudioV2/spatialAudioAttachmentType\";\r\n\r\n/**\r\n * Interface for a spatial audio gizmo.\r\n */\r\nexport interface ISpatialAudioGizmo extends IGizmo {\r\n /** Event that fires each time the gizmo is clicked. */\r\n onClickedObservable: Observable<AbstractSoundSource>;\r\n /** The sound source the gizmo is attached to. */\r\n soundSource: Nullable<AbstractSoundSource>;\r\n /** The material used to render the gizmo. */\r\n readonly material: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Gizmo that visualizes the position and orientation of a v2 spatial sound source.\r\n */\r\nexport class SpatialAudioGizmo extends Gizmo implements ISpatialAudioGizmo {\r\n private static readonly _Scale = 0.035;\r\n\r\n protected _soundSource: Nullable<AbstractSoundSource> = null;\r\n protected _audioMesh: Mesh;\r\n protected _material: StandardMaterial;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n\r\n /** Event that fires each time the gizmo is clicked. */\r\n public readonly onClickedObservable = new Observable<AbstractSoundSource>();\r\n\r\n /**\r\n * Creates a SpatialAudioGizmo.\r\n * @param gizmoLayer The utility layer the gizmo will be added to.\r\n */\r\n constructor(gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer) {\r\n super(gizmoLayer);\r\n\r\n const utilityScene = this.gizmoLayer.utilityLayerScene;\r\n\r\n // Parent under _rootMesh so super.dispose() — which only disposes _rootMesh —\r\n // also tears down our attachedMesh and avoids leaking it in the utility layer scene.\r\n this.attachedMesh = new Mesh(\"spatialAudioGizmo\", utilityScene);\r\n this.attachedMesh.parent = this._rootMesh;\r\n\r\n this._material = new StandardMaterial(\"spatialAudio\", utilityScene);\r\n this._material.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n this._material.specularColor = new Color3(0.1, 0.1, 0.1);\r\n\r\n this._audioMesh = SpatialAudioGizmo._CreateSpeakerMesh(utilityScene);\r\n this._audioMesh.parent = this._rootMesh;\r\n for (const child of this._audioMesh.getChildMeshes(false)) {\r\n child.material = this._material;\r\n }\r\n\r\n const gizmoLight = this.gizmoLayer._getSharedGizmoLight();\r\n gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._audioMesh.getChildMeshes(false));\r\n\r\n this._pointerObserver = utilityScene.onPointerObservable.add((pointerInfo) => {\r\n if (!this._soundSource) {\r\n return;\r\n }\r\n const picked = pointerInfo.pickInfo?.pickedMesh;\r\n this._isHovered = !!picked && this._rootMesh.getChildMeshes().indexOf(picked as Mesh) !== -1;\r\n if (this._isHovered && pointerInfo.type === PointerEventTypes.POINTERDOWN && pointerInfo.event.button === 0) {\r\n this.onClickedObservable.notifyObservers(this._soundSource);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * The sound source the gizmo is attached to.\r\n */\r\n public get soundSource(): Nullable<AbstractSoundSource> {\r\n return this._soundSource;\r\n }\r\n\r\n public set soundSource(soundSource: Nullable<AbstractSoundSource>) {\r\n this._soundSource = soundSource;\r\n if (soundSource && this.attachedMesh) {\r\n if (!this.attachedMesh.reservedDataStore) {\r\n this.attachedMesh.reservedDataStore = {};\r\n }\r\n this.attachedMesh.reservedDataStore.spatialAudioGizmo = this;\r\n this.attachedMesh.rotationQuaternion ??= new Quaternion();\r\n this._update();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the material used to render the gizmo.\r\n */\r\n public get material(): StandardMaterial {\r\n return this._material;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Mirrors the attached mesh to the sound source's spatial position and rotation.\r\n */\r\n protected override _update(): void {\r\n super._update();\r\n\r\n const source = this._soundSource;\r\n const attachedMesh = this.attachedMesh;\r\n if (!source || !attachedMesh || !source._isSpatial) {\r\n return;\r\n }\r\n\r\n attachedMesh.rotationQuaternion ??= new Quaternion();\r\n\r\n // When the sound is attached to a scene node, the actual world transform is on the node;\r\n // the spatial facade only caches the most recent user-set position/rotation. Decompose\r\n // the node's world matrix directly so the gizmo tracks movement of the attached entity,\r\n // and honor the spatial sub-property's attachment options (useBoundingBox, attachmentType).\r\n const spatial = source.spatial;\r\n const attachedNode = spatial.attachedNode;\r\n if (attachedNode) {\r\n const worldRotation = TmpVectors.Quaternion[0];\r\n const worldPosition = TmpVectors.Vector3[0];\r\n attachedNode.getWorldMatrix().decompose(undefined, worldRotation, worldPosition);\r\n\r\n if (spatial.attachmentType & SpatialAudioAttachmentType.Position) {\r\n if (spatial.useBoundingBox && (attachedNode as AbstractMesh).getBoundingInfo) {\r\n attachedMesh.position.copyFrom((attachedNode as AbstractMesh).getBoundingInfo().boundingBox.centerWorld);\r\n } else {\r\n attachedMesh.position.copyFrom(worldPosition);\r\n }\r\n } else {\r\n attachedMesh.position.copyFrom(spatial.position);\r\n }\r\n\r\n if (spatial.attachmentType & SpatialAudioAttachmentType.Rotation) {\r\n attachedMesh.rotationQuaternion.copyFrom(worldRotation);\r\n } else {\r\n attachedMesh.rotationQuaternion.copyFrom(spatial.rotationQuaternion);\r\n }\r\n } else {\r\n attachedMesh.position.copyFrom(spatial.position);\r\n attachedMesh.rotationQuaternion.copyFrom(spatial.rotationQuaternion);\r\n }\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo.\r\n */\r\n public override dispose(): void {\r\n this.onClickedObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this._material.dispose();\r\n // _audioMesh and attachedMesh are children of _rootMesh, so super.dispose() handles them.\r\n super.dispose();\r\n }\r\n\r\n private static _CreateSpeakerMesh(scene: Scene): Mesh {\r\n const root = new Mesh(\"spatialAudioRoot\", scene);\r\n\r\n // Spherical body for the source point.\r\n const body = CreateSphere(\"spatialAudioBody\", { diameter: 1, segments: 8 }, scene);\r\n body.parent = root;\r\n\r\n // A flared cone pointing along +Z to indicate the sound's facing direction.\r\n const cone = CreateCylinder(\r\n \"spatialAudioCone\",\r\n {\r\n height: 1.4,\r\n diameterTop: 1.6,\r\n diameterBottom: 0.2,\r\n tessellation: 12,\r\n subdivisions: 1,\r\n },\r\n scene\r\n );\r\n cone.parent = root;\r\n cone.rotation.x = Math.PI / 2;\r\n cone.position.z = 0.9;\r\n\r\n root.scaling.scaleInPlace(SpatialAudioGizmo._Scale);\r\n return root;\r\n }\r\n}\r\n"]}
|
|
@@ -100,6 +100,11 @@ export declare class GaussianSplattingMaterial extends PushMaterial {
|
|
|
100
100
|
* @param scene scene that contains mesh and camera used for rendering
|
|
101
101
|
*/
|
|
102
102
|
static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void;
|
|
103
|
+
/**
|
|
104
|
+
* Bind SOG dequantization uniforms + raw textures.
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
protected static _BindSogUniforms(gsMesh: GaussianSplattingMesh, effect: Effect): void;
|
|
103
108
|
/**
|
|
104
109
|
* Binds the submesh to this material by preparing the effect and shader to draw
|
|
105
110
|
* @param world defines the world transformation matrix
|
|
@@ -69,6 +69,10 @@ class GaussianSplattingMaterialDefines extends MaterialDefines {
|
|
|
69
69
|
this.IS_COMPOUND = false;
|
|
70
70
|
/** Defines the maximum number of parts (computed from engine caps at runtime) */
|
|
71
71
|
this.MAX_PART_COUNT = GaussianSplattingMaxPartCount;
|
|
72
|
+
/** Defines whether SOG raw-texture in-shader dequantization is enabled */
|
|
73
|
+
this.USE_SOG = false;
|
|
74
|
+
/** Defines whether SOG v2 (codebook) dequantization is enabled */
|
|
75
|
+
this.USE_SOG_V2 = false;
|
|
72
76
|
this.rebuild();
|
|
73
77
|
}
|
|
74
78
|
}
|
|
@@ -188,6 +192,8 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
188
192
|
}
|
|
189
193
|
defines["IS_COMPOUND"] = gsMesh.isCompound;
|
|
190
194
|
defines["MAX_PART_COUNT"] = GetGaussianSplattingMaxPartCount(engine);
|
|
195
|
+
defines["USE_SOG"] = gsMesh.useSog;
|
|
196
|
+
defines["USE_SOG_V2"] = gsMesh.useSog && gsMesh.sogParams?.version === 2;
|
|
191
197
|
// Compensation
|
|
192
198
|
const splatMaterial = gsMesh.material;
|
|
193
199
|
defines["COMPENSATION"] = splatMaterial && splatMaterial.compensation ? splatMaterial.compensation : GaussianSplattingMaterial.Compensation;
|
|
@@ -315,7 +321,10 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
315
321
|
effect.setTexture("covariancesBTexture", gsMesh.covariancesBTexture);
|
|
316
322
|
effect.setTexture("centersTexture", gsMesh.centersTexture);
|
|
317
323
|
effect.setTexture("colorsTexture", gsMesh.colorsTexture);
|
|
318
|
-
if (gsMesh.
|
|
324
|
+
if (gsMesh.useSog) {
|
|
325
|
+
GaussianSplattingMaterial._BindSogUniforms(gsMesh, effect);
|
|
326
|
+
}
|
|
327
|
+
else if (gsMesh.shTextures) {
|
|
319
328
|
for (let i = 0; i < gsMesh.shTextures.length; i++) {
|
|
320
329
|
effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);
|
|
321
330
|
}
|
|
@@ -324,6 +333,37 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
324
333
|
gsMesh.bindExtraEffectUniforms(effect);
|
|
325
334
|
}
|
|
326
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* Bind SOG dequantization uniforms + raw textures.
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
static _BindSogUniforms(gsMesh, effect) {
|
|
341
|
+
const p = gsMesh.sogParams;
|
|
342
|
+
if (!p) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
effect.setTexture("sogQuatsTexture", gsMesh.rotationsATexture);
|
|
346
|
+
if (gsMesh.shTextures && gsMesh.shTextures.length >= 2) {
|
|
347
|
+
effect.setTexture("sogShNCentroidsTexture", gsMesh.shTextures[0]);
|
|
348
|
+
effect.setTexture("sogShNLabelsTexture", gsMesh.shTextures[1]);
|
|
349
|
+
}
|
|
350
|
+
if (p.codebookTexture) {
|
|
351
|
+
effect.setTexture("sogCodebookTexture", p.codebookTexture);
|
|
352
|
+
}
|
|
353
|
+
effect.setFloat3("sogMeansMin", p.meansMin[0], p.meansMin[1], p.meansMin[2]);
|
|
354
|
+
effect.setFloat3("sogMeansMax", p.meansMax[0], p.meansMax[1], p.meansMax[2]);
|
|
355
|
+
if (p.scalesMin && p.scalesMax) {
|
|
356
|
+
effect.setFloat3("sogScalesMin", p.scalesMin[0], p.scalesMin[1], p.scalesMin[2]);
|
|
357
|
+
effect.setFloat3("sogScalesMax", p.scalesMax[0], p.scalesMax[1], p.scalesMax[2]);
|
|
358
|
+
}
|
|
359
|
+
if (p.sh0Min && p.sh0Max) {
|
|
360
|
+
effect.setFloat4("sogSh0Min", p.sh0Min[0], p.sh0Min[1], p.sh0Min[2], p.sh0Min[3]);
|
|
361
|
+
effect.setFloat4("sogSh0Max", p.sh0Max[0], p.sh0Max[1], p.sh0Max[2], p.sh0Max[3]);
|
|
362
|
+
}
|
|
363
|
+
effect.setFloat("sogShnMin", p.shnMin ?? 0);
|
|
364
|
+
effect.setFloat("sogShnMax", p.shnMax ?? 0);
|
|
365
|
+
effect.setFloat("sogShCoeffCount", p.shCoeffCount ?? 0);
|
|
366
|
+
}
|
|
327
367
|
/**
|
|
328
368
|
* Binds the submesh to this material by preparing the effect and shader to draw
|
|
329
369
|
* @param world defines the world transformation matrix
|
|
@@ -642,6 +682,10 @@ GaussianSplattingMaterial._Samplers = [
|
|
|
642
682
|
"shTexture3",
|
|
643
683
|
"shTexture4",
|
|
644
684
|
"partIndicesTexture",
|
|
685
|
+
"sogQuatsTexture",
|
|
686
|
+
"sogShNCentroidsTexture",
|
|
687
|
+
"sogShNLabelsTexture",
|
|
688
|
+
"sogCodebookTexture",
|
|
645
689
|
];
|
|
646
690
|
GaussianSplattingMaterial._UniformBuffers = ["Scene", "Mesh"];
|
|
647
691
|
GaussianSplattingMaterial._VoxelUniforms = [
|
|
@@ -674,6 +718,15 @@ GaussianSplattingMaterial._Uniforms = [
|
|
|
674
718
|
"depthValues",
|
|
675
719
|
"partWorld",
|
|
676
720
|
"partVisibility",
|
|
721
|
+
"sogMeansMin",
|
|
722
|
+
"sogMeansMax",
|
|
723
|
+
"sogScalesMin",
|
|
724
|
+
"sogScalesMax",
|
|
725
|
+
"sogSh0Min",
|
|
726
|
+
"sogSh0Max",
|
|
727
|
+
"sogShnMin",
|
|
728
|
+
"sogShnMax",
|
|
729
|
+
"sogShCoeffCount",
|
|
677
730
|
];
|
|
678
731
|
let _Registered = false;
|
|
679
732
|
/**
|