@babylonjs/core 7.37.0 → 7.37.2
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/Buffers/buffer.d.ts +3 -1
- package/Buffers/buffer.js +20 -122
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/bufferUtils.d.ts +32 -1
- package/Buffers/bufferUtils.js +221 -10
- package/Buffers/bufferUtils.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +3 -1
- package/Cameras/arcRotateCamera.js +14 -3
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +0 -4
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +1 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +2 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +3 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/Inputs/scene.inputManager.js +2 -0
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Lights/IES/iesLoader.d.ts +19 -0
- package/Lights/IES/iesLoader.js +150 -0
- package/Lights/IES/iesLoader.js.map +1 -0
- package/Lights/index.d.ts +1 -0
- package/Lights/index.js +1 -0
- package/Lights/index.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +5 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +21 -5
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +52 -176
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +158 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +177 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -0
- package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +4 -2
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +45 -25
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/matrixSplitterBlock.d.ts +56 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js +130 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js.map +1 -0
- package/Materials/Node/nodeMaterialBlock.js +1 -0
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -0
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +4 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +12 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/iesTextureLoader.d.ts +23 -0
- package/Materials/Textures/Loaders/iesTextureLoader.js +40 -0
- package/Materials/Textures/Loaders/iesTextureLoader.js.map +1 -0
- package/Materials/Textures/Loaders/index.d.ts +1 -0
- package/Materials/Textures/Loaders/index.js +1 -0
- package/Materials/Textures/Loaders/index.js.map +1 -1
- package/Materials/Textures/Loaders/textureLoaderManager.js +3 -0
- package/Materials/Textures/Loaders/textureLoaderManager.js.map +1 -1
- package/Materials/effectRenderer.js +1 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/index.d.ts +4 -0
- package/Materials/index.js +5 -0
- package/Materials/index.js.map +1 -1
- package/Maths/math.scalar.d.ts +0 -1
- package/Maths/math.scalar.js +1 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +2 -2
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +15 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +68 -20
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.d.ts +4 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js +8 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +1 -0
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -0
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +3 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.hotSpot.d.ts +8 -1
- package/Meshes/abstractMesh.hotSpot.js +17 -0
- package/Meshes/abstractMesh.hotSpot.js.map +1 -1
- package/Meshes/linesMesh.js +1 -1
- package/Meshes/linesMesh.js.map +1 -1
- package/Misc/deepMerger.d.ts +6 -0
- package/Misc/deepMerger.js +26 -0
- package/Misc/deepMerger.js.map +1 -0
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/virtualJoystick.js +2 -0
- package/Misc/virtualJoystick.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +3 -23
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +30 -67
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +8 -4
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/boundingBoxRenderer.d.ts +63 -1
- package/Rendering/boundingBoxRenderer.js +224 -3
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +4 -1
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.d.ts → iblCdfGenerator.d.ts} +15 -12
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.js → iblCdfGenerator.js} +37 -27
- package/Rendering/iblCdfGenerator.js.map +1 -0
- package/Rendering/iblCdfGeneratorSceneComponent.d.ts +59 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js +83 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -0
- package/Rendering/index.d.ts +12 -10
- package/Rendering/index.js +12 -10
- package/Rendering/index.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +72 -2
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -4
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/boundingBoxRenderer.vertex.js +7 -0
- package/Shaders/boundingBoxRenderer.vertex.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +16 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.d.ts → iblCdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/Shaders/iblCdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsCdfx.fragment.d.ts → iblCdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/Shaders/iblCdfy.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfx.fragment.d.ts → iblIcdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/Shaders/iblIcdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfy.fragment.d.ts → iblIcdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/Shaders/iblIcdfy.fragment.js.map +1 -0
- package/Shaders/importanceSamplingDebug.fragment.d.ts +5 -0
- package/Shaders/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/Shaders/importanceSamplingDebug.fragment.js.map +1 -0
- package/Shaders/pbr.fragment.js +8 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +77 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -4
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/boundingBoxRenderer.vertex.js +9 -1
- package/ShadersWGSL/boundingBoxRenderer.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +18 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/greasedLine.fragment.d.ts +5 -0
- package/ShadersWGSL/greasedLine.fragment.js +25 -0
- package/ShadersWGSL/greasedLine.fragment.js.map +1 -0
- package/ShadersWGSL/greasedLine.vertex.d.ts +9 -0
- package/ShadersWGSL/greasedLine.vertex.js +43 -0
- package/ShadersWGSL/greasedLine.vertex.js.map +1 -0
- package/ShadersWGSL/iblCdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblCdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfy.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfy.fragment.js.map +1 -0
- package/ShadersWGSL/importanceSamplingDebug.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/ShadersWGSL/importanceSamplingDebug.fragment.js.map +1 -0
- package/ShadersWGSL/pbr.fragment.js +12 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +4 -0
- package/scene.js +6 -0
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js +1 -1
- package/sceneComponent.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +0 -1
- package/Shaders/iblShadowsCdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsCdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Scene } from "../scene";
|
|
2
2
|
import { AbstractMesh } from "../Meshes/abstractMesh";
|
|
3
3
|
import { SmartArray } from "../Misc/smartArray";
|
|
4
|
+
import type { Nullable } from "../types";
|
|
4
5
|
import type { ISceneComponent } from "../sceneComponent";
|
|
5
|
-
import
|
|
6
|
+
import { BoundingBox } from "../Culling/boundingBox";
|
|
6
7
|
import { Color3 } from "../Maths/math.color";
|
|
7
8
|
import { Observable } from "../Misc/observable";
|
|
9
|
+
import { DrawWrapper } from "../Materials/drawWrapper";
|
|
8
10
|
import { ShaderLanguage } from "../Materials/shaderLanguage.js";
|
|
9
11
|
declare module "../scene" {
|
|
10
12
|
interface Scene {
|
|
@@ -60,10 +62,18 @@ export declare class BoundingBoxRenderer implements ISceneComponent {
|
|
|
60
62
|
showBackLines: boolean;
|
|
61
63
|
/**
|
|
62
64
|
* Observable raised before rendering a bounding box
|
|
65
|
+
* When {@link BoundingBoxRenderer.useInstances} enabled,
|
|
66
|
+
* this would only be triggered once for one rendering, instead of once every bounding box.
|
|
67
|
+
* Events would be triggered with a dummy box to keep backwards compatibility,
|
|
68
|
+
* the passed bounding box has no meaning and should be ignored.
|
|
63
69
|
*/
|
|
64
70
|
onBeforeBoxRenderingObservable: Observable<BoundingBox>;
|
|
65
71
|
/**
|
|
66
72
|
* Observable raised after rendering a bounding box
|
|
73
|
+
* When {@link BoundingBoxRenderer.useInstances} enabled,
|
|
74
|
+
* this would only be triggered once for one rendering, instead of once every bounding box.
|
|
75
|
+
* Events would be triggered with a dummy box to keep backwards compatibility,
|
|
76
|
+
* the passed bounding box has no meaning and should be ignored.
|
|
67
77
|
*/
|
|
68
78
|
onAfterBoxRenderingObservable: Observable<BoundingBox>;
|
|
69
79
|
/**
|
|
@@ -93,6 +103,19 @@ export declare class BoundingBoxRenderer implements ISceneComponent {
|
|
|
93
103
|
private _uniformBufferFront;
|
|
94
104
|
private _uniformBufferBack;
|
|
95
105
|
private _renderPassIdForOcclusionQuery;
|
|
106
|
+
/**
|
|
107
|
+
* Internal buffer for instanced rendering
|
|
108
|
+
*/
|
|
109
|
+
private _matrixBuffer;
|
|
110
|
+
private _matrices;
|
|
111
|
+
/**
|
|
112
|
+
* Internal state of whether instanced rendering enabled
|
|
113
|
+
*/
|
|
114
|
+
protected _useInstances: boolean;
|
|
115
|
+
/** @internal */
|
|
116
|
+
_drawWrapperFront: Nullable<DrawWrapper>;
|
|
117
|
+
/** @internal */
|
|
118
|
+
_drawWrapperBack: Nullable<DrawWrapper>;
|
|
96
119
|
/**
|
|
97
120
|
* Instantiates a new bounding box renderer in a scene.
|
|
98
121
|
* @param scene the scene the renderer renders in
|
|
@@ -127,6 +150,45 @@ export declare class BoundingBoxRenderer implements ISceneComponent {
|
|
|
127
150
|
* @param mesh Define the mesh to render the occlusion bounding box for
|
|
128
151
|
*/
|
|
129
152
|
renderOcclusionBoundingBox(mesh: AbstractMesh): void;
|
|
153
|
+
/**
|
|
154
|
+
* Sets whether to use instanced rendering.
|
|
155
|
+
* When not enabled, BoundingBoxRenderer renders in a loop,
|
|
156
|
+
* calling engine.drawElementsType for each bounding box in renderList,
|
|
157
|
+
* making every bounding box 1 or 2 draw call.
|
|
158
|
+
* When enabled, it collects bounding boxes to render,
|
|
159
|
+
* and render all boxes in 1 or 2 draw call.
|
|
160
|
+
* This could make the rendering with many bounding boxes much faster than not enabled,
|
|
161
|
+
* but could result in a difference in rendering result if
|
|
162
|
+
* {@link BoundingBoxRenderer.showBackLines} enabled,
|
|
163
|
+
* because drawing the black/white part of each box one after the other
|
|
164
|
+
* can be different from drawing the black part of all boxes and then the white part.
|
|
165
|
+
* Also, when enabled, events of {@link BoundingBoxRenderer.onBeforeBoxRenderingObservable}
|
|
166
|
+
* and {@link BoundingBoxRenderer.onAfterBoxRenderingObservable} would only be triggered once
|
|
167
|
+
* for one rendering, instead of once every bounding box.
|
|
168
|
+
* Events would be triggered with a dummy box to keep backwards compatibility,
|
|
169
|
+
* the passed bounding box has no meaning and should be ignored.
|
|
170
|
+
* @param val whether to use instanced rendering
|
|
171
|
+
*/
|
|
172
|
+
set useInstances(val: boolean);
|
|
173
|
+
get useInstances(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Instanced render the bounding boxes of a specific rendering group
|
|
176
|
+
* @param renderingGroupId defines the rendering group to render
|
|
177
|
+
*/
|
|
178
|
+
private _renderInstanced;
|
|
179
|
+
/**
|
|
180
|
+
* Creates buffer for instanced rendering
|
|
181
|
+
* @param buffer buffer to set
|
|
182
|
+
*/
|
|
183
|
+
private _createInstanceBuffer;
|
|
184
|
+
/**
|
|
185
|
+
* Clean up buffers for instanced rendering
|
|
186
|
+
*/
|
|
187
|
+
private _cleanupInstanceBuffer;
|
|
188
|
+
/**
|
|
189
|
+
* Clean up resources for instanced rendering
|
|
190
|
+
*/
|
|
191
|
+
private _cleanupInstances;
|
|
130
192
|
/**
|
|
131
193
|
* Dispose and release the resources attached to this renderer.
|
|
132
194
|
*/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Scene } from "../scene.js";
|
|
2
|
-
import { VertexBuffer } from "../Buffers/buffer.js";
|
|
2
|
+
import { Buffer, VertexBuffer } from "../Buffers/buffer.js";
|
|
3
3
|
import { AbstractMesh } from "../Meshes/abstractMesh.js";
|
|
4
|
-
import { Matrix } from "../Maths/math.vector.js";
|
|
4
|
+
import { Matrix, Vector3 } from "../Maths/math.vector.js";
|
|
5
5
|
import { SmartArray } from "../Misc/smartArray.js";
|
|
6
6
|
import { SceneComponentConstants } from "../sceneComponent.js";
|
|
7
|
+
import { BoundingBox } from "../Culling/boundingBox.js";
|
|
7
8
|
import { Material } from "../Materials/material.js";
|
|
8
9
|
import { ShaderMaterial } from "../Materials/shaderMaterial.js";
|
|
9
10
|
import { Color3 } from "../Maths/math.color.js";
|
|
@@ -11,6 +12,7 @@ import { Observable } from "../Misc/observable.js";
|
|
|
11
12
|
import { DrawWrapper } from "../Materials/drawWrapper.js";
|
|
12
13
|
import { UniformBuffer } from "../Materials/uniformBuffer.js";
|
|
13
14
|
import { CreateBoxVertexData } from "../Meshes/Builders/boxBuilder.js";
|
|
15
|
+
|
|
14
16
|
Object.defineProperty(Scene.prototype, "forceShowBoundingBoxes", {
|
|
15
17
|
get: function () {
|
|
16
18
|
return this._forceShowBoundingBoxes || false;
|
|
@@ -45,6 +47,12 @@ Object.defineProperty(AbstractMesh.prototype, "showBoundingBox", {
|
|
|
45
47
|
enumerable: true,
|
|
46
48
|
configurable: true,
|
|
47
49
|
});
|
|
50
|
+
const tempMatrix = Matrix.Identity();
|
|
51
|
+
const tempVec1 = new Vector3(), tempVec2 = new Vector3();
|
|
52
|
+
// `Matrix.asArray` returns its internal array, so it can be directly updated
|
|
53
|
+
const tempMatrixArray = tempMatrix.asArray();
|
|
54
|
+
// BoundingBox copies from it, so it's safe to reuse vectors here
|
|
55
|
+
const dummyBoundingBox = new BoundingBox(tempVec1, tempVec1);
|
|
48
56
|
/**
|
|
49
57
|
* Component responsible of rendering the bounding box of the meshes in a scene.
|
|
50
58
|
* This is usually used through the mesh.showBoundingBox or the scene.forceShowBoundingBoxes properties
|
|
@@ -79,10 +87,18 @@ export class BoundingBoxRenderer {
|
|
|
79
87
|
this.showBackLines = true;
|
|
80
88
|
/**
|
|
81
89
|
* Observable raised before rendering a bounding box
|
|
90
|
+
* When {@link BoundingBoxRenderer.useInstances} enabled,
|
|
91
|
+
* this would only be triggered once for one rendering, instead of once every bounding box.
|
|
92
|
+
* Events would be triggered with a dummy box to keep backwards compatibility,
|
|
93
|
+
* the passed bounding box has no meaning and should be ignored.
|
|
82
94
|
*/
|
|
83
95
|
this.onBeforeBoxRenderingObservable = new Observable();
|
|
84
96
|
/**
|
|
85
97
|
* Observable raised after rendering a bounding box
|
|
98
|
+
* When {@link BoundingBoxRenderer.useInstances} enabled,
|
|
99
|
+
* this would only be triggered once for one rendering, instead of once every bounding box.
|
|
100
|
+
* Events would be triggered with a dummy box to keep backwards compatibility,
|
|
101
|
+
* the passed bounding box has no meaning and should be ignored.
|
|
86
102
|
*/
|
|
87
103
|
this.onAfterBoxRenderingObservable = new Observable();
|
|
88
104
|
/**
|
|
@@ -102,6 +118,19 @@ export class BoundingBoxRenderer {
|
|
|
102
118
|
this._vertexBuffers = {};
|
|
103
119
|
this._fillIndexBuffer = null;
|
|
104
120
|
this._fillIndexData = null;
|
|
121
|
+
/**
|
|
122
|
+
* Internal buffer for instanced rendering
|
|
123
|
+
*/
|
|
124
|
+
this._matrixBuffer = null;
|
|
125
|
+
this._matrices = null;
|
|
126
|
+
/**
|
|
127
|
+
* Internal state of whether instanced rendering enabled
|
|
128
|
+
*/
|
|
129
|
+
this._useInstances = false;
|
|
130
|
+
/** @internal */
|
|
131
|
+
this._drawWrapperFront = null;
|
|
132
|
+
/** @internal */
|
|
133
|
+
this._drawWrapperBack = null;
|
|
105
134
|
this.scene = scene;
|
|
106
135
|
const engine = this.scene.getEngine();
|
|
107
136
|
if (engine.isWebGPU) {
|
|
@@ -150,7 +179,7 @@ export class BoundingBoxRenderer {
|
|
|
150
179
|
return;
|
|
151
180
|
}
|
|
152
181
|
this._colorShader = new ShaderMaterial("colorShader", this.scene, "boundingBoxRenderer", {
|
|
153
|
-
attributes: [VertexBuffer.PositionKind],
|
|
182
|
+
attributes: [VertexBuffer.PositionKind, "world0", "world1", "world2", "world3"],
|
|
154
183
|
uniforms: ["world", "viewProjection", "viewProjectionR", "color"],
|
|
155
184
|
uniformBuffers: ["BoundingBoxRenderer"],
|
|
156
185
|
shaderLanguage: this._shaderLanguage,
|
|
@@ -163,6 +192,7 @@ export class BoundingBoxRenderer {
|
|
|
163
192
|
}
|
|
164
193
|
},
|
|
165
194
|
}, false);
|
|
195
|
+
this._colorShader.setDefine("INSTANCES", this._useInstances);
|
|
166
196
|
this._colorShader.doNotSerialize = true;
|
|
167
197
|
this._colorShader.reservedDataStore = {
|
|
168
198
|
hidden: true,
|
|
@@ -206,6 +236,9 @@ export class BoundingBoxRenderer {
|
|
|
206
236
|
vb._rebuild();
|
|
207
237
|
}
|
|
208
238
|
this._createIndexBuffer();
|
|
239
|
+
if (this._matrixBuffer) {
|
|
240
|
+
this._matrixBuffer._rebuild();
|
|
241
|
+
}
|
|
209
242
|
}
|
|
210
243
|
/**
|
|
211
244
|
* @internal
|
|
@@ -221,6 +254,10 @@ export class BoundingBoxRenderer {
|
|
|
221
254
|
if (this.renderList.length === 0 || !this.enabled) {
|
|
222
255
|
return;
|
|
223
256
|
}
|
|
257
|
+
if (this._useInstances) {
|
|
258
|
+
this._renderInstanced(renderingGroupId);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
224
261
|
this._prepareResources();
|
|
225
262
|
if (!this._colorShader.isReady()) {
|
|
226
263
|
return;
|
|
@@ -346,6 +383,189 @@ export class BoundingBoxRenderer {
|
|
|
346
383
|
engine.setColorWrite(true);
|
|
347
384
|
engine.currentRenderPassId = currentRenderPassId;
|
|
348
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Sets whether to use instanced rendering.
|
|
388
|
+
* When not enabled, BoundingBoxRenderer renders in a loop,
|
|
389
|
+
* calling engine.drawElementsType for each bounding box in renderList,
|
|
390
|
+
* making every bounding box 1 or 2 draw call.
|
|
391
|
+
* When enabled, it collects bounding boxes to render,
|
|
392
|
+
* and render all boxes in 1 or 2 draw call.
|
|
393
|
+
* This could make the rendering with many bounding boxes much faster than not enabled,
|
|
394
|
+
* but could result in a difference in rendering result if
|
|
395
|
+
* {@link BoundingBoxRenderer.showBackLines} enabled,
|
|
396
|
+
* because drawing the black/white part of each box one after the other
|
|
397
|
+
* can be different from drawing the black part of all boxes and then the white part.
|
|
398
|
+
* Also, when enabled, events of {@link BoundingBoxRenderer.onBeforeBoxRenderingObservable}
|
|
399
|
+
* and {@link BoundingBoxRenderer.onAfterBoxRenderingObservable} would only be triggered once
|
|
400
|
+
* for one rendering, instead of once every bounding box.
|
|
401
|
+
* Events would be triggered with a dummy box to keep backwards compatibility,
|
|
402
|
+
* the passed bounding box has no meaning and should be ignored.
|
|
403
|
+
* @param val whether to use instanced rendering
|
|
404
|
+
*/
|
|
405
|
+
set useInstances(val) {
|
|
406
|
+
this._useInstances = val;
|
|
407
|
+
if (this._colorShader) {
|
|
408
|
+
this._colorShader.setDefine("INSTANCES", val);
|
|
409
|
+
}
|
|
410
|
+
if (!val) {
|
|
411
|
+
this._cleanupInstances();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
get useInstances() {
|
|
415
|
+
return this._useInstances;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Instanced render the bounding boxes of a specific rendering group
|
|
419
|
+
* @param renderingGroupId defines the rendering group to render
|
|
420
|
+
*/
|
|
421
|
+
_renderInstanced(renderingGroupId) {
|
|
422
|
+
if (this.renderList.length === 0 || !this.enabled) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
this._prepareResources();
|
|
426
|
+
if (!this._colorShader.isReady()) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const colorShader = this._colorShader;
|
|
430
|
+
let matrices = this._matrices;
|
|
431
|
+
const expectedLength = this.renderList.length * 16;
|
|
432
|
+
if (!matrices || matrices.length < expectedLength || matrices.length > expectedLength * 2) {
|
|
433
|
+
matrices = new Float32Array(expectedLength);
|
|
434
|
+
this._matrices = matrices;
|
|
435
|
+
}
|
|
436
|
+
this.onBeforeBoxRenderingObservable.notifyObservers(dummyBoundingBox);
|
|
437
|
+
let instancesCount = 0;
|
|
438
|
+
for (let boundingBoxIndex = 0; boundingBoxIndex < this.renderList.length; boundingBoxIndex++) {
|
|
439
|
+
const boundingBox = this.renderList.data[boundingBoxIndex];
|
|
440
|
+
if (boundingBox._tag !== renderingGroupId) {
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
const min = boundingBox.minimum;
|
|
444
|
+
const max = boundingBox.maximum;
|
|
445
|
+
const diff = max.subtractToRef(min, tempVec2);
|
|
446
|
+
const median = min.addToRef(diff.scaleToRef(0.5, tempVec1), tempVec1);
|
|
447
|
+
const m = tempMatrixArray;
|
|
448
|
+
// Directly update the matrix values in column-major order
|
|
449
|
+
m[0] = diff._x; // Scale X
|
|
450
|
+
m[3] = median._x; // Translate X
|
|
451
|
+
m[5] = diff._y; // Scale Y
|
|
452
|
+
m[7] = median._y; // Translate Y
|
|
453
|
+
m[10] = diff._z; // Scale Z
|
|
454
|
+
m[11] = median._z; // Translate Z
|
|
455
|
+
tempMatrix.multiplyToArray(boundingBox.getWorldMatrix(), matrices, instancesCount * 16);
|
|
456
|
+
instancesCount++;
|
|
457
|
+
}
|
|
458
|
+
const engine = this.scene.getEngine();
|
|
459
|
+
// keeps the original depth function and depth write
|
|
460
|
+
const depthFunction = engine.getDepthFunction() ?? 515;
|
|
461
|
+
const depthWrite = engine.getDepthWrite();
|
|
462
|
+
engine.setDepthWrite(false);
|
|
463
|
+
const matrixBuffer = this._matrixBuffer;
|
|
464
|
+
if (matrixBuffer?.isUpdatable() && matrixBuffer.getData() === matrices) {
|
|
465
|
+
matrixBuffer.update(matrices);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
this._createInstanceBuffer(matrices);
|
|
469
|
+
}
|
|
470
|
+
this._createWrappersForBoundingBox(this);
|
|
471
|
+
const useReverseDepthBuffer = engine.useReverseDepthBuffer;
|
|
472
|
+
const transformMatrix = this.scene.getTransformMatrix();
|
|
473
|
+
if (this.showBackLines) {
|
|
474
|
+
const drawWrapperBack = this._drawWrapperBack ?? colorShader._getDrawWrapper();
|
|
475
|
+
colorShader._preBind(drawWrapperBack);
|
|
476
|
+
engine.bindBuffers(this._vertexBuffers, this._indexBuffer, colorShader.getEffect());
|
|
477
|
+
// Back
|
|
478
|
+
if (useReverseDepthBuffer) {
|
|
479
|
+
engine.setDepthFunctionToLessOrEqual();
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
engine.setDepthFunctionToGreaterOrEqual();
|
|
483
|
+
}
|
|
484
|
+
const _uniformBufferBack = this._uniformBufferBack;
|
|
485
|
+
_uniformBufferBack.bindToEffect(drawWrapperBack.effect, "BoundingBoxRenderer");
|
|
486
|
+
_uniformBufferBack.updateColor4("color", this.backColor, 1);
|
|
487
|
+
_uniformBufferBack.updateMatrix("viewProjection", transformMatrix);
|
|
488
|
+
_uniformBufferBack.update();
|
|
489
|
+
// Draw order
|
|
490
|
+
engine.drawElementsType(Material.LineListDrawMode, 0, 24, instancesCount);
|
|
491
|
+
}
|
|
492
|
+
const drawWrapperFront = colorShader._getDrawWrapper();
|
|
493
|
+
colorShader._preBind(drawWrapperFront);
|
|
494
|
+
engine.bindBuffers(this._vertexBuffers, this._indexBuffer, colorShader.getEffect());
|
|
495
|
+
// Front
|
|
496
|
+
if (useReverseDepthBuffer) {
|
|
497
|
+
engine.setDepthFunctionToGreater();
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
engine.setDepthFunctionToLess();
|
|
501
|
+
}
|
|
502
|
+
const _uniformBufferFront = this._uniformBufferFront;
|
|
503
|
+
_uniformBufferFront.bindToEffect(drawWrapperFront.effect, "BoundingBoxRenderer");
|
|
504
|
+
_uniformBufferFront.updateColor4("color", this.frontColor, 1);
|
|
505
|
+
_uniformBufferFront.updateMatrix("viewProjection", transformMatrix);
|
|
506
|
+
_uniformBufferFront.update();
|
|
507
|
+
// Draw order
|
|
508
|
+
engine.drawElementsType(Material.LineListDrawMode, 0, 24, instancesCount);
|
|
509
|
+
this.onAfterBoxRenderingObservable.notifyObservers(dummyBoundingBox);
|
|
510
|
+
colorShader.unbind();
|
|
511
|
+
engine.setDepthFunction(depthFunction);
|
|
512
|
+
engine.setDepthWrite(depthWrite);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Creates buffer for instanced rendering
|
|
516
|
+
* @param buffer buffer to set
|
|
517
|
+
*/
|
|
518
|
+
_createInstanceBuffer(buffer) {
|
|
519
|
+
const vertexBuffers = this._vertexBuffers;
|
|
520
|
+
this._cleanupInstanceBuffer();
|
|
521
|
+
const matrixBuffer = new Buffer(this.scene.getEngine(), buffer, true, 16, false, true);
|
|
522
|
+
vertexBuffers.world0 = matrixBuffer.createVertexBuffer("world0", 0, 4);
|
|
523
|
+
vertexBuffers.world1 = matrixBuffer.createVertexBuffer("world1", 4, 4);
|
|
524
|
+
vertexBuffers.world2 = matrixBuffer.createVertexBuffer("world2", 8, 4);
|
|
525
|
+
vertexBuffers.world3 = matrixBuffer.createVertexBuffer("world3", 12, 4);
|
|
526
|
+
this._matrixBuffer = matrixBuffer;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Clean up buffers for instanced rendering
|
|
530
|
+
*/
|
|
531
|
+
_cleanupInstanceBuffer() {
|
|
532
|
+
const vertexBuffers = this._vertexBuffers;
|
|
533
|
+
if (vertexBuffers.world0) {
|
|
534
|
+
vertexBuffers.world0.dispose();
|
|
535
|
+
delete vertexBuffers.world0;
|
|
536
|
+
}
|
|
537
|
+
if (vertexBuffers.world1) {
|
|
538
|
+
vertexBuffers.world1.dispose();
|
|
539
|
+
delete vertexBuffers.world1;
|
|
540
|
+
}
|
|
541
|
+
if (vertexBuffers.world2) {
|
|
542
|
+
vertexBuffers.world2.dispose();
|
|
543
|
+
delete vertexBuffers.world2;
|
|
544
|
+
}
|
|
545
|
+
if (vertexBuffers.world3) {
|
|
546
|
+
vertexBuffers.world3.dispose();
|
|
547
|
+
delete vertexBuffers.world3;
|
|
548
|
+
}
|
|
549
|
+
this._matrices = null;
|
|
550
|
+
if (this._matrixBuffer) {
|
|
551
|
+
this._matrixBuffer.dispose();
|
|
552
|
+
this._matrixBuffer = null;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Clean up resources for instanced rendering
|
|
557
|
+
*/
|
|
558
|
+
_cleanupInstances() {
|
|
559
|
+
this._cleanupInstanceBuffer();
|
|
560
|
+
if (this._drawWrapperFront) {
|
|
561
|
+
this._drawWrapperFront.dispose();
|
|
562
|
+
this._drawWrapperFront = null;
|
|
563
|
+
}
|
|
564
|
+
if (this._drawWrapperBack) {
|
|
565
|
+
this._drawWrapperBack.dispose();
|
|
566
|
+
this._drawWrapperBack = null;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
349
569
|
/**
|
|
350
570
|
* Dispose and release the resources attached to this renderer.
|
|
351
571
|
*/
|
|
@@ -375,6 +595,7 @@ export class BoundingBoxRenderer {
|
|
|
375
595
|
this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer);
|
|
376
596
|
this._fillIndexBuffer = null;
|
|
377
597
|
}
|
|
598
|
+
this._cleanupInstances();
|
|
378
599
|
}
|
|
379
600
|
}
|
|
380
601
|
//# sourceMappingURL=boundingBoxRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundingBoxRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/boundingBoxRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAA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,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,CAAC;QAE7C,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;QAElC,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAC9D,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEzD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC7D,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACjC,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Scene } from \"../scene\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Matrix } from \"../Maths/math.vector\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport type { Nullable, FloatArray, IndicesArray } from \"../types\";\r\nimport type { ISceneComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport type { BoundingBox } from \"../Culling/boundingBox\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { DrawWrapper } from \"../Materials/drawWrapper\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport { CreateBoxVertexData } from \"../Meshes/Builders/boxBuilder\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /** @internal (Backing field) */\r\n _boundingBoxRenderer: BoundingBoxRenderer;\r\n\r\n /** @internal (Backing field) */\r\n _forceShowBoundingBoxes: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if all bounding boxes must be rendered\r\n */\r\n forceShowBoundingBoxes: boolean;\r\n\r\n /**\r\n * Gets the bounding box renderer associated with the scene\r\n * @returns a BoundingBoxRenderer\r\n */\r\n getBoundingBoxRenderer(): BoundingBoxRenderer;\r\n }\r\n}\r\n\r\nObject.defineProperty(Scene.prototype, \"forceShowBoundingBoxes\", {\r\n get: function (this: Scene) {\r\n return this._forceShowBoundingBoxes || false;\r\n },\r\n set: function (this: Scene, value: boolean) {\r\n this._forceShowBoundingBoxes = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nScene.prototype.getBoundingBoxRenderer = function (): BoundingBoxRenderer {\r\n if (!this._boundingBoxRenderer) {\r\n this._boundingBoxRenderer = new BoundingBoxRenderer(this);\r\n }\r\n\r\n return this._boundingBoxRenderer;\r\n};\r\n\r\ndeclare module \"../Meshes/abstractMesh\" {\r\n export interface AbstractMesh {\r\n /** @internal (Backing field) */\r\n _showBoundingBox: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the bounding box must be rendered as well (false by default)\r\n */\r\n showBoundingBox: boolean;\r\n }\r\n}\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"showBoundingBox\", {\r\n get: function (this: AbstractMesh) {\r\n return this._showBoundingBox || false;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._showBoundingBox = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getScene().getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Component responsible of rendering the bounding box of the meshes in a scene.\r\n * This is usually used through the mesh.showBoundingBox or the scene.forceShowBoundingBoxes properties\r\n */\r\nexport class BoundingBoxRenderer implements ISceneComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_BOUNDINGBOXRENDERER;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Color of the bounding box lines placed in front of an object\r\n */\r\n public frontColor = new Color3(1, 1, 1);\r\n /**\r\n * Color of the bounding box lines placed behind an object\r\n */\r\n public backColor = new Color3(0.1, 0.1, 0.1);\r\n /**\r\n * Defines if the renderer should show the back lines or not\r\n */\r\n public showBackLines = true;\r\n\r\n /**\r\n * Observable raised before rendering a bounding box\r\n */\r\n public onBeforeBoxRenderingObservable = new Observable<BoundingBox>();\r\n\r\n /**\r\n * Observable raised after rendering a bounding box\r\n */\r\n public onAfterBoxRenderingObservable = new Observable<BoundingBox>();\r\n\r\n /**\r\n * Observable raised after resources are created\r\n */\r\n public onResourcesReadyObservable = new Observable<BoundingBoxRenderer>();\r\n\r\n /**\r\n * When false, no bounding boxes will be rendered\r\n */\r\n public enabled = true;\r\n\r\n /** Shader language used by the renderer */\r\n protected _shaderLanguage = ShaderLanguage.GLSL;\r\n\r\n /**\r\n * Gets the shader language used in this renderer.\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._shaderLanguage;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public renderList = new SmartArray<BoundingBox>(32);\r\n\r\n private _colorShader: ShaderMaterial;\r\n private _colorShaderForOcclusionQuery: ShaderMaterial;\r\n private _vertexBuffers: { [key: string]: Nullable<VertexBuffer> } = {};\r\n private _indexBuffer: DataBuffer;\r\n private _fillIndexBuffer: Nullable<DataBuffer> = null;\r\n private _fillIndexData: Nullable<IndicesArray> = null;\r\n private _uniformBufferFront: UniformBuffer;\r\n private _uniformBufferBack: UniformBuffer;\r\n private _renderPassIdForOcclusionQuery: number;\r\n\r\n /**\r\n * Instantiates a new bounding box renderer in a scene.\r\n * @param scene the scene the renderer renders in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n\r\n const engine = this.scene.getEngine();\r\n if (engine.isWebGPU) {\r\n this._shaderLanguage = ShaderLanguage.WGSL;\r\n }\r\n\r\n scene._addComponent(this);\r\n this._uniformBufferFront = new UniformBuffer(this.scene.getEngine(), undefined, undefined, \"BoundingBoxRendererFront\", true);\r\n this._buildUniformLayout(this._uniformBufferFront);\r\n this._uniformBufferBack = new UniformBuffer(this.scene.getEngine(), undefined, undefined, \"BoundingBoxRendererBack\", true);\r\n this._buildUniformLayout(this._uniformBufferBack);\r\n }\r\n\r\n private _buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"color\", 4);\r\n ubo.addUniform(\"world\", 16);\r\n ubo.addUniform(\"viewProjection\", 16);\r\n ubo.addUniform(\"viewProjectionR\", 16);\r\n ubo.create();\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._beforeEvaluateActiveMeshStage.registerStep(SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset);\r\n\r\n this.scene._preActiveMeshStage.registerStep(SceneComponentConstants.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER, this, this._preActiveMesh);\r\n\r\n this.scene._evaluateSubMeshStage.registerStep(SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh);\r\n\r\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, this, this.render);\r\n }\r\n\r\n private _evaluateSubMesh(mesh: AbstractMesh, subMesh: SubMesh): void {\r\n if (mesh.showSubMeshesBoundingBox) {\r\n const boundingInfo = subMesh.getBoundingInfo();\r\n if (boundingInfo !== null && boundingInfo !== undefined) {\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n }\r\n }\r\n\r\n private _preActiveMesh(mesh: AbstractMesh): void {\r\n if (mesh.showBoundingBox || this.scene.forceShowBoundingBoxes) {\r\n const boundingInfo = mesh.getBoundingInfo();\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n }\r\n\r\n private _prepareResources(): void {\r\n if (this._colorShader) {\r\n return;\r\n }\r\n\r\n this._colorShader = new ShaderMaterial(\r\n \"colorShader\",\r\n this.scene,\r\n \"boundingBoxRenderer\",\r\n {\r\n attributes: [VertexBuffer.PositionKind],\r\n uniforms: [\"world\", \"viewProjection\", \"viewProjectionR\", \"color\"],\r\n uniformBuffers: [\"BoundingBoxRenderer\"],\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../ShadersWGSL/boundingBoxRenderer.vertex\"), import(\"../ShadersWGSL/boundingBoxRenderer.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../Shaders/boundingBoxRenderer.vertex\"), import(\"../Shaders/boundingBoxRenderer.fragment\")]);\r\n }\r\n },\r\n },\r\n false\r\n );\r\n this._colorShader.doNotSerialize = true;\r\n\r\n this._colorShader.reservedDataStore = {\r\n hidden: true,\r\n };\r\n\r\n this._colorShaderForOcclusionQuery = new ShaderMaterial(\r\n \"colorShaderOccQuery\",\r\n this.scene,\r\n \"boundingBoxRenderer\",\r\n {\r\n attributes: [VertexBuffer.PositionKind],\r\n uniforms: [\"world\", \"viewProjection\", \"viewProjectionR\", \"color\"],\r\n uniformBuffers: [\"BoundingBoxRenderer\"],\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../ShadersWGSL/boundingBoxRenderer.vertex\"), import(\"../ShadersWGSL/boundingBoxRenderer.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../Shaders/boundingBoxRenderer.vertex\"), import(\"../Shaders/boundingBoxRenderer.fragment\")]);\r\n }\r\n },\r\n },\r\n true\r\n );\r\n this._colorShaderForOcclusionQuery.doNotSerialize = true;\r\n\r\n this._colorShaderForOcclusionQuery.reservedDataStore = {\r\n hidden: true,\r\n };\r\n\r\n const engine = this.scene.getEngine();\r\n const boxdata = CreateBoxVertexData({ size: 1.0 });\r\n this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(engine, <FloatArray>boxdata.positions, VertexBuffer.PositionKind, false);\r\n this._createIndexBuffer();\r\n this._fillIndexData = boxdata.indices;\r\n this.onResourcesReadyObservable.notifyObservers(this);\r\n }\r\n\r\n private _createIndexBuffer(): void {\r\n const engine = this.scene.getEngine();\r\n this._indexBuffer = engine.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n const vb = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public reset(): void {\r\n this.renderList.reset();\r\n }\r\n\r\n /**\r\n * Render the bounding boxes of a specific rendering group\r\n * @param renderingGroupId defines the rendering group to render\r\n */\r\n public render(renderingGroupId: number): void {\r\n if (this.renderList.length === 0 || !this.enabled) {\r\n return;\r\n }\r\n\r\n this._prepareResources();\r\n\r\n if (!this._colorShader.isReady()) {\r\n return;\r\n }\r\n\r\n const engine = this.scene.getEngine();\r\n engine.setDepthWrite(false);\r\n\r\n const transformMatrix = this.scene.getTransformMatrix();\r\n\r\n for (let boundingBoxIndex = 0; boundingBoxIndex < this.renderList.length; boundingBoxIndex++) {\r\n const boundingBox = this.renderList.data[boundingBoxIndex];\r\n if (boundingBox._tag !== renderingGroupId) {\r\n continue;\r\n }\r\n\r\n this._createWrappersForBoundingBox(boundingBox);\r\n this.onBeforeBoxRenderingObservable.notifyObservers(boundingBox);\r\n\r\n const min = boundingBox.minimum;\r\n const max = boundingBox.maximum;\r\n const diff = max.subtract(min);\r\n const median = min.add(diff.scale(0.5));\r\n\r\n const worldMatrix = Matrix.Scaling(diff.x, diff.y, diff.z)\r\n .multiply(Matrix.Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n\r\n const useReverseDepthBuffer = engine.useReverseDepthBuffer;\r\n\r\n if (this.showBackLines) {\r\n const drawWrapperBack = boundingBox._drawWrapperBack ?? this._colorShader._getDrawWrapper();\r\n\r\n this._colorShader._preBind(drawWrapperBack);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, <Effect>this._colorShader.getEffect());\r\n\r\n // Back\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToLessOrEqual();\r\n } else {\r\n engine.setDepthFunctionToGreaterOrEqual();\r\n }\r\n this._uniformBufferBack.bindToEffect(drawWrapperBack.effect!, \"BoundingBoxRenderer\");\r\n this._uniformBufferBack.updateColor4(\"color\", this.backColor, 1);\r\n this._uniformBufferBack.updateMatrix(\"world\", worldMatrix);\r\n this._uniformBufferBack.updateMatrix(\"viewProjection\", transformMatrix);\r\n this._uniformBufferBack.update();\r\n\r\n // Draw order\r\n engine.drawElementsType(Material.LineListDrawMode, 0, 24);\r\n }\r\n\r\n const drawWrapperFront = boundingBox._drawWrapperFront ?? this._colorShader._getDrawWrapper();\r\n\r\n this._colorShader._preBind(drawWrapperFront);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, <Effect>this._colorShader.getEffect());\r\n\r\n // Front\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToGreater();\r\n } else {\r\n engine.setDepthFunctionToLess();\r\n }\r\n this._uniformBufferFront.bindToEffect(drawWrapperFront.effect!, \"BoundingBoxRenderer\");\r\n this._uniformBufferFront.updateColor4(\"color\", this.frontColor, 1);\r\n this._uniformBufferFront.updateMatrix(\"world\", worldMatrix);\r\n this._uniformBufferFront.updateMatrix(\"viewProjection\", transformMatrix);\r\n this._uniformBufferFront.update();\r\n\r\n // Draw order\r\n engine.drawElementsType(Material.LineListDrawMode, 0, 24);\r\n\r\n this.onAfterBoxRenderingObservable.notifyObservers(boundingBox);\r\n }\r\n this._colorShader.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n }\r\n\r\n private _createWrappersForBoundingBox(boundingBox: BoundingBox): void {\r\n if (!boundingBox._drawWrapperFront) {\r\n const engine = this.scene.getEngine();\r\n\r\n boundingBox._drawWrapperFront = new DrawWrapper(engine);\r\n boundingBox._drawWrapperBack = new DrawWrapper(engine);\r\n\r\n boundingBox._drawWrapperFront.setEffect(this._colorShader.getEffect());\r\n boundingBox._drawWrapperBack.setEffect(this._colorShader.getEffect());\r\n }\r\n }\r\n\r\n /**\r\n * In case of occlusion queries, we can render the occlusion bounding box through this method\r\n * @param mesh Define the mesh to render the occlusion bounding box for\r\n */\r\n public renderOcclusionBoundingBox(mesh: AbstractMesh): void {\r\n const engine = this.scene.getEngine();\r\n\r\n if (this._renderPassIdForOcclusionQuery === undefined) {\r\n this._renderPassIdForOcclusionQuery = engine.createRenderPassId(`Render pass for occlusion query`);\r\n }\r\n\r\n const currentRenderPassId = engine.currentRenderPassId;\r\n\r\n engine.currentRenderPassId = this._renderPassIdForOcclusionQuery;\r\n\r\n this._prepareResources();\r\n\r\n const subMesh = mesh.subMeshes[0];\r\n\r\n if (!this._colorShaderForOcclusionQuery.isReady(mesh, undefined, subMesh) || !mesh.hasBoundingInfo) {\r\n engine.currentRenderPassId = currentRenderPassId;\r\n return;\r\n }\r\n\r\n if (!this._fillIndexBuffer) {\r\n this._fillIndexBuffer = engine.createIndexBuffer(this._fillIndexData!);\r\n }\r\n\r\n const useReverseDepthBuffer = engine.useReverseDepthBuffer;\r\n\r\n engine.setDepthWrite(false);\r\n engine.setColorWrite(false);\r\n\r\n const boundingBox = mesh.getBoundingInfo().boundingBox;\r\n const min = boundingBox.minimum;\r\n const max = boundingBox.maximum;\r\n const diff = max.subtract(min);\r\n const median = min.add(diff.scale(0.5));\r\n\r\n const worldMatrix = Matrix.Scaling(diff.x, diff.y, diff.z)\r\n .multiply(Matrix.Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n this._colorShaderForOcclusionQuery._preBind(drawWrapper);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._fillIndexBuffer, <Effect>drawWrapper.effect);\r\n\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToGreater();\r\n } else {\r\n engine.setDepthFunctionToLess();\r\n }\r\n\r\n this.scene.resetCachedMaterial();\r\n\r\n this._uniformBufferFront.bindToEffect(drawWrapper.effect!, \"BoundingBoxRenderer\");\r\n this._uniformBufferFront.updateMatrix(\"world\", worldMatrix);\r\n this._uniformBufferFront.updateMatrix(\"viewProjection\", this.scene.getTransformMatrix());\r\n this._uniformBufferFront.update();\r\n\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 36);\r\n\r\n this._colorShaderForOcclusionQuery.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n engine.setColorWrite(true);\r\n\r\n engine.currentRenderPassId = currentRenderPassId;\r\n }\r\n\r\n /**\r\n * Dispose and release the resources attached to this renderer.\r\n */\r\n public dispose(): void {\r\n if (this._renderPassIdForOcclusionQuery !== undefined) {\r\n this.scene.getEngine().releaseRenderPassId(this._renderPassIdForOcclusionQuery);\r\n this._renderPassIdForOcclusionQuery = undefined as any;\r\n }\r\n\r\n if (!this._colorShader) {\r\n return;\r\n }\r\n\r\n this.onBeforeBoxRenderingObservable.clear();\r\n this.onAfterBoxRenderingObservable.clear();\r\n this.onResourcesReadyObservable.clear();\r\n\r\n this.renderList.dispose();\r\n\r\n this._colorShader.dispose();\r\n this._colorShaderForOcclusionQuery.dispose();\r\n\r\n this._uniformBufferFront.dispose();\r\n this._uniformBufferBack.dispose();\r\n\r\n const buffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\r\n }\r\n this.scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n\r\n if (this._fillIndexBuffer) {\r\n this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer);\r\n this._fillIndexBuffer = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"boundingBoxRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/boundingBoxRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE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I,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { Scene } from \"../scene\";\r\nimport { Buffer, VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport type { Nullable, FloatArray, IndicesArray } from \"../types\";\r\nimport type { ISceneComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { BoundingBox } from \"../Culling/boundingBox\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { DrawWrapper } from \"../Materials/drawWrapper\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport { CreateBoxVertexData } from \"../Meshes/Builders/boxBuilder\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /** @internal (Backing field) */\r\n _boundingBoxRenderer: BoundingBoxRenderer;\r\n\r\n /** @internal (Backing field) */\r\n _forceShowBoundingBoxes: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if all bounding boxes must be rendered\r\n */\r\n forceShowBoundingBoxes: boolean;\r\n\r\n /**\r\n * Gets the bounding box renderer associated with the scene\r\n * @returns a BoundingBoxRenderer\r\n */\r\n getBoundingBoxRenderer(): BoundingBoxRenderer;\r\n }\r\n}\r\n\r\nObject.defineProperty(Scene.prototype, \"forceShowBoundingBoxes\", {\r\n get: function (this: Scene) {\r\n return this._forceShowBoundingBoxes || false;\r\n },\r\n set: function (this: Scene, value: boolean) {\r\n this._forceShowBoundingBoxes = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nScene.prototype.getBoundingBoxRenderer = function (): BoundingBoxRenderer {\r\n if (!this._boundingBoxRenderer) {\r\n this._boundingBoxRenderer = new BoundingBoxRenderer(this);\r\n }\r\n\r\n return this._boundingBoxRenderer;\r\n};\r\n\r\ndeclare module \"../Meshes/abstractMesh\" {\r\n export interface AbstractMesh {\r\n /** @internal (Backing field) */\r\n _showBoundingBox: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the bounding box must be rendered as well (false by default)\r\n */\r\n showBoundingBox: boolean;\r\n }\r\n}\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"showBoundingBox\", {\r\n get: function (this: AbstractMesh) {\r\n return this._showBoundingBox || false;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._showBoundingBox = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getScene().getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nconst tempMatrix = Matrix.Identity();\r\nconst tempVec1 = new Vector3(),\r\n tempVec2 = new Vector3();\r\n// `Matrix.asArray` returns its internal array, so it can be directly updated\r\nconst tempMatrixArray = tempMatrix.asArray();\r\n\r\n// BoundingBox copies from it, so it's safe to reuse vectors here\r\nconst dummyBoundingBox = new BoundingBox(tempVec1, tempVec1);\r\n\r\n/**\r\n * Component responsible of rendering the bounding box of the meshes in a scene.\r\n * This is usually used through the mesh.showBoundingBox or the scene.forceShowBoundingBoxes properties\r\n */\r\nexport class BoundingBoxRenderer implements ISceneComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_BOUNDINGBOXRENDERER;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Color of the bounding box lines placed in front of an object\r\n */\r\n public frontColor = new Color3(1, 1, 1);\r\n /**\r\n * Color of the bounding box lines placed behind an object\r\n */\r\n public backColor = new Color3(0.1, 0.1, 0.1);\r\n /**\r\n * Defines if the renderer should show the back lines or not\r\n */\r\n public showBackLines = true;\r\n\r\n /**\r\n * Observable raised before rendering a bounding box\r\n * When {@link BoundingBoxRenderer.useInstances} enabled,\r\n * this would only be triggered once for one rendering, instead of once every bounding box.\r\n * Events would be triggered with a dummy box to keep backwards compatibility,\r\n * the passed bounding box has no meaning and should be ignored.\r\n */\r\n public onBeforeBoxRenderingObservable = new Observable<BoundingBox>();\r\n\r\n /**\r\n * Observable raised after rendering a bounding box\r\n * When {@link BoundingBoxRenderer.useInstances} enabled,\r\n * this would only be triggered once for one rendering, instead of once every bounding box.\r\n * Events would be triggered with a dummy box to keep backwards compatibility,\r\n * the passed bounding box has no meaning and should be ignored.\r\n */\r\n public onAfterBoxRenderingObservable = new Observable<BoundingBox>();\r\n\r\n /**\r\n * Observable raised after resources are created\r\n */\r\n public onResourcesReadyObservable = new Observable<BoundingBoxRenderer>();\r\n\r\n /**\r\n * When false, no bounding boxes will be rendered\r\n */\r\n public enabled = true;\r\n\r\n /** Shader language used by the renderer */\r\n protected _shaderLanguage = ShaderLanguage.GLSL;\r\n\r\n /**\r\n * Gets the shader language used in this renderer.\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._shaderLanguage;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public renderList = new SmartArray<BoundingBox>(32);\r\n\r\n private _colorShader: ShaderMaterial;\r\n private _colorShaderForOcclusionQuery: ShaderMaterial;\r\n private _vertexBuffers: { [key: string]: Nullable<VertexBuffer> } = {};\r\n private _indexBuffer: DataBuffer;\r\n private _fillIndexBuffer: Nullable<DataBuffer> = null;\r\n private _fillIndexData: Nullable<IndicesArray> = null;\r\n private _uniformBufferFront: UniformBuffer;\r\n private _uniformBufferBack: UniformBuffer;\r\n private _renderPassIdForOcclusionQuery: number;\r\n /**\r\n * Internal buffer for instanced rendering\r\n */\r\n private _matrixBuffer: Nullable<Buffer> = null;\r\n private _matrices: Nullable<Float32Array> = null;\r\n\r\n /**\r\n * Internal state of whether instanced rendering enabled\r\n */\r\n protected _useInstances = false;\r\n\r\n /** @internal */\r\n public _drawWrapperFront: Nullable<DrawWrapper> = null;\r\n /** @internal */\r\n public _drawWrapperBack: Nullable<DrawWrapper> = null;\r\n\r\n /**\r\n * Instantiates a new bounding box renderer in a scene.\r\n * @param scene the scene the renderer renders in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n\r\n const engine = this.scene.getEngine();\r\n if (engine.isWebGPU) {\r\n this._shaderLanguage = ShaderLanguage.WGSL;\r\n }\r\n\r\n scene._addComponent(this);\r\n this._uniformBufferFront = new UniformBuffer(this.scene.getEngine(), undefined, undefined, \"BoundingBoxRendererFront\", true);\r\n this._buildUniformLayout(this._uniformBufferFront);\r\n this._uniformBufferBack = new UniformBuffer(this.scene.getEngine(), undefined, undefined, \"BoundingBoxRendererBack\", true);\r\n this._buildUniformLayout(this._uniformBufferBack);\r\n }\r\n\r\n private _buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"color\", 4);\r\n ubo.addUniform(\"world\", 16);\r\n ubo.addUniform(\"viewProjection\", 16);\r\n ubo.addUniform(\"viewProjectionR\", 16);\r\n ubo.create();\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._beforeEvaluateActiveMeshStage.registerStep(SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset);\r\n\r\n this.scene._preActiveMeshStage.registerStep(SceneComponentConstants.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER, this, this._preActiveMesh);\r\n\r\n this.scene._evaluateSubMeshStage.registerStep(SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh);\r\n\r\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, this, this.render);\r\n }\r\n\r\n private _evaluateSubMesh(mesh: AbstractMesh, subMesh: SubMesh): void {\r\n if (mesh.showSubMeshesBoundingBox) {\r\n const boundingInfo = subMesh.getBoundingInfo();\r\n if (boundingInfo !== null && boundingInfo !== undefined) {\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n }\r\n }\r\n\r\n private _preActiveMesh(mesh: AbstractMesh): void {\r\n if (mesh.showBoundingBox || this.scene.forceShowBoundingBoxes) {\r\n const boundingInfo = mesh.getBoundingInfo();\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n }\r\n\r\n private _prepareResources(): void {\r\n if (this._colorShader) {\r\n return;\r\n }\r\n\r\n this._colorShader = new ShaderMaterial(\r\n \"colorShader\",\r\n this.scene,\r\n \"boundingBoxRenderer\",\r\n {\r\n attributes: [VertexBuffer.PositionKind, \"world0\", \"world1\", \"world2\", \"world3\"],\r\n\r\n uniforms: [\"world\", \"viewProjection\", \"viewProjectionR\", \"color\"],\r\n uniformBuffers: [\"BoundingBoxRenderer\"],\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../ShadersWGSL/boundingBoxRenderer.vertex\"), import(\"../ShadersWGSL/boundingBoxRenderer.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../Shaders/boundingBoxRenderer.vertex\"), import(\"../Shaders/boundingBoxRenderer.fragment\")]);\r\n }\r\n },\r\n },\r\n false\r\n );\r\n this._colorShader.setDefine(\"INSTANCES\", this._useInstances);\r\n this._colorShader.doNotSerialize = true;\r\n\r\n this._colorShader.reservedDataStore = {\r\n hidden: true,\r\n };\r\n\r\n this._colorShaderForOcclusionQuery = new ShaderMaterial(\r\n \"colorShaderOccQuery\",\r\n this.scene,\r\n \"boundingBoxRenderer\",\r\n {\r\n attributes: [VertexBuffer.PositionKind],\r\n uniforms: [\"world\", \"viewProjection\", \"viewProjectionR\", \"color\"],\r\n uniformBuffers: [\"BoundingBoxRenderer\"],\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../ShadersWGSL/boundingBoxRenderer.vertex\"), import(\"../ShadersWGSL/boundingBoxRenderer.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../Shaders/boundingBoxRenderer.vertex\"), import(\"../Shaders/boundingBoxRenderer.fragment\")]);\r\n }\r\n },\r\n },\r\n true\r\n );\r\n this._colorShaderForOcclusionQuery.doNotSerialize = true;\r\n\r\n this._colorShaderForOcclusionQuery.reservedDataStore = {\r\n hidden: true,\r\n };\r\n\r\n const engine = this.scene.getEngine();\r\n const boxdata = CreateBoxVertexData({ size: 1.0 });\r\n this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(engine, <FloatArray>boxdata.positions, VertexBuffer.PositionKind, false);\r\n this._createIndexBuffer();\r\n this._fillIndexData = boxdata.indices;\r\n this.onResourcesReadyObservable.notifyObservers(this);\r\n }\r\n\r\n private _createIndexBuffer(): void {\r\n const engine = this.scene.getEngine();\r\n this._indexBuffer = engine.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n const vb = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n\r\n if (this._matrixBuffer) {\r\n this._matrixBuffer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public reset(): void {\r\n this.renderList.reset();\r\n }\r\n\r\n /**\r\n * Render the bounding boxes of a specific rendering group\r\n * @param renderingGroupId defines the rendering group to render\r\n */\r\n public render(renderingGroupId: number): void {\r\n if (this.renderList.length === 0 || !this.enabled) {\r\n return;\r\n }\r\n\r\n if (this._useInstances) {\r\n this._renderInstanced(renderingGroupId);\r\n return;\r\n }\r\n\r\n this._prepareResources();\r\n\r\n if (!this._colorShader.isReady()) {\r\n return;\r\n }\r\n\r\n const engine = this.scene.getEngine();\r\n engine.setDepthWrite(false);\r\n\r\n const transformMatrix = this.scene.getTransformMatrix();\r\n\r\n for (let boundingBoxIndex = 0; boundingBoxIndex < this.renderList.length; boundingBoxIndex++) {\r\n const boundingBox = this.renderList.data[boundingBoxIndex];\r\n if (boundingBox._tag !== renderingGroupId) {\r\n continue;\r\n }\r\n\r\n this._createWrappersForBoundingBox(boundingBox);\r\n this.onBeforeBoxRenderingObservable.notifyObservers(boundingBox);\r\n\r\n const min = boundingBox.minimum;\r\n const max = boundingBox.maximum;\r\n const diff = max.subtract(min);\r\n const median = min.add(diff.scale(0.5));\r\n\r\n const worldMatrix = Matrix.Scaling(diff.x, diff.y, diff.z)\r\n .multiply(Matrix.Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n\r\n const useReverseDepthBuffer = engine.useReverseDepthBuffer;\r\n\r\n if (this.showBackLines) {\r\n const drawWrapperBack = boundingBox._drawWrapperBack ?? this._colorShader._getDrawWrapper();\r\n\r\n this._colorShader._preBind(drawWrapperBack);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, <Effect>this._colorShader.getEffect());\r\n\r\n // Back\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToLessOrEqual();\r\n } else {\r\n engine.setDepthFunctionToGreaterOrEqual();\r\n }\r\n this._uniformBufferBack.bindToEffect(drawWrapperBack.effect!, \"BoundingBoxRenderer\");\r\n this._uniformBufferBack.updateColor4(\"color\", this.backColor, 1);\r\n this._uniformBufferBack.updateMatrix(\"world\", worldMatrix);\r\n this._uniformBufferBack.updateMatrix(\"viewProjection\", transformMatrix);\r\n this._uniformBufferBack.update();\r\n\r\n // Draw order\r\n engine.drawElementsType(Material.LineListDrawMode, 0, 24);\r\n }\r\n\r\n const drawWrapperFront = boundingBox._drawWrapperFront ?? this._colorShader._getDrawWrapper();\r\n\r\n this._colorShader._preBind(drawWrapperFront);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, <Effect>this._colorShader.getEffect());\r\n\r\n // Front\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToGreater();\r\n } else {\r\n engine.setDepthFunctionToLess();\r\n }\r\n this._uniformBufferFront.bindToEffect(drawWrapperFront.effect!, \"BoundingBoxRenderer\");\r\n this._uniformBufferFront.updateColor4(\"color\", this.frontColor, 1);\r\n this._uniformBufferFront.updateMatrix(\"world\", worldMatrix);\r\n this._uniformBufferFront.updateMatrix(\"viewProjection\", transformMatrix);\r\n this._uniformBufferFront.update();\r\n\r\n // Draw order\r\n engine.drawElementsType(Material.LineListDrawMode, 0, 24);\r\n\r\n this.onAfterBoxRenderingObservable.notifyObservers(boundingBox);\r\n }\r\n this._colorShader.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n }\r\n\r\n private _createWrappersForBoundingBox(boundingBox: BoundingBox | BoundingBoxRenderer): void {\r\n if (!boundingBox._drawWrapperFront) {\r\n const engine = this.scene.getEngine();\r\n\r\n boundingBox._drawWrapperFront = new DrawWrapper(engine);\r\n boundingBox._drawWrapperBack = new DrawWrapper(engine);\r\n\r\n boundingBox._drawWrapperFront.setEffect(this._colorShader.getEffect());\r\n boundingBox._drawWrapperBack.setEffect(this._colorShader.getEffect());\r\n }\r\n }\r\n\r\n /**\r\n * In case of occlusion queries, we can render the occlusion bounding box through this method\r\n * @param mesh Define the mesh to render the occlusion bounding box for\r\n */\r\n public renderOcclusionBoundingBox(mesh: AbstractMesh): void {\r\n const engine = this.scene.getEngine();\r\n\r\n if (this._renderPassIdForOcclusionQuery === undefined) {\r\n this._renderPassIdForOcclusionQuery = engine.createRenderPassId(`Render pass for occlusion query`);\r\n }\r\n\r\n const currentRenderPassId = engine.currentRenderPassId;\r\n\r\n engine.currentRenderPassId = this._renderPassIdForOcclusionQuery;\r\n\r\n this._prepareResources();\r\n\r\n const subMesh = mesh.subMeshes[0];\r\n\r\n if (!this._colorShaderForOcclusionQuery.isReady(mesh, undefined, subMesh) || !mesh.hasBoundingInfo) {\r\n engine.currentRenderPassId = currentRenderPassId;\r\n return;\r\n }\r\n\r\n if (!this._fillIndexBuffer) {\r\n this._fillIndexBuffer = engine.createIndexBuffer(this._fillIndexData!);\r\n }\r\n\r\n const useReverseDepthBuffer = engine.useReverseDepthBuffer;\r\n\r\n engine.setDepthWrite(false);\r\n engine.setColorWrite(false);\r\n\r\n const boundingBox = mesh.getBoundingInfo().boundingBox;\r\n const min = boundingBox.minimum;\r\n const max = boundingBox.maximum;\r\n const diff = max.subtract(min);\r\n const median = min.add(diff.scale(0.5));\r\n\r\n const worldMatrix = Matrix.Scaling(diff.x, diff.y, diff.z)\r\n .multiply(Matrix.Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n this._colorShaderForOcclusionQuery._preBind(drawWrapper);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._fillIndexBuffer, <Effect>drawWrapper.effect);\r\n\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToGreater();\r\n } else {\r\n engine.setDepthFunctionToLess();\r\n }\r\n\r\n this.scene.resetCachedMaterial();\r\n\r\n this._uniformBufferFront.bindToEffect(drawWrapper.effect!, \"BoundingBoxRenderer\");\r\n this._uniformBufferFront.updateMatrix(\"world\", worldMatrix);\r\n this._uniformBufferFront.updateMatrix(\"viewProjection\", this.scene.getTransformMatrix());\r\n this._uniformBufferFront.update();\r\n\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 36);\r\n\r\n this._colorShaderForOcclusionQuery.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n engine.setColorWrite(true);\r\n\r\n engine.currentRenderPassId = currentRenderPassId;\r\n }\r\n\r\n /**\r\n * Sets whether to use instanced rendering.\r\n * When not enabled, BoundingBoxRenderer renders in a loop,\r\n * calling engine.drawElementsType for each bounding box in renderList,\r\n * making every bounding box 1 or 2 draw call.\r\n * When enabled, it collects bounding boxes to render,\r\n * and render all boxes in 1 or 2 draw call.\r\n * This could make the rendering with many bounding boxes much faster than not enabled,\r\n * but could result in a difference in rendering result if\r\n * {@link BoundingBoxRenderer.showBackLines} enabled,\r\n * because drawing the black/white part of each box one after the other\r\n * can be different from drawing the black part of all boxes and then the white part.\r\n * Also, when enabled, events of {@link BoundingBoxRenderer.onBeforeBoxRenderingObservable}\r\n * and {@link BoundingBoxRenderer.onAfterBoxRenderingObservable} would only be triggered once\r\n * for one rendering, instead of once every bounding box.\r\n * Events would be triggered with a dummy box to keep backwards compatibility,\r\n * the passed bounding box has no meaning and should be ignored.\r\n * @param val whether to use instanced rendering\r\n */\r\n public set useInstances(val: boolean) {\r\n this._useInstances = val;\r\n if (this._colorShader) {\r\n this._colorShader.setDefine(\"INSTANCES\", val);\r\n }\r\n if (!val) {\r\n this._cleanupInstances();\r\n }\r\n }\r\n\r\n public get useInstances(): boolean {\r\n return this._useInstances;\r\n }\r\n\r\n /**\r\n * Instanced render the bounding boxes of a specific rendering group\r\n * @param renderingGroupId defines the rendering group to render\r\n */\r\n private _renderInstanced(renderingGroupId: number): void {\r\n if (this.renderList.length === 0 || !this.enabled) {\r\n return;\r\n }\r\n this._prepareResources();\r\n\r\n if (!this._colorShader.isReady()) {\r\n return;\r\n }\r\n\r\n const colorShader = this._colorShader;\r\n let matrices = this._matrices;\r\n const expectedLength = this.renderList.length * 16;\r\n if (!matrices || matrices.length < expectedLength || matrices.length > expectedLength * 2) {\r\n matrices = new Float32Array(expectedLength);\r\n this._matrices = matrices;\r\n }\r\n\r\n this.onBeforeBoxRenderingObservable.notifyObservers(dummyBoundingBox);\r\n\r\n let instancesCount = 0;\r\n\r\n for (let boundingBoxIndex = 0; boundingBoxIndex < this.renderList.length; boundingBoxIndex++) {\r\n const boundingBox = this.renderList.data[boundingBoxIndex];\r\n if (boundingBox._tag !== renderingGroupId) {\r\n continue;\r\n }\r\n\r\n const min = boundingBox.minimum;\r\n const max = boundingBox.maximum;\r\n\r\n const diff = max.subtractToRef(min, tempVec2);\r\n const median = min.addToRef(diff.scaleToRef(0.5, tempVec1), tempVec1);\r\n\r\n const m = tempMatrixArray;\r\n\r\n // Directly update the matrix values in column-major order\r\n m[0] = diff._x; // Scale X\r\n m[3] = median._x; // Translate X\r\n\r\n m[5] = diff._y; // Scale Y\r\n m[7] = median._y; // Translate Y\r\n\r\n m[10] = diff._z; // Scale Z\r\n m[11] = median._z; // Translate Z\r\n tempMatrix.multiplyToArray(boundingBox.getWorldMatrix(), matrices, instancesCount * 16);\r\n\r\n instancesCount++;\r\n }\r\n\r\n const engine = this.scene.getEngine();\r\n // keeps the original depth function and depth write\r\n const depthFunction = engine.getDepthFunction() ?? Constants.LEQUAL;\r\n const depthWrite = engine.getDepthWrite();\r\n engine.setDepthWrite(false);\r\n const matrixBuffer = this._matrixBuffer;\r\n if (matrixBuffer?.isUpdatable() && matrixBuffer.getData() === matrices) {\r\n matrixBuffer.update(matrices);\r\n } else {\r\n this._createInstanceBuffer(matrices);\r\n }\r\n\r\n this._createWrappersForBoundingBox(this);\r\n\r\n const useReverseDepthBuffer = engine.useReverseDepthBuffer;\r\n const transformMatrix = this.scene.getTransformMatrix();\r\n\r\n if (this.showBackLines) {\r\n const drawWrapperBack = this._drawWrapperBack ?? colorShader._getDrawWrapper();\r\n\r\n colorShader._preBind(drawWrapperBack);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, colorShader.getEffect());\r\n\r\n // Back\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToLessOrEqual();\r\n } else {\r\n engine.setDepthFunctionToGreaterOrEqual();\r\n }\r\n const _uniformBufferBack: UniformBuffer = this._uniformBufferBack;\r\n\r\n _uniformBufferBack.bindToEffect(drawWrapperBack.effect!, \"BoundingBoxRenderer\");\r\n _uniformBufferBack.updateColor4(\"color\", this.backColor, 1);\r\n _uniformBufferBack.updateMatrix(\"viewProjection\", transformMatrix);\r\n _uniformBufferBack.update();\r\n\r\n // Draw order\r\n engine.drawElementsType(Material.LineListDrawMode, 0, 24, instancesCount);\r\n }\r\n\r\n const drawWrapperFront = colorShader._getDrawWrapper();\r\n\r\n colorShader._preBind(drawWrapperFront);\r\n\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, colorShader.getEffect());\r\n\r\n // Front\r\n if (useReverseDepthBuffer) {\r\n engine.setDepthFunctionToGreater();\r\n } else {\r\n engine.setDepthFunctionToLess();\r\n }\r\n const _uniformBufferFront: UniformBuffer = this._uniformBufferFront;\r\n _uniformBufferFront.bindToEffect(drawWrapperFront.effect!, \"BoundingBoxRenderer\");\r\n _uniformBufferFront.updateColor4(\"color\", this.frontColor, 1);\r\n _uniformBufferFront.updateMatrix(\"viewProjection\", transformMatrix);\r\n _uniformBufferFront.update();\r\n\r\n // Draw order\r\n engine.drawElementsType(Material.LineListDrawMode, 0, 24, instancesCount);\r\n\r\n this.onAfterBoxRenderingObservable.notifyObservers(dummyBoundingBox);\r\n\r\n colorShader.unbind();\r\n engine.setDepthFunction(depthFunction);\r\n engine.setDepthWrite(depthWrite);\r\n }\r\n\r\n /**\r\n * Creates buffer for instanced rendering\r\n * @param buffer buffer to set\r\n */\r\n private _createInstanceBuffer(buffer: Float32Array): void {\r\n const vertexBuffers = this._vertexBuffers;\r\n this._cleanupInstanceBuffer();\r\n const matrixBuffer = new Buffer(this.scene.getEngine(), buffer, true, 16, false, true);\r\n\r\n vertexBuffers.world0 = matrixBuffer.createVertexBuffer(\"world0\", 0, 4);\r\n vertexBuffers.world1 = matrixBuffer.createVertexBuffer(\"world1\", 4, 4);\r\n vertexBuffers.world2 = matrixBuffer.createVertexBuffer(\"world2\", 8, 4);\r\n vertexBuffers.world3 = matrixBuffer.createVertexBuffer(\"world3\", 12, 4);\r\n\r\n this._matrixBuffer = matrixBuffer;\r\n }\r\n\r\n /**\r\n * Clean up buffers for instanced rendering\r\n */\r\n private _cleanupInstanceBuffer(): void {\r\n const vertexBuffers = this._vertexBuffers;\r\n if (vertexBuffers.world0) {\r\n vertexBuffers.world0.dispose();\r\n delete vertexBuffers.world0;\r\n }\r\n if (vertexBuffers.world1) {\r\n vertexBuffers.world1.dispose();\r\n delete vertexBuffers.world1;\r\n }\r\n if (vertexBuffers.world2) {\r\n vertexBuffers.world2.dispose();\r\n delete vertexBuffers.world2;\r\n }\r\n if (vertexBuffers.world3) {\r\n vertexBuffers.world3.dispose();\r\n delete vertexBuffers.world3;\r\n }\r\n this._matrices = null;\r\n if (this._matrixBuffer) {\r\n this._matrixBuffer.dispose();\r\n this._matrixBuffer = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clean up resources for instanced rendering\r\n */\r\n private _cleanupInstances(): void {\r\n this._cleanupInstanceBuffer();\r\n if (this._drawWrapperFront) {\r\n this._drawWrapperFront.dispose();\r\n this._drawWrapperFront = null;\r\n }\r\n if (this._drawWrapperBack) {\r\n this._drawWrapperBack.dispose();\r\n this._drawWrapperBack = null;\r\n }\r\n }\r\n\r\n /**\r\n * Dispose and release the resources attached to this renderer.\r\n */\r\n public dispose(): void {\r\n if (this._renderPassIdForOcclusionQuery !== undefined) {\r\n this.scene.getEngine().releaseRenderPassId(this._renderPassIdForOcclusionQuery);\r\n this._renderPassIdForOcclusionQuery = undefined as any;\r\n }\r\n\r\n if (!this._colorShader) {\r\n return;\r\n }\r\n\r\n this.onBeforeBoxRenderingObservable.clear();\r\n this.onAfterBoxRenderingObservable.clear();\r\n this.onResourcesReadyObservable.clear();\r\n\r\n this.renderList.dispose();\r\n\r\n this._colorShader.dispose();\r\n this._colorShaderForOcclusionQuery.dispose();\r\n\r\n this._uniformBufferFront.dispose();\r\n this._uniformBufferBack.dispose();\r\n\r\n const buffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\r\n }\r\n this.scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n\r\n if (this._fillIndexBuffer) {\r\n this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer);\r\n this._fillIndexBuffer = null;\r\n }\r\n this._cleanupInstances();\r\n }\r\n}\r\n"]}
|
|
@@ -91,6 +91,10 @@ export class EdgesRenderer {
|
|
|
91
91
|
shader.backFaceCulling = false;
|
|
92
92
|
shader.checkReadyOnEveryCall = scene.getEngine().isWebGPU;
|
|
93
93
|
scene._edgeRenderLineShader = shader;
|
|
94
|
+
scene.onDisposeObservable.add(() => {
|
|
95
|
+
scene._edgeRenderLineShader.dispose();
|
|
96
|
+
scene._edgeRenderLineShader = null;
|
|
97
|
+
});
|
|
94
98
|
}
|
|
95
99
|
return scene._edgeRenderLineShader;
|
|
96
100
|
}
|
|
@@ -196,7 +200,6 @@ export class EdgesRenderer {
|
|
|
196
200
|
if (this._ib) {
|
|
197
201
|
this._source.getScene().getEngine()._releaseBuffer(this._ib);
|
|
198
202
|
}
|
|
199
|
-
this._lineShader.dispose();
|
|
200
203
|
this._drawWrapper?.dispose();
|
|
201
204
|
}
|
|
202
205
|
_processEdgeForAdjacencies(pa, pb, p0, p1, p2) {
|