@babylonjs/core 9.9.1 → 9.10.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/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 +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +16 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +2 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +5 -2
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.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/Layers/selectionOutlineLayer.pure.d.ts +9 -2
- package/Layers/selectionOutlineLayer.pure.js +29 -6
- package/Layers/selectionOutlineLayer.pure.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +1 -0
- package/Layers/thinEffectLayer.js +7 -4
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +17 -3
- package/Layers/thinSelectionOutlineLayer.js +82 -17
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- 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/PBR/openpbrMaterial.pure.d.ts +13 -0
- package/Materials/PBR/openpbrMaterial.pure.js +17 -0
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js +3 -2
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +32 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +180 -22
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +54 -10
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +130 -13
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.d.ts +5 -1
- package/Meshes/abstractMesh.pure.js +92 -2
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +143 -2
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.types.d.ts +2 -1
- package/Meshes/thinInstanceMesh.types.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +12 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.js +8 -0
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.js +4 -2
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +54 -5
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +14 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingVoxel.vertex.js +1 -0
- package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/Shaders/selectionOutline.fragment.js +16 -4
- package/Shaders/selectionOutline.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +56 -5
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +2 -3
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +14 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +1 -0
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/ShadersWGSL/selectionOutline.fragment.js +14 -2
- package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
- package/XR/features/WebXRBodyTracking.pure.d.ts +16 -0
- package/XR/features/WebXRBodyTracking.pure.js +167 -30
- package/XR/features/WebXRBodyTracking.pure.js.map +1 -1
- package/package.json +1 -1
|
@@ -45,6 +45,9 @@ export declare class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRende
|
|
|
45
45
|
/** The occlusion threshold */
|
|
46
46
|
get occlusionThreshold(): number;
|
|
47
47
|
set occlusionThreshold(value: number);
|
|
48
|
+
/** Whether to use depth when drawing selection outlines */
|
|
49
|
+
get useDepthOcclusion(): boolean;
|
|
50
|
+
set useDepthOcclusion(value: boolean);
|
|
48
51
|
/**
|
|
49
52
|
* Gets the current class name
|
|
50
53
|
* @returns the class name
|
|
@@ -34,7 +34,7 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
34
34
|
this.registerInput("target", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);
|
|
35
35
|
this.registerInput("layer", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);
|
|
36
36
|
this.registerInput("objectRenderer", NodeRenderGraphBlockConnectionPointTypes.Object, false, new NodeRenderGraphConnectionPointCustomObject("objectRenderer", this, 0 /* NodeRenderGraphConnectionPointDirection.Input */, NodeRenderGraphBaseObjectRendererBlock, "NodeRenderGraphBaseObjectRendererBlock"));
|
|
37
|
-
this.registerInput("depth", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);
|
|
37
|
+
this.registerInput("depth", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);
|
|
38
38
|
this.depth.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureViewDepth | NodeRenderGraphBlockConnectionPointTypes.TextureNormalizedViewDepth);
|
|
39
39
|
this._addDependenciesInput();
|
|
40
40
|
this.registerOutput("output", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);
|
|
@@ -52,6 +52,7 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
52
52
|
const outlineThickness = this.outlineThickness;
|
|
53
53
|
const occlusionStrength = this.occlusionStrength;
|
|
54
54
|
const occlusionThreshold = this.occlusionThreshold;
|
|
55
|
+
const useDepthOcclusion = this.useDepthOcclusion;
|
|
55
56
|
this._frameGraphTask?.dispose();
|
|
56
57
|
this._frameGraphTask = new FrameGraphSelectionOutlineLayerTask(this.name, this._frameGraph, this._scene, {
|
|
57
58
|
mainTextureRatio: layerTextureRatio,
|
|
@@ -62,6 +63,7 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
62
63
|
this.outlineThickness = outlineThickness;
|
|
63
64
|
this.occlusionStrength = occlusionStrength;
|
|
64
65
|
this.occlusionThreshold = occlusionThreshold;
|
|
66
|
+
this.useDepthOcclusion = useDepthOcclusion;
|
|
65
67
|
this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, layerTextureType];
|
|
66
68
|
}
|
|
67
69
|
/** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */
|
|
@@ -116,6 +118,13 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
116
118
|
set occlusionThreshold(value) {
|
|
117
119
|
this._frameGraphTask.layer.occlusionThreshold = value;
|
|
118
120
|
}
|
|
121
|
+
/** Whether to use depth when drawing selection outlines */
|
|
122
|
+
get useDepthOcclusion() {
|
|
123
|
+
return this._frameGraphTask.layer.useDepthOcclusion;
|
|
124
|
+
}
|
|
125
|
+
set useDepthOcclusion(value) {
|
|
126
|
+
this._frameGraphTask.layer.useDepthOcclusion = value;
|
|
127
|
+
}
|
|
119
128
|
/**
|
|
120
129
|
* Gets the current class name
|
|
121
130
|
* @returns the class name
|
|
@@ -167,6 +176,7 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
167
176
|
codes.push(`${this._codeVariableName}.outlineThickness = ${this.outlineThickness};`);
|
|
168
177
|
codes.push(`${this._codeVariableName}.occlusionStrength = ${this.occlusionStrength};`);
|
|
169
178
|
codes.push(`${this._codeVariableName}.occlusionThreshold = ${this.occlusionThreshold};`);
|
|
179
|
+
codes.push(`${this._codeVariableName}.useDepthOcclusion = ${this.useDepthOcclusion};`);
|
|
170
180
|
return super._dumpPropertiesCode() + codes.join("\n");
|
|
171
181
|
}
|
|
172
182
|
serialize() {
|
|
@@ -175,6 +185,7 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
175
185
|
serializationObject.outlineThickness = this.outlineThickness;
|
|
176
186
|
serializationObject.occlusionStrength = this.occlusionStrength;
|
|
177
187
|
serializationObject.occlusionThreshold = this.occlusionThreshold;
|
|
188
|
+
serializationObject.useDepthOcclusion = this.useDepthOcclusion;
|
|
178
189
|
return serializationObject;
|
|
179
190
|
}
|
|
180
191
|
_deserialize(serializationObject) {
|
|
@@ -183,6 +194,7 @@ export class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBl
|
|
|
183
194
|
this.outlineThickness = serializationObject.outlineThickness;
|
|
184
195
|
this.occlusionStrength = serializationObject.occlusionStrength;
|
|
185
196
|
this.occlusionThreshold = serializationObject.occlusionThreshold;
|
|
197
|
+
this.useDepthOcclusion = serializationObject.useDepthOcclusion ?? true;
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
200
|
__decorate([
|
|
@@ -206,6 +218,9 @@ __decorate([
|
|
|
206
218
|
__decorate([
|
|
207
219
|
editableInPropertyPage("Occlusion threshold", 1 /* PropertyTypeForEdition.Float */, "PROPERTIES", { min: 0, max: 1 })
|
|
208
220
|
], NodeRenderGraphSelectionOutlineLayerBlock.prototype, "occlusionThreshold", null);
|
|
221
|
+
__decorate([
|
|
222
|
+
editableInPropertyPage("Use depth occlusion", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES")
|
|
223
|
+
], NodeRenderGraphSelectionOutlineLayerBlock.prototype, "useDepthOcclusion", null);
|
|
209
224
|
let _Registered = false;
|
|
210
225
|
/**
|
|
211
226
|
* Register side effects for selectionOutlineLayerBlock.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionOutlineLayerBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAU7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,mCAAmC,EAAE,MAAM,mDAAmD,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC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E,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;mFAG7G;AAuFL,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,kCAAkC;IAC9C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,mDAAmD,EAAE,yCAAyC,CAAC,CAAC;AAClH,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport {\r\n type Scene,\r\n type NodeRenderGraphBuildState,\r\n type FrameGraph,\r\n type FrameGraphTextureHandle,\r\n type NodeRenderGraphConnectionPoint,\r\n type FrameGraphObjectRendererTask,\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphSelectionOutlineLayerTask } from \"core/FrameGraph/Tasks/Layers/selectionOutlineTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\nimport { Color3 } from \"core/Maths/math.color.pure\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\n/**\r\n * Block that implements the selection outline layer\r\n */\r\nexport class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphSelectionOutlineLayerTask;\r\n\r\n public override _additionalConstructionParameters: [number, number | undefined, number];\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphSelectionOutlineLayerBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 1.0)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_HALF_FLOAT)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layerTextureRatio = 1.0,\r\n layerTextureFixedSize?: number,\r\n layerTextureType = Constants.TEXTURETYPE_HALF_FLOAT\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n false,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this.registerInput(\"depth\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.depth.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.TextureViewDepth | NodeRenderGraphBlockConnectionPointTypes.TextureNormalizedViewDepth\r\n );\r\n\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphSelectionOutlineLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(layerTextureRatio: number, layerTextureFixedSize: number, layerTextureType: number) {\r\n const outlineColor = this.outlineColor;\r\n const outlineThickness = this.outlineThickness;\r\n const occlusionStrength = this.occlusionStrength;\r\n const occlusionThreshold = this.occlusionThreshold;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphSelectionOutlineLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.outlineColor = outlineColor;\r\n this.outlineThickness = outlineThickness;\r\n this.occlusionStrength = occlusionStrength;\r\n this.occlusionThreshold = occlusionThreshold;\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, value);\r\n }\r\n\r\n /** The outline color */\r\n @editableInPropertyPage(\"Outline color\", PropertyTypeForEdition.Color3, \"PROPERTIES\")\r\n public get outlineColor() {\r\n return this._frameGraphTask.layer.outlineColor;\r\n }\r\n\r\n public set outlineColor(value: Color3) {\r\n this._frameGraphTask.layer.outlineColor = value;\r\n }\r\n\r\n /** The thickness of the edges */\r\n @editableInPropertyPage(\"Outline thickness\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 30 })\r\n public get outlineThickness() {\r\n return this._frameGraphTask.layer.outlineThickness;\r\n }\r\n\r\n public set outlineThickness(value: number) {\r\n this._frameGraphTask.layer.outlineThickness = value;\r\n }\r\n\r\n /** The strength of the occlusion effect */\r\n @editableInPropertyPage(\"Occlusion strength\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 1 })\r\n public get occlusionStrength() {\r\n return this._frameGraphTask.layer.occlusionStrength;\r\n }\r\n\r\n public set occlusionStrength(value: number) {\r\n this._frameGraphTask.layer.occlusionStrength = value;\r\n }\r\n\r\n /** The occlusion threshold */\r\n @editableInPropertyPage(\"Occlusion threshold\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 1 })\r\n public get occlusionThreshold() {\r\n return this._frameGraphTask.layer.occlusionThreshold;\r\n }\r\n\r\n public set occlusionThreshold(value: number) {\r\n this._frameGraphTask.layer.occlusionThreshold = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphSelectionOutlineLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer texture input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the depth input component\r\n */\r\n public get depth(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n this._frameGraphTask.depthTexture = this.depth.connectedPoint?.value as FrameGraphTextureHandle;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.outlineColor = new BABYLON.Color3(${this.outlineColor.r}, ${this.outlineColor.g}, ${this.outlineColor.b});`);\r\n codes.push(`${this._codeVariableName}.outlineThickness = ${this.outlineThickness};`);\r\n codes.push(`${this._codeVariableName}.occlusionStrength = ${this.occlusionStrength};`);\r\n codes.push(`${this._codeVariableName}.occlusionThreshold = ${this.occlusionThreshold};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.outlineColor = this.outlineColor.asArray();\r\n serializationObject.outlineThickness = this.outlineThickness;\r\n serializationObject.occlusionStrength = this.occlusionStrength;\r\n serializationObject.occlusionThreshold = this.occlusionThreshold;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.outlineColor = Color3.FromArray(serializationObject.outlineColor);\r\n this.outlineThickness = serializationObject.outlineThickness;\r\n this.occlusionStrength = serializationObject.occlusionStrength;\r\n this.occlusionThreshold = serializationObject.occlusionThreshold;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for selectionOutlineLayerBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterSelectionOutlineLayerBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.NodeRenderGraphSelectionOutlineLayerBlock\", NodeRenderGraphSelectionOutlineLayerBlock);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"selectionOutlineLayerBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAU7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,mCAAmC,EAAE,MAAM,mDAAmD,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4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,wCAAgC,YAAY,CAAC;kFAGzF;AAUD;IADC,sBAAsB,CAAC,0BAA0B,wCAAgC,YAAY,CAAC;sFAG9F;AAUD;IADC,sBAAsB,CAAC,oBAAoB,+CAAsC,YAAY,CAAC;iFAG9F;AAUD;IADC,sBAAsB,CAAC,eAAe,yCAAiC,YAAY,CAAC;6EAGpF;AAQD;IADC,sBAAsB,CAAC,mBAAmB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;iFAG5G;AAQD;IADC,sBAAsB,CAAC,oBAAoB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;kFAG5G;AAQD;IADC,sBAAsB,CAAC,qBAAqB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;mFAG7G;AAQD;IADC,sBAAsB,CAAC,qBAAqB,0CAAkC,YAAY,CAAC;kFAG3F;AA0FL,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,kCAAkC;IAC9C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,mDAAmD,EAAE,yCAAyC,CAAC,CAAC;AAClH,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport {\r\n type Scene,\r\n type NodeRenderGraphBuildState,\r\n type FrameGraph,\r\n type FrameGraphTextureHandle,\r\n type NodeRenderGraphConnectionPoint,\r\n type FrameGraphObjectRendererTask,\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphSelectionOutlineLayerTask } from \"core/FrameGraph/Tasks/Layers/selectionOutlineTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\nimport { Color3 } from \"core/Maths/math.color.pure\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\n/**\r\n * Block that implements the selection outline layer\r\n */\r\nexport class NodeRenderGraphSelectionOutlineLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphSelectionOutlineLayerTask;\r\n\r\n public override _additionalConstructionParameters: [number, number | undefined, number];\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphSelectionOutlineLayerBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 1.0)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_HALF_FLOAT)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layerTextureRatio = 1.0,\r\n layerTextureFixedSize?: number,\r\n layerTextureType = Constants.TEXTURETYPE_HALF_FLOAT\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n false,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this.registerInput(\"depth\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n\r\n this.depth.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.TextureViewDepth | NodeRenderGraphBlockConnectionPointTypes.TextureNormalizedViewDepth\r\n );\r\n\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphSelectionOutlineLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(layerTextureRatio: number, layerTextureFixedSize: number, layerTextureType: number) {\r\n const outlineColor = this.outlineColor;\r\n const outlineThickness = this.outlineThickness;\r\n const occlusionStrength = this.occlusionStrength;\r\n const occlusionThreshold = this.occlusionThreshold;\r\n const useDepthOcclusion = this.useDepthOcclusion;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphSelectionOutlineLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.outlineColor = outlineColor;\r\n this.outlineThickness = outlineThickness;\r\n this.occlusionStrength = occlusionStrength;\r\n this.occlusionThreshold = occlusionThreshold;\r\n this.useDepthOcclusion = useDepthOcclusion;\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, value);\r\n }\r\n\r\n /** The outline color */\r\n @editableInPropertyPage(\"Outline color\", PropertyTypeForEdition.Color3, \"PROPERTIES\")\r\n public get outlineColor() {\r\n return this._frameGraphTask.layer.outlineColor;\r\n }\r\n\r\n public set outlineColor(value: Color3) {\r\n this._frameGraphTask.layer.outlineColor = value;\r\n }\r\n\r\n /** The thickness of the edges */\r\n @editableInPropertyPage(\"Outline thickness\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 30 })\r\n public get outlineThickness() {\r\n return this._frameGraphTask.layer.outlineThickness;\r\n }\r\n\r\n public set outlineThickness(value: number) {\r\n this._frameGraphTask.layer.outlineThickness = value;\r\n }\r\n\r\n /** The strength of the occlusion effect */\r\n @editableInPropertyPage(\"Occlusion strength\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 1 })\r\n public get occlusionStrength() {\r\n return this._frameGraphTask.layer.occlusionStrength;\r\n }\r\n\r\n public set occlusionStrength(value: number) {\r\n this._frameGraphTask.layer.occlusionStrength = value;\r\n }\r\n\r\n /** The occlusion threshold */\r\n @editableInPropertyPage(\"Occlusion threshold\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 1 })\r\n public get occlusionThreshold() {\r\n return this._frameGraphTask.layer.occlusionThreshold;\r\n }\r\n\r\n public set occlusionThreshold(value: number) {\r\n this._frameGraphTask.layer.occlusionThreshold = value;\r\n }\r\n\r\n /** Whether to use depth when drawing selection outlines */\r\n @editableInPropertyPage(\"Use depth occlusion\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get useDepthOcclusion() {\r\n return this._frameGraphTask.layer.useDepthOcclusion;\r\n }\r\n\r\n public set useDepthOcclusion(value: boolean) {\r\n this._frameGraphTask.layer.useDepthOcclusion = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphSelectionOutlineLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer texture input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the depth input component\r\n */\r\n public get depth(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n this._frameGraphTask.depthTexture = this.depth.connectedPoint?.value as FrameGraphTextureHandle;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.outlineColor = new BABYLON.Color3(${this.outlineColor.r}, ${this.outlineColor.g}, ${this.outlineColor.b});`);\r\n codes.push(`${this._codeVariableName}.outlineThickness = ${this.outlineThickness};`);\r\n codes.push(`${this._codeVariableName}.occlusionStrength = ${this.occlusionStrength};`);\r\n codes.push(`${this._codeVariableName}.occlusionThreshold = ${this.occlusionThreshold};`);\r\n codes.push(`${this._codeVariableName}.useDepthOcclusion = ${this.useDepthOcclusion};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.outlineColor = this.outlineColor.asArray();\r\n serializationObject.outlineThickness = this.outlineThickness;\r\n serializationObject.occlusionStrength = this.occlusionStrength;\r\n serializationObject.occlusionThreshold = this.occlusionThreshold;\r\n serializationObject.useDepthOcclusion = this.useDepthOcclusion;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.outlineColor = Color3.FromArray(serializationObject.outlineColor);\r\n this.outlineThickness = serializationObject.outlineThickness;\r\n this.occlusionStrength = serializationObject.occlusionStrength;\r\n this.occlusionThreshold = serializationObject.occlusionThreshold;\r\n this.useDepthOcclusion = serializationObject.useDepthOcclusion ?? true;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for selectionOutlineLayerBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterSelectionOutlineLayerBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.NodeRenderGraphSelectionOutlineLayerBlock\", NodeRenderGraphSelectionOutlineLayerBlock);\r\n}\r\n"]}
|
|
@@ -13,8 +13,9 @@ export declare class FrameGraphSelectionOutlineLayerTask extends FrameGraphBaseL
|
|
|
13
13
|
* The depth texture to use when rendering the selection outline layer.
|
|
14
14
|
* It must store the scene depth in camera view space Z, normalized or not.
|
|
15
15
|
* If not normalized, the storeCameraSpaceZ option must be passed to the constructor.
|
|
16
|
+
* Required only when layer.useDepthOcclusion is true and layer.occlusionStrength is greater than zero.
|
|
16
17
|
*/
|
|
17
|
-
depthTexture: FrameGraphTextureHandle;
|
|
18
|
+
depthTexture: FrameGraphTextureHandle | undefined;
|
|
18
19
|
/**
|
|
19
20
|
* Constructs a new selection outline layer task.
|
|
20
21
|
* @param name Name of the task.
|
|
@@ -22,12 +22,15 @@ export class FrameGraphSelectionOutlineLayerTask extends FrameGraphBaseLayerTask
|
|
|
22
22
|
return "FrameGraphSelectionOutlineLayerTask";
|
|
23
23
|
}
|
|
24
24
|
record() {
|
|
25
|
-
|
|
25
|
+
const useDepthOcclusion = this.layer.useDepthOcclusion && this.layer.occlusionStrength > 0;
|
|
26
|
+
if (useDepthOcclusion && this.depthTexture === undefined) {
|
|
26
27
|
throw new Error(`FrameGraphSelectionOutlineLayerTask "${this.name}": depthTexture is required`);
|
|
27
28
|
}
|
|
28
29
|
super.record(false, (context, effect) => {
|
|
29
|
-
context.bindTextureHandle(effect, "depthSampler", this.depthTexture);
|
|
30
30
|
context.bindTextureHandle(effect, "maskSampler", this._objectRendererForLayerTask.outputTexture);
|
|
31
|
+
if (useDepthOcclusion) {
|
|
32
|
+
context.bindTextureHandle(effect, "depthSampler", this.depthTexture);
|
|
33
|
+
}
|
|
31
34
|
});
|
|
32
35
|
this.layer.textureWidth = this._layerTextureDimensions.width;
|
|
33
36
|
this.layer.textureHeight = this._layerTextureDimensions.height;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionOutlineTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/selectionOutlineTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAA+B,MAAM,iBAAiB,CAAC;AAEvF;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,uBAAuB;
|
|
1
|
+
{"version":3,"file":"selectionOutlineTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/selectionOutlineTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAA+B,MAAM,iBAAiB,CAAC;AAEvF;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,uBAAuB;IAc5E;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAA2C;QACvG,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,yBAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,iDAAoC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAEpJ,IAAI,CAAC,2BAA2B,CAAC,UAAU,GAAG;YAC1C,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE;YACnC,eAAe,EAAE,EAAE;SACtB,CAAC;IACN,CAAC;IAEe,YAAY;QACxB,OAAO,qCAAqC,CAAC;IACjD,CAAC;IAEe,MAAM;QAClB,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAE3F,IAAI,iBAAiB,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,IAAI,6BAA6B,CAAC,CAAC;QACpG,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAgC,EAAE,MAAc,EAAE,EAAE;YACrE,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC;YACjG,IAAI,iBAAiB,EAAE,CAAC;gBACpB,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,YAAa,CAAC,CAAC;YAC1E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;QAC7D,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;IACnE,CAAC;CACJ","sourcesContent":["import { type FrameGraph, type Scene, type IThinSelectionOutlineLayerOptions, type FrameGraphTextureHandle, type Effect, type FrameGraphRenderContext } from \"core/index\";\r\nimport { ThinSelectionOutlineLayer } from \"core/Layers/thinSelectionOutlineLayer\";\r\nimport { FrameGraphBaseLayerTask, FrameGraphBaseLayerBlurType } from \"./baseLayerTask\";\r\n\r\n/**\r\n * Task which applies a selection outline effect to a texture.\r\n */\r\nexport class FrameGraphSelectionOutlineLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The selection outline layer object. Use this object to update the selection outline layer properties (e.g. intensity, blur kernel size).\r\n */\r\n public override readonly layer: ThinSelectionOutlineLayer;\r\n\r\n /**\r\n * The depth texture to use when rendering the selection outline layer.\r\n * It must store the scene depth in camera view space Z, normalized or not.\r\n * If not normalized, the storeCameraSpaceZ option must be passed to the constructor.\r\n * Required only when layer.useDepthOcclusion is true and layer.occlusionStrength is greater than zero.\r\n */\r\n public depthTexture: FrameGraphTextureHandle | undefined;\r\n\r\n /**\r\n * Constructs a new selection outline layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the selection outline layer in.\r\n * @param options Options for the selection outline layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinSelectionOutlineLayerOptions) {\r\n super(name, frameGraph, scene, new ThinSelectionOutlineLayer(name, scene, options, true), 0, FrameGraphBaseLayerBlurType.None, false, false, false);\r\n\r\n this._objectRendererForLayerTask.objectList = {\r\n meshes: this.layer._selection || [],\r\n particleSystems: [],\r\n };\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphSelectionOutlineLayerTask\";\r\n }\r\n\r\n public override record() {\r\n const useDepthOcclusion = this.layer.useDepthOcclusion && this.layer.occlusionStrength > 0;\r\n\r\n if (useDepthOcclusion && this.depthTexture === undefined) {\r\n throw new Error(`FrameGraphSelectionOutlineLayerTask \"${this.name}\": depthTexture is required`);\r\n }\r\n\r\n super.record(false, (context: FrameGraphRenderContext, effect: Effect) => {\r\n context.bindTextureHandle(effect, \"maskSampler\", this._objectRendererForLayerTask.outputTexture);\r\n if (useDepthOcclusion) {\r\n context.bindTextureHandle(effect, \"depthSampler\", this.depthTexture!);\r\n }\r\n });\r\n\r\n this.layer.textureWidth = this._layerTextureDimensions.width;\r\n this.layer.textureHeight = this._layerTextureDimensions.height;\r\n }\r\n}\r\n"]}
|
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","sour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,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpF,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,0FAA0F;QAC1F,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,KAAY;QAC1C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAEjD,uCAAuC;QACvC,MAAM,IAAI,GAAG,YAAY,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,4EAA4E;QAC5E,MAAM,IAAI,GAAG,cAAc,CACvB,kBAAkB,EAClB;YACI,MAAM,EAAE,GAAG;YACX,WAAW,EAAE,GAAG;YAChB,cAAc,EAAE,GAAG;YACnB,YAAY,EAAE,EAAE;YAChB,YAAY,EAAE,CAAC;SAClB,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"]}
|
|
@@ -49,6 +49,12 @@ export declare class SelectionOutlineLayer extends EffectLayer {
|
|
|
49
49
|
*/
|
|
50
50
|
get occlusionThreshold(): number;
|
|
51
51
|
set occlusionThreshold(value: number);
|
|
52
|
+
/**
|
|
53
|
+
* Whether to use depth when drawing selection outlines.
|
|
54
|
+
* Disable this to avoid depth renderer usage; selected outlines will not be clipped by scene or selected geometry.
|
|
55
|
+
*/
|
|
56
|
+
get useDepthOcclusion(): boolean;
|
|
57
|
+
set useDepthOcclusion(value: boolean);
|
|
52
58
|
private _options;
|
|
53
59
|
protected readonly _thinEffectLayer: ThinSelectionOutlineLayer;
|
|
54
60
|
/**
|
|
@@ -58,10 +64,11 @@ export declare class SelectionOutlineLayer extends EffectLayer {
|
|
|
58
64
|
* @param options Sets of none mandatory options to use with the layer (see ISelectionOutlineLayerOptions for more information)
|
|
59
65
|
*/
|
|
60
66
|
constructor(name: string, scene?: Scene, options?: Partial<ISelectionOutlineLayerOptions>);
|
|
67
|
+
private _enableDepthRenderer;
|
|
61
68
|
/**
|
|
62
69
|
* Checks if the layer is ready to render.
|
|
63
|
-
* When selections are active
|
|
64
|
-
* and checks that its depth map is ready.
|
|
70
|
+
* When selections are active and depth occlusion is enabled, this also
|
|
71
|
+
* lazily creates the depth renderer and checks that its depth map is ready.
|
|
65
72
|
* @returns true if the layer is ready
|
|
66
73
|
*/
|
|
67
74
|
isLayerReady(): boolean;
|