@babylonjs/core 7.52.2 → 7.53.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/abstractAudioBus.d.ts +11 -0
- package/AudioV2/abstractAudio/abstractAudioBus.js +10 -0
- package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +10 -3
- package/AudioV2/abstractAudio/abstractSound.js +10 -0
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/audioBus.d.ts +4 -4
- package/AudioV2/abstractAudio/audioBus.js.map +1 -1
- package/AudioV2/abstractAudio/mainAudioBus.d.ts +2 -2
- package/AudioV2/abstractAudio/mainAudioBus.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +5 -5
- package/AudioV2/abstractAudio/staticSound.js +3 -3
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
- package/AudioV2/abstractAudio/streamingSound.js +1 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +30 -9
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +52 -26
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.d.ts +24 -0
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js +30 -0
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.d.ts +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.js +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.d.ts +86 -0
- package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js +29 -0
- package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.d.ts +35 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +96 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/index.d.ts +1 -0
- package/AudioV2/abstractAudio/subProperties/index.js +1 -0
- package/AudioV2/abstractAudio/subProperties/index.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +10 -5
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.d.ts +37 -0
- package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js +85 -0
- package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.d.ts +5 -3
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +25 -2
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.d.ts +2 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +33 -18
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +0 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -57
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +6 -0
- package/Engines/abstractEngine.js +3 -3
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.common.js +4 -0
- package/Engines/engine.common.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -0
- package/Engines/nativeEngine.js +3 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +1 -0
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -0
- package/Engines/thinEngine.js +7 -4
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +2 -1
- package/Engines/webgpuEngine.js +12 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +3 -12
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -36
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +5 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +17 -4
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.d.ts +48 -0
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js +54 -0
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +3 -11
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +5 -14
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/index.d.ts +1 -0
- package/FlowGraph/Blocks/Data/index.js +1 -0
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +19 -13
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -5
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +2 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +1 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +2 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphInteger.d.ts +1 -0
- package/FlowGraph/CustomTypes/flowGraphInteger.js +3 -0
- package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +2 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +6 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.d.ts +1 -0
- package/FlowGraph/flowGraphExecutionBlock.js +4 -0
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/utils.d.ts +2 -1
- package/FlowGraph/utils.js +7 -2
- package/FlowGraph/utils.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.d.ts +126 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +497 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +30 -4
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +2 -3
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -4
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +2 -2
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +2 -3
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +4 -5
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +6 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +14 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +11 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +18 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +76 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +170 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js +45 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +10 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +29 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +7 -3
- package/FrameGraph/frameGraph.js +10 -4
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +2 -1
- package/FrameGraph/frameGraphTextureManager.js +4 -3
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +3 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/effectRenderer.js +1 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/material.js +5 -3
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +7 -5
- package/Materials/materialHelper.geometryrendering.js +8 -3
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +2 -0
- package/Meshes/Builders/shapeBuilder.js +7 -4
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/geometry.js +4 -0
- package/Meshes/geometry.js.map +1 -1
- package/Particles/particleSystemComponent.d.ts +2 -1
- package/Particles/particleSystemComponent.js +2 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +23 -30
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +226 -411
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.d.ts +222 -0
- package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js +373 -0
- package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js.map +1 -0
- package/PostProcesses/postProcess.d.ts +5 -0
- package/PostProcesses/postProcess.js +10 -2
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinDepthOfFieldEffect.d.ts +4 -4
- package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -1
- package/PostProcesses/thinSSRBlurCombinerPostProcess.d.ts +41 -0
- package/PostProcesses/thinSSRBlurCombinerPostProcess.js +185 -0
- package/PostProcesses/thinSSRBlurCombinerPostProcess.js.map +1 -0
- package/PostProcesses/thinSSRBlurPostProcess.d.ts +18 -0
- package/PostProcesses/thinSSRBlurPostProcess.js +47 -0
- package/PostProcesses/thinSSRBlurPostProcess.js.map +1 -0
- package/PostProcesses/thinSSRPostProcess.d.ts +94 -0
- package/PostProcesses/thinSSRPostProcess.js +416 -0
- package/PostProcesses/thinSSRPostProcess.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +2 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/iblCdfGenerator.js +1 -1
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js +13 -2
- package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +1 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js +13 -2
- package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
|
|
2
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
3
|
+
import { ThinSSRRenderingPipeline } from "../../../PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js";
|
|
4
|
+
import { FrameGraphSSRTask } from "./ssrTask.js";
|
|
5
|
+
import { FrameGraphSSRBlurTask } from "./ssrBlurTask.js";
|
|
6
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask.js";
|
|
7
|
+
/**
|
|
8
|
+
* Task which applies a SSR post process.
|
|
9
|
+
*/
|
|
10
|
+
export class FrameGraphSSRRenderingPipelineTask extends FrameGraphTask {
|
|
11
|
+
/**
|
|
12
|
+
* The camera used to render the scene.
|
|
13
|
+
*/
|
|
14
|
+
get camera() {
|
|
15
|
+
return this._camera;
|
|
16
|
+
}
|
|
17
|
+
set camera(camera) {
|
|
18
|
+
if (camera === this._camera) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
this._camera = camera;
|
|
22
|
+
this.ssr.camera = camera;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The name of the task.
|
|
26
|
+
*/
|
|
27
|
+
get name() {
|
|
28
|
+
return this._name;
|
|
29
|
+
}
|
|
30
|
+
set name(name) {
|
|
31
|
+
this._name = name;
|
|
32
|
+
if (this._ssr) {
|
|
33
|
+
this._ssr.name = `${name} SSR`;
|
|
34
|
+
}
|
|
35
|
+
if (this._ssrBlurX) {
|
|
36
|
+
this._ssrBlurX.name = `${name} SSR Blur X`;
|
|
37
|
+
}
|
|
38
|
+
if (this._ssrBlurY) {
|
|
39
|
+
this._ssrBlurY.name = `${name} SSR Blur Y`;
|
|
40
|
+
}
|
|
41
|
+
if (this._ssrBlurCombiner) {
|
|
42
|
+
this._ssrBlurCombiner.name = `${name} SSR Blur Combiner`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Constructs a SSR rendering pipeline task.
|
|
47
|
+
* @param name The name of the task.
|
|
48
|
+
* @param frameGraph The frame graph this task belongs to.
|
|
49
|
+
* @param textureType The texture type used by the different post processes created by SSR (default: 0)
|
|
50
|
+
*/
|
|
51
|
+
constructor(name, frameGraph, textureType = 0) {
|
|
52
|
+
super(name, frameGraph);
|
|
53
|
+
/**
|
|
54
|
+
* The sampling mode to use for the source texture.
|
|
55
|
+
*/
|
|
56
|
+
this.sourceSamplingMode = 2;
|
|
57
|
+
this.textureType = textureType;
|
|
58
|
+
this.ssr = new ThinSSRRenderingPipeline(name, frameGraph.scene);
|
|
59
|
+
this._ssr = new FrameGraphSSRTask(`${name} SSR`, this._frameGraph, this.ssr._ssrPostProcess);
|
|
60
|
+
this._ssrBlurX = new FrameGraphSSRBlurTask(`${name} SSR Blur X`, this._frameGraph, this.ssr._ssrBlurXPostProcess);
|
|
61
|
+
this._ssrBlurY = new FrameGraphSSRBlurTask(`${name} SSR Blur Y`, this._frameGraph, this.ssr._ssrBlurYPostProcess);
|
|
62
|
+
this._ssrBlurCombiner = new FrameGraphPostProcessTask(`${name} SSR Blur Combiner`, this._frameGraph, this.ssr._ssrBlurCombinerPostProcess);
|
|
63
|
+
this.onTexturesAllocatedObservable.add((context) => {
|
|
64
|
+
this._ssr.onTexturesAllocatedObservable.notifyObservers(context);
|
|
65
|
+
// We should not forward the notification if blur is not enabled
|
|
66
|
+
if (this.ssr.blurDispersionStrength !== 0) {
|
|
67
|
+
this._ssrBlurX.onTexturesAllocatedObservable.notifyObservers(context);
|
|
68
|
+
this._ssrBlurY.onTexturesAllocatedObservable.notifyObservers(context);
|
|
69
|
+
this._ssrBlurCombiner.onTexturesAllocatedObservable.notifyObservers(context);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();
|
|
73
|
+
}
|
|
74
|
+
isReady() {
|
|
75
|
+
return this.ssr.isReady();
|
|
76
|
+
}
|
|
77
|
+
record() {
|
|
78
|
+
if (this.sourceTexture === undefined ||
|
|
79
|
+
this.normalTexture === undefined ||
|
|
80
|
+
this.depthTexture === undefined ||
|
|
81
|
+
this.reflectivityTexture === undefined ||
|
|
82
|
+
this.camera === undefined) {
|
|
83
|
+
throw new Error(`FrameGraphSSRRenderingPipelineTask "${this.name}": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required`);
|
|
84
|
+
}
|
|
85
|
+
const sourceTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);
|
|
86
|
+
this._ssr.sourceTexture = this.sourceTexture;
|
|
87
|
+
this._ssr.sourceSamplingMode = this.sourceSamplingMode;
|
|
88
|
+
this._ssr.camera = this.camera;
|
|
89
|
+
this._ssr.normalTexture = this.normalTexture;
|
|
90
|
+
this._ssr.depthTexture = this.depthTexture;
|
|
91
|
+
this._ssr.backDepthTexture = this.backDepthTexture;
|
|
92
|
+
this._ssr.reflectivityTexture = this.reflectivityTexture;
|
|
93
|
+
let ssrTextureHandle;
|
|
94
|
+
const textureSize = {
|
|
95
|
+
width: Math.floor(sourceTextureDescription.size.width / (this.ssr.ssrDownsample + 1)),
|
|
96
|
+
height: Math.floor(sourceTextureDescription.size.height / (this.ssr.ssrDownsample + 1)),
|
|
97
|
+
};
|
|
98
|
+
const textureCreationOptions = {
|
|
99
|
+
size: textureSize,
|
|
100
|
+
options: {
|
|
101
|
+
createMipMaps: false,
|
|
102
|
+
types: [this.textureType],
|
|
103
|
+
formats: [5],
|
|
104
|
+
samples: 1,
|
|
105
|
+
useSRGBBuffers: [false],
|
|
106
|
+
labels: [""],
|
|
107
|
+
},
|
|
108
|
+
sizeIsPercentage: false,
|
|
109
|
+
};
|
|
110
|
+
if (this.ssr.blurDispersionStrength > 0 || !this.destinationTexture) {
|
|
111
|
+
ssrTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._ssr.name, textureCreationOptions);
|
|
112
|
+
}
|
|
113
|
+
if (this.ssr.blurDispersionStrength === 0) {
|
|
114
|
+
this._ssr.destinationTexture = this.outputTexture;
|
|
115
|
+
if (ssrTextureHandle !== undefined) {
|
|
116
|
+
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, ssrTextureHandle);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);
|
|
120
|
+
}
|
|
121
|
+
this._ssr.record(true);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this._ssr.destinationTexture = ssrTextureHandle;
|
|
125
|
+
this._ssr.record(true);
|
|
126
|
+
textureSize.width = Math.floor(sourceTextureDescription.size.width / (this.ssr.blurDownsample + 1));
|
|
127
|
+
textureSize.height = Math.floor(sourceTextureDescription.size.height / (this.ssr.blurDownsample + 1));
|
|
128
|
+
const sourceTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);
|
|
129
|
+
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this.name + " Output", sourceTextureCreationOptions);
|
|
130
|
+
const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._ssrBlurX.name, textureCreationOptions);
|
|
131
|
+
this._ssrBlurX.sourceTexture = ssrTextureHandle;
|
|
132
|
+
this._ssrBlurX.sourceSamplingMode = 2;
|
|
133
|
+
this._ssrBlurX.destinationTexture = blurXTextureHandle;
|
|
134
|
+
this._ssrBlurX.record(true);
|
|
135
|
+
const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._ssrBlurY.name, textureCreationOptions);
|
|
136
|
+
this._ssrBlurY.sourceTexture = blurXTextureHandle;
|
|
137
|
+
this._ssrBlurY.sourceSamplingMode = 2;
|
|
138
|
+
this._ssrBlurY.destinationTexture = blurYTextureHandle;
|
|
139
|
+
this._ssrBlurY.record(true);
|
|
140
|
+
this._ssrBlurCombiner.sourceTexture = this.sourceTexture;
|
|
141
|
+
this._ssrBlurCombiner.sourceSamplingMode = this.sourceSamplingMode;
|
|
142
|
+
this._ssrBlurCombiner.destinationTexture = this.outputTexture;
|
|
143
|
+
const combinerPass = this._ssrBlurCombiner.record(true, undefined, (context) => {
|
|
144
|
+
context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect, "mainSampler", this.sourceTexture);
|
|
145
|
+
context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect, "textureSampler", blurYTextureHandle);
|
|
146
|
+
context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect, "reflectivitySampler", this.reflectivityTexture);
|
|
147
|
+
if (this.ssr.useFresnel) {
|
|
148
|
+
context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect, "normalSampler", this.normalTexture);
|
|
149
|
+
context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect, "depthSampler", this.depthTexture);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
combinerPass.addDependencies(blurYTextureHandle);
|
|
153
|
+
}
|
|
154
|
+
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
155
|
+
passDisabled.addDependencies(this.sourceTexture);
|
|
156
|
+
passDisabled.setRenderTarget(this.outputTexture);
|
|
157
|
+
passDisabled.setExecuteFunc((context) => {
|
|
158
|
+
context.copyTexture(this.sourceTexture);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
dispose() {
|
|
162
|
+
this._ssr.dispose();
|
|
163
|
+
this._ssrBlurX.dispose();
|
|
164
|
+
this._ssrBlurY.dispose();
|
|
165
|
+
this._ssrBlurCombiner.dispose();
|
|
166
|
+
this.ssr.dispose();
|
|
167
|
+
super.dispose();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=ssrRenderingPipelineTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssrRenderingPipelineTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,oFAA6E;AAChH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,cAAc;IAmClE;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;IAC7B,CAAC;IAiBD;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAoB,IAAI,CAAC,IAAY;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC;QACnC,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,GAAG,IAAI,aAAa,CAA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,GAAG,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureHandle, Camera, FrameGraphTextureCreationOptions } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ThinSSRRenderingPipeline } from \"core/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline\";\r\nimport { FrameGraphSSRTask } from \"./ssrTask\";\r\nimport { FrameGraphSSRBlurTask } from \"./ssrBlurTask\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * Task which applies a SSR post process.\r\n */\r\nexport class FrameGraphSSRRenderingPipelineTask extends FrameGraphTask {\r\n /**\r\n * The source texture to apply the SSR effect on.\r\n */\r\n public sourceTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The sampling mode to use for the source texture.\r\n */\r\n public sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n /**\r\n * The normal texture used by the SSR effect.\r\n */\r\n public normalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth texture used by the SSR effect.\r\n */\r\n public depthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The back depth texture used by the SSR effect (optional).\r\n * This is used when automatic thickness computation is enabled.\r\n * The back depth texture is the depth texture of the scene rendered for the back side of the objects (that is, front faces are culled).\r\n */\r\n public backDepthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The reflectivity texture used by the SSR effect\r\n */\r\n public reflectivityTexture: FrameGraphTextureHandle;\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * The camera used to render the scene.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n if (camera === this._camera) {\r\n return;\r\n }\r\n\r\n this._camera = camera;\r\n\r\n this.ssr.camera = camera;\r\n }\r\n\r\n /**\r\n * The destination texture to render the SSR effect to.\r\n */\r\n public destinationTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture of the SSR effect.\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The SSR Rendering pipeline.\r\n */\r\n public readonly ssr: ThinSSRRenderingPipeline;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this._ssr) {\r\n this._ssr.name = `${name} SSR`;\r\n }\r\n if (this._ssrBlurX) {\r\n this._ssrBlurX.name = `${name} SSR Blur X`;\r\n }\r\n if (this._ssrBlurY) {\r\n this._ssrBlurY.name = `${name} SSR Blur Y`;\r\n }\r\n if (this._ssrBlurCombiner) {\r\n this._ssrBlurCombiner.name = `${name} SSR Blur Combiner`;\r\n }\r\n }\r\n\r\n /**\r\n * The texture type used by the different post processes created by SSR.\r\n * It's a read-only property. If you want to change it, you must recreate the task and pass the appropriate texture type to the constructor.\r\n */\r\n public readonly textureType: number;\r\n\r\n private readonly _ssr: FrameGraphSSRTask;\r\n private readonly _ssrBlurX: FrameGraphSSRBlurTask;\r\n private readonly _ssrBlurY: FrameGraphSSRBlurTask;\r\n private readonly _ssrBlurCombiner: FrameGraphPostProcessTask;\r\n\r\n /**\r\n * Constructs a SSR rendering pipeline task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task belongs to.\r\n * @param textureType The texture type used by the different post processes created by SSR (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE) {\r\n super(name, frameGraph);\r\n\r\n this.textureType = textureType;\r\n\r\n this.ssr = new ThinSSRRenderingPipeline(name, frameGraph.scene);\r\n\r\n this._ssr = new FrameGraphSSRTask(`${name} SSR`, this._frameGraph, this.ssr._ssrPostProcess);\r\n this._ssrBlurX = new FrameGraphSSRBlurTask(`${name} SSR Blur X`, this._frameGraph, this.ssr._ssrBlurXPostProcess);\r\n this._ssrBlurY = new FrameGraphSSRBlurTask(`${name} SSR Blur Y`, this._frameGraph, this.ssr._ssrBlurYPostProcess);\r\n this._ssrBlurCombiner = new FrameGraphPostProcessTask(`${name} SSR Blur Combiner`, this._frameGraph, this.ssr._ssrBlurCombinerPostProcess);\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n this._ssr.onTexturesAllocatedObservable.notifyObservers(context);\r\n // We should not forward the notification if blur is not enabled\r\n if (this.ssr.blurDispersionStrength !== 0) {\r\n this._ssrBlurX.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._ssrBlurY.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._ssrBlurCombiner.onTexturesAllocatedObservable.notifyObservers(context);\r\n }\r\n });\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.ssr.isReady();\r\n }\r\n\r\n public record(): void {\r\n if (\r\n this.sourceTexture === undefined ||\r\n this.normalTexture === undefined ||\r\n this.depthTexture === undefined ||\r\n this.reflectivityTexture === undefined ||\r\n this.camera === undefined\r\n ) {\r\n throw new Error(`FrameGraphSSRRenderingPipelineTask \"${this.name}\": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required`);\r\n }\r\n\r\n const sourceTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);\r\n\r\n this._ssr.sourceTexture = this.sourceTexture;\r\n this._ssr.sourceSamplingMode = this.sourceSamplingMode;\r\n this._ssr.camera = this.camera;\r\n this._ssr.normalTexture = this.normalTexture;\r\n this._ssr.depthTexture = this.depthTexture;\r\n this._ssr.backDepthTexture = this.backDepthTexture;\r\n this._ssr.reflectivityTexture = this.reflectivityTexture;\r\n\r\n let ssrTextureHandle: FrameGraphTextureHandle | undefined;\r\n\r\n const textureSize = {\r\n width: Math.floor(sourceTextureDescription.size.width / (this.ssr.ssrDownsample + 1)),\r\n height: Math.floor(sourceTextureDescription.size.height / (this.ssr.ssrDownsample + 1)),\r\n };\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: textureSize,\r\n options: {\r\n createMipMaps: false,\r\n types: [this.textureType],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n labels: [\"\"],\r\n },\r\n sizeIsPercentage: false,\r\n };\r\n\r\n if (this.ssr.blurDispersionStrength > 0 || !this.destinationTexture) {\r\n ssrTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._ssr.name, textureCreationOptions);\r\n }\r\n\r\n if (this.ssr.blurDispersionStrength === 0) {\r\n this._ssr.destinationTexture = this.outputTexture;\r\n\r\n if (ssrTextureHandle !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, ssrTextureHandle);\r\n } else {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);\r\n }\r\n\r\n this._ssr.record(true);\r\n } else {\r\n this._ssr.destinationTexture = ssrTextureHandle;\r\n this._ssr.record(true);\r\n\r\n textureSize.width = Math.floor(sourceTextureDescription.size.width / (this.ssr.blurDownsample + 1));\r\n textureSize.height = Math.floor(sourceTextureDescription.size.height / (this.ssr.blurDownsample + 1));\r\n\r\n const sourceTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this.name + \" Output\", sourceTextureCreationOptions);\r\n\r\n const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._ssrBlurX.name, textureCreationOptions);\r\n\r\n this._ssrBlurX.sourceTexture = ssrTextureHandle!;\r\n this._ssrBlurX.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._ssrBlurX.destinationTexture = blurXTextureHandle;\r\n this._ssrBlurX.record(true);\r\n\r\n const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._ssrBlurY.name, textureCreationOptions);\r\n\r\n this._ssrBlurY.sourceTexture = blurXTextureHandle;\r\n this._ssrBlurY.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._ssrBlurY.destinationTexture = blurYTextureHandle;\r\n this._ssrBlurY.record(true);\r\n\r\n this._ssrBlurCombiner.sourceTexture = this.sourceTexture;\r\n this._ssrBlurCombiner.sourceSamplingMode = this.sourceSamplingMode;\r\n this._ssrBlurCombiner.destinationTexture = this.outputTexture;\r\n const combinerPass = this._ssrBlurCombiner.record(true, undefined, (context) => {\r\n context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect!, \"mainSampler\", this.sourceTexture);\r\n context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect!, \"textureSampler\", blurYTextureHandle);\r\n context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect!, \"reflectivitySampler\", this.reflectivityTexture);\r\n if (this.ssr.useFresnel) {\r\n context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect!, \"normalSampler\", this.normalTexture);\r\n context.bindTextureHandle(this._ssrBlurCombiner.drawWrapper.effect!, \"depthSampler\", this.depthTexture);\r\n }\r\n });\r\n\r\n combinerPass.addDependencies(blurYTextureHandle);\r\n }\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.addDependencies(this.sourceTexture);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.sourceTexture);\r\n });\r\n }\r\n\r\n public override dispose(): void {\r\n this._ssr.dispose();\r\n this._ssrBlurX.dispose();\r\n this._ssrBlurY.dispose();\r\n this._ssrBlurCombiner.dispose();\r\n this.ssr.dispose();\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FrameGraph, FrameGraphRenderPass, Camera, FrameGraphTextureHandle } from "../../../index.js";
|
|
2
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask";
|
|
3
|
+
import { ThinSSRPostProcess } from "../../../PostProcesses/thinSSRPostProcess.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameGraphSSRTask extends FrameGraphPostProcessTask {
|
|
8
|
+
normalTexture: FrameGraphTextureHandle;
|
|
9
|
+
depthTexture: FrameGraphTextureHandle;
|
|
10
|
+
reflectivityTexture: FrameGraphTextureHandle;
|
|
11
|
+
backDepthTexture?: FrameGraphTextureHandle;
|
|
12
|
+
camera: Camera;
|
|
13
|
+
readonly postProcess: ThinSSRPostProcess;
|
|
14
|
+
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinSSRPostProcess);
|
|
15
|
+
record(skipCreationOfDisabledPasses?: boolean): FrameGraphRenderPass;
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask.js";
|
|
3
|
+
import { ThinSSRPostProcess } from "../../../PostProcesses/thinSSRPostProcess.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export class FrameGraphSSRTask extends FrameGraphPostProcessTask {
|
|
8
|
+
constructor(name, frameGraph, thinPostProcess) {
|
|
9
|
+
super(name, frameGraph, thinPostProcess || new ThinSSRPostProcess(name, frameGraph.scene));
|
|
10
|
+
this.onTexturesAllocatedObservable.add((context) => {
|
|
11
|
+
context.setTextureSamplingMode(this.normalTexture, 2);
|
|
12
|
+
context.setTextureSamplingMode(this.depthTexture, 2);
|
|
13
|
+
context.setTextureSamplingMode(this.reflectivityTexture, 2);
|
|
14
|
+
if (this.backDepthTexture) {
|
|
15
|
+
context.setTextureSamplingMode(this.backDepthTexture, 1);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
record(skipCreationOfDisabledPasses = false) {
|
|
20
|
+
if (this.sourceTexture === undefined ||
|
|
21
|
+
this.normalTexture === undefined ||
|
|
22
|
+
this.depthTexture === undefined ||
|
|
23
|
+
this.reflectivityTexture === undefined ||
|
|
24
|
+
this.camera === undefined) {
|
|
25
|
+
throw new Error(`FrameGraphSSRTask "${this.name}": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required`);
|
|
26
|
+
}
|
|
27
|
+
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
|
|
28
|
+
this.postProcess.camera = this.camera;
|
|
29
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "normalSampler", this.normalTexture);
|
|
30
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "depthSampler", this.depthTexture);
|
|
31
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "reflectivitySampler", this.reflectivityTexture);
|
|
32
|
+
if (this.backDepthTexture) {
|
|
33
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "backDepthSampler", this.backDepthTexture);
|
|
34
|
+
}
|
|
35
|
+
if (this.postProcess.enableAutomaticThicknessComputation) {
|
|
36
|
+
this._postProcessDrawWrapper.effect.setFloat("backSizeFactor", 1);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
pass.addDependencies([this.normalTexture, this.depthTexture, this.reflectivityTexture]);
|
|
40
|
+
this.postProcess.textureWidth = this._sourceWidth;
|
|
41
|
+
this.postProcess.textureHeight = this._sourceHeight;
|
|
42
|
+
return pass;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ssrTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssrTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/ssrTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,yBA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OAAO,EAAE,EAAE;YAC3E,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAEtC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACrG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YACnG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACjH,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC/G,CAAC;YACD,IAAI,IAAI,CAAC,WAAW,CAAC,mCAAmC,EAAE,CAAC;gBACvD,IAAI,CAAC,uBAAuB,CAAC,MAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;YACvE,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAExF,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAClD,IAAI,CAAC,WAAW,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QAEpD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphRenderPass, Camera, FrameGraphTextureHandle } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\nimport { ThinSSRPostProcess } from \"core/PostProcesses/thinSSRPostProcess\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class FrameGraphSSRTask extends FrameGraphPostProcessTask {\r\n public normalTexture: FrameGraphTextureHandle;\r\n\r\n public depthTexture: FrameGraphTextureHandle;\r\n\r\n public reflectivityTexture: FrameGraphTextureHandle;\r\n\r\n public backDepthTexture?: FrameGraphTextureHandle;\r\n\r\n public camera: Camera;\r\n\r\n public override readonly postProcess: ThinSSRPostProcess;\r\n\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinSSRPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinSSRPostProcess(name, frameGraph.scene));\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n context.setTextureSamplingMode(this.normalTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n context.setTextureSamplingMode(this.depthTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n context.setTextureSamplingMode(this.reflectivityTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n if (this.backDepthTexture) {\r\n context.setTextureSamplingMode(this.backDepthTexture, Constants.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n });\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (\r\n this.sourceTexture === undefined ||\r\n this.normalTexture === undefined ||\r\n this.depthTexture === undefined ||\r\n this.reflectivityTexture === undefined ||\r\n this.camera === undefined\r\n ) {\r\n throw new Error(`FrameGraphSSRTask \"${this.name}\": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required`);\r\n }\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n this.postProcess.camera = this.camera;\r\n\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"normalSampler\", this.normalTexture);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"depthSampler\", this.depthTexture);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"reflectivitySampler\", this.reflectivityTexture);\r\n if (this.backDepthTexture) {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"backDepthSampler\", this.backDepthTexture);\r\n }\r\n if (this.postProcess.enableAutomaticThicknessComputation) {\r\n this._postProcessDrawWrapper.effect!.setFloat(\"backSizeFactor\", 1);\r\n }\r\n });\r\n\r\n pass.addDependencies([this.normalTexture, this.depthTexture, this.reflectivityTexture]);\r\n\r\n this.postProcess.textureWidth = this._sourceWidth;\r\n this.postProcess.textureHeight = this._sourceHeight;\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -60,6 +60,16 @@ export declare class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
|
60
60
|
* The number of samples to use for the output textures (default is 1).
|
|
61
61
|
*/
|
|
62
62
|
samples: number;
|
|
63
|
+
private _reverseCulling;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to reverse culling (default is false).
|
|
66
|
+
*/
|
|
67
|
+
get reverseCulling(): boolean;
|
|
68
|
+
set reverseCulling(value: boolean);
|
|
69
|
+
/**
|
|
70
|
+
* Indicates if a mesh shouldn't be rendered when its material has depth write disabled (default is true).
|
|
71
|
+
*/
|
|
72
|
+
dontRenderWhenMaterialDepthWriteIsDisabled: boolean;
|
|
63
73
|
/**
|
|
64
74
|
* The list of texture descriptions used by the geometry renderer task.
|
|
65
75
|
*/
|
|
@@ -19,6 +19,19 @@ export class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
|
19
19
|
this._camera = camera;
|
|
20
20
|
this._renderer.activeCamera = this.camera;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether to reverse culling (default is false).
|
|
24
|
+
*/
|
|
25
|
+
get reverseCulling() {
|
|
26
|
+
return this._reverseCulling;
|
|
27
|
+
}
|
|
28
|
+
set reverseCulling(value) {
|
|
29
|
+
this._reverseCulling = value;
|
|
30
|
+
const configuration = MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId);
|
|
31
|
+
if (configuration) {
|
|
32
|
+
configuration.reverseCulling = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
22
35
|
/**
|
|
23
36
|
* The object renderer used by the geometry renderer task.
|
|
24
37
|
*/
|
|
@@ -66,6 +79,11 @@ export class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
|
66
79
|
* The number of samples to use for the output textures (default is 1).
|
|
67
80
|
*/
|
|
68
81
|
this.samples = 1;
|
|
82
|
+
this._reverseCulling = false;
|
|
83
|
+
/**
|
|
84
|
+
* Indicates if a mesh shouldn't be rendered when its material has depth write disabled (default is true).
|
|
85
|
+
*/
|
|
86
|
+
this.dontRenderWhenMaterialDepthWriteIsDisabled = true;
|
|
69
87
|
/**
|
|
70
88
|
* The list of texture descriptions used by the geometry renderer task.
|
|
71
89
|
*/
|
|
@@ -75,6 +93,12 @@ export class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
|
75
93
|
this._renderer = new ObjectRenderer(name, scene, options);
|
|
76
94
|
this._renderer.renderSprites = false;
|
|
77
95
|
this._renderer.renderParticles = false;
|
|
96
|
+
this._renderer.customIsReadyFunction = (mesh, refreshRate, preWarm) => {
|
|
97
|
+
if (this.dontRenderWhenMaterialDepthWriteIsDisabled && mesh.material && mesh.material.disableDepthWrite) {
|
|
98
|
+
return !!preWarm;
|
|
99
|
+
}
|
|
100
|
+
return mesh.isReady(refreshRate === 0);
|
|
101
|
+
};
|
|
78
102
|
this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {
|
|
79
103
|
if (!this._renderer.options.doNotChangeAspectRatio) {
|
|
80
104
|
scene.updateTransformMatrix(true);
|
|
@@ -171,6 +195,10 @@ export class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
|
171
195
|
context.bindAttachments(this._allAttachmentsLayout);
|
|
172
196
|
context.render(this._renderer, this._textureWidth, this._textureHeight);
|
|
173
197
|
});
|
|
198
|
+
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
199
|
+
passDisabled.setRenderTarget(outputTextureHandle);
|
|
200
|
+
passDisabled.setRenderTargetDepth(this.depthTexture);
|
|
201
|
+
passDisabled.setExecuteFunc((_context) => { });
|
|
174
202
|
}
|
|
175
203
|
dispose() {
|
|
176
204
|
MaterialHelperGeometryRendering.DeleteConfiguration(this._renderer.renderPassId);
|
|
@@ -260,6 +288,7 @@ export class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
|
260
288
|
const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];
|
|
261
289
|
configuration.defines[geometryDescription.defineIndex] = i;
|
|
262
290
|
}
|
|
291
|
+
configuration.reverseCulling = this.reverseCulling;
|
|
263
292
|
}
|
|
264
293
|
}
|
|
265
294
|
//# sourceMappingURL=geometryRendererTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/geometryRendererTask.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,+BAA+B,EAAE,+DAAwD;AAClG,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAuBnE,MAAM,WAAW,GAAa,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE/G;;GAEG;AACH,MAAM,OAAO,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C,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;YAE/F,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n AbstractEngine,\r\n FrameGraph,\r\n GeometryRenderingTextureClearType,\r\n FrameGraphObjectList,\r\n AbstractMesh,\r\n ObjectRendererOptions,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { MaterialHelperGeometryRendering } from \"core/Materials/materialHelper.geometryrendering\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\n\r\n/**\r\n * Description of a texture used by the geometry renderer task.\r\n */\r\nexport interface IFrameGraphGeometryRendererTextureDescription {\r\n /**\r\n * The type of the texture.\r\n * The value should be one of the Constants.PREPASS_XXX_TEXTURE_TYPE values.\r\n */\r\n type: number;\r\n\r\n /**\r\n * The type of the texture.\r\n */\r\n textureType: number;\r\n\r\n /**\r\n * The format of the texture.\r\n */\r\n textureFormat: number;\r\n}\r\n\r\nconst clearColors: Color4[] = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(1e8, 1e8, 1e8, 1e8)];\r\n\r\n/**\r\n * Task used to render geometry to a set of textures.\r\n */\r\nexport class FrameGraphGeometryRendererTask extends FrameGraphTask {\r\n /**\r\n * The depth texture attachment to use for rendering (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used for rendering.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The object list used for rendering.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * Whether depth testing is enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * Whether depth writing is enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * The size of the output textures (default is 100% of the back buffer texture size).\r\n */\r\n public size: { width: number; height: number } = { width: 100, height: 100 };\r\n\r\n /**\r\n * Whether the size is a percentage of the back buffer size (default is true).\r\n */\r\n public sizeIsPercentage = true;\r\n\r\n /**\r\n * The number of samples to use for the output textures (default is 1).\r\n */\r\n public samples = 1;\r\n\r\n /**\r\n * The list of texture descriptions used by the geometry renderer task.\r\n */\r\n public textureDescriptions: IFrameGraphGeometryRendererTextureDescription[] = [];\r\n\r\n /**\r\n * The output depth texture attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in screen space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryScreenDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in local space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLocalPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The albedo output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryAlbedoTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The reflectivity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryReflectivityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used by the geometry renderer task.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n /**\r\n * Gets or sets the name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _renderer: ObjectRenderer;\r\n private _textureWidth: number;\r\n private _textureHeight: number;\r\n private _clearAttachmentsLayout: Map<GeometryRenderingTextureClearType, number[]>;\r\n private _allAttachmentsLayout: number[];\r\n\r\n /**\r\n * Constructs a new geometry renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = this._scene.getEngine();\r\n\r\n this._renderer = new ObjectRenderer(name, scene, options);\r\n this._renderer.renderSprites = false;\r\n this._renderer.renderParticles = false;\r\n\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n\r\n this.name = name;\r\n this._clearAttachmentsLayout = new Map();\r\n this._allAttachmentsLayout = [];\r\n\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryScreenDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLocalPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryAlbedoTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryReflectivityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLinearVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Gets the list of excluded meshes from the velocity texture.\r\n */\r\n public get excludedSkinnedMeshFromVelocityTexture(): AbstractMesh[] {\r\n return MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId).excludedSkinnedMesh;\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record() {\r\n if (this.textureDescriptions.length === 0 || this.objectList === undefined) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object list and at least one geometry texture description must be provided`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphGeometryRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureHandle = this._createMultiRenderTargetTexture();\r\n\r\n const depthEnabled = this._checkDepthTextureCompatibility();\r\n\r\n this._buildClearAttachmentsLayout();\r\n\r\n this._registerForRenderPassId(this._renderer.renderPassId);\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(outputTextureHandle[0]);\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n // Create pass\r\n MaterialHelperGeometryRendering.MarkAsDirty(this._renderer.renderPassId, this.objectList.meshes || this._scene.meshes);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(outputTextureHandle);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const handle = outputTextureHandle[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n switch (geometryDescription.type) {\r\n case Constants.PREPASS_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryScreenDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_WORLD_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_LOCAL_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLocalPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_ALBEDO_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryAlbedoTexture, handle);\r\n break;\r\n case Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryReflectivityTexture, handle);\r\n break;\r\n case Constants.PREPASS_VELOCITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryVelocityTexture, handle);\r\n break;\r\n case Constants.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLinearVelocityTexture, handle);\r\n break;\r\n }\r\n }\r\n\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n this._clearAttachmentsLayout.forEach((layout, clearType) => {\r\n context.clearColorAttachments(clearColors[clearType], layout);\r\n });\r\n\r\n context.bindAttachments(this._allAttachmentsLayout);\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n });\r\n }\r\n\r\n public override dispose(): void {\r\n MaterialHelperGeometryRendering.DeleteConfiguration(this._renderer.renderPassId);\r\n this._renderer.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _createMultiRenderTargetTexture(): FrameGraphTextureHandle[] {\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const labels: string[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n\r\n if (index === -1) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: unknown texture type ${description.type}`);\r\n }\r\n\r\n types[i] = description.textureType;\r\n formats[i] = description.textureFormat;\r\n labels[i] = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index].name;\r\n useSRGBBuffers[i] = false;\r\n }\r\n\r\n const baseHandle = this._frameGraph.textureManager.createRenderTargetTexture(this.name, {\r\n size: this.size,\r\n sizeIsPercentage: this.sizeIsPercentage,\r\n options: {\r\n createMipMaps: false,\r\n samples: this.samples,\r\n types,\r\n formats,\r\n useSRGBBuffers,\r\n labels,\r\n },\r\n });\r\n\r\n const handles: FrameGraphTextureHandle[] = [];\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n handles.push(baseHandle + i);\r\n }\r\n\r\n return handles;\r\n }\r\n\r\n private _checkDepthTextureCompatibility(): boolean {\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth/stencil back buffer is not allowed as a depth texture`);\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== this.samples) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n return depthEnabled;\r\n }\r\n\r\n private _buildClearAttachmentsLayout() {\r\n const clearAttachmentsLayout = new Map<GeometryRenderingTextureClearType, boolean[]>();\r\n const allAttachmentsLayout: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n let layout = clearAttachmentsLayout.get(geometryDescription.clearType);\r\n if (layout === undefined) {\r\n layout = [];\r\n clearAttachmentsLayout.set(geometryDescription.clearType, layout);\r\n for (let j = 0; j < i; j++) {\r\n layout[j] = false;\r\n }\r\n }\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n layout.push(clearType === geometryDescription.clearType);\r\n });\r\n\r\n allAttachmentsLayout.push(true);\r\n }\r\n\r\n this._clearAttachmentsLayout = new Map();\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));\r\n });\r\n\r\n this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);\r\n }\r\n\r\n private _registerForRenderPassId(renderPassId: number) {\r\n const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n configuration.defines[geometryDescription.defineIndex] = i;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/geometryRendererTask.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;A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C,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACvF,CAAC;IAEO,wBAAwB,CAAC,YAAoB;QACjD,MAAM,aAAa,GAAG,+BAA+B,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAExF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;YAE/F,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/D,CAAC;QAED,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IACvD,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n AbstractEngine,\r\n FrameGraph,\r\n GeometryRenderingTextureClearType,\r\n FrameGraphObjectList,\r\n AbstractMesh,\r\n ObjectRendererOptions,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { MaterialHelperGeometryRendering } from \"core/Materials/materialHelper.geometryrendering\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\n\r\n/**\r\n * Description of a texture used by the geometry renderer task.\r\n */\r\nexport interface IFrameGraphGeometryRendererTextureDescription {\r\n /**\r\n * The type of the texture.\r\n * The value should be one of the Constants.PREPASS_XXX_TEXTURE_TYPE values.\r\n */\r\n type: number;\r\n\r\n /**\r\n * The type of the texture.\r\n */\r\n textureType: number;\r\n\r\n /**\r\n * The format of the texture.\r\n */\r\n textureFormat: number;\r\n}\r\n\r\nconst clearColors: Color4[] = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(1e8, 1e8, 1e8, 1e8)];\r\n\r\n/**\r\n * Task used to render geometry to a set of textures.\r\n */\r\nexport class FrameGraphGeometryRendererTask extends FrameGraphTask {\r\n /**\r\n * The depth texture attachment to use for rendering (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used for rendering.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The object list used for rendering.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * Whether depth testing is enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * Whether depth writing is enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * The size of the output textures (default is 100% of the back buffer texture size).\r\n */\r\n public size: { width: number; height: number } = { width: 100, height: 100 };\r\n\r\n /**\r\n * Whether the size is a percentage of the back buffer size (default is true).\r\n */\r\n public sizeIsPercentage = true;\r\n\r\n /**\r\n * The number of samples to use for the output textures (default is 1).\r\n */\r\n public samples = 1;\r\n\r\n private _reverseCulling = false;\r\n\r\n /**\r\n * Whether to reverse culling (default is false).\r\n */\r\n public get reverseCulling() {\r\n return this._reverseCulling;\r\n }\r\n\r\n public set reverseCulling(value: boolean) {\r\n this._reverseCulling = value;\r\n\r\n const configuration = MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId);\r\n if (configuration) {\r\n configuration.reverseCulling = value;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates if a mesh shouldn't be rendered when its material has depth write disabled (default is true).\r\n */\r\n public dontRenderWhenMaterialDepthWriteIsDisabled = true;\r\n\r\n /**\r\n * The list of texture descriptions used by the geometry renderer task.\r\n */\r\n public textureDescriptions: IFrameGraphGeometryRendererTextureDescription[] = [];\r\n\r\n /**\r\n * The output depth texture attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in screen space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryScreenDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in local space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLocalPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The albedo output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryAlbedoTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The reflectivity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryReflectivityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used by the geometry renderer task.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n /**\r\n * Gets or sets the name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _renderer: ObjectRenderer;\r\n private _textureWidth: number;\r\n private _textureHeight: number;\r\n private _clearAttachmentsLayout: Map<GeometryRenderingTextureClearType, number[]>;\r\n private _allAttachmentsLayout: number[];\r\n\r\n /**\r\n * Constructs a new geometry renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = this._scene.getEngine();\r\n\r\n this._renderer = new ObjectRenderer(name, scene, options);\r\n this._renderer.renderSprites = false;\r\n this._renderer.renderParticles = false;\r\n\r\n this._renderer.customIsReadyFunction = (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => {\r\n if (this.dontRenderWhenMaterialDepthWriteIsDisabled && mesh.material && mesh.material.disableDepthWrite) {\r\n return !!preWarm;\r\n }\r\n\r\n return mesh.isReady(refreshRate === 0);\r\n };\r\n\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n\r\n this.name = name;\r\n this._clearAttachmentsLayout = new Map();\r\n this._allAttachmentsLayout = [];\r\n\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryScreenDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLocalPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryAlbedoTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryReflectivityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLinearVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Gets the list of excluded meshes from the velocity texture.\r\n */\r\n public get excludedSkinnedMeshFromVelocityTexture(): AbstractMesh[] {\r\n return MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId).excludedSkinnedMesh;\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record() {\r\n if (this.textureDescriptions.length === 0 || this.objectList === undefined) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object list and at least one geometry texture description must be provided`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphGeometryRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureHandle = this._createMultiRenderTargetTexture();\r\n\r\n const depthEnabled = this._checkDepthTextureCompatibility();\r\n\r\n this._buildClearAttachmentsLayout();\r\n\r\n this._registerForRenderPassId(this._renderer.renderPassId);\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(outputTextureHandle[0]);\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n // Create pass\r\n MaterialHelperGeometryRendering.MarkAsDirty(this._renderer.renderPassId, this.objectList.meshes || this._scene.meshes);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(outputTextureHandle);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const handle = outputTextureHandle[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n switch (geometryDescription.type) {\r\n case Constants.PREPASS_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryScreenDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_WORLD_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_LOCAL_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLocalPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_ALBEDO_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryAlbedoTexture, handle);\r\n break;\r\n case Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryReflectivityTexture, handle);\r\n break;\r\n case Constants.PREPASS_VELOCITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryVelocityTexture, handle);\r\n break;\r\n case Constants.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLinearVelocityTexture, handle);\r\n break;\r\n }\r\n }\r\n\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n this._clearAttachmentsLayout.forEach((layout, clearType) => {\r\n context.clearColorAttachments(clearColors[clearType], layout);\r\n });\r\n\r\n context.bindAttachments(this._allAttachmentsLayout);\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(outputTextureHandle);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n public override dispose(): void {\r\n MaterialHelperGeometryRendering.DeleteConfiguration(this._renderer.renderPassId);\r\n this._renderer.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _createMultiRenderTargetTexture(): FrameGraphTextureHandle[] {\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const labels: string[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n\r\n if (index === -1) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: unknown texture type ${description.type}`);\r\n }\r\n\r\n types[i] = description.textureType;\r\n formats[i] = description.textureFormat;\r\n labels[i] = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index].name;\r\n useSRGBBuffers[i] = false;\r\n }\r\n\r\n const baseHandle = this._frameGraph.textureManager.createRenderTargetTexture(this.name, {\r\n size: this.size,\r\n sizeIsPercentage: this.sizeIsPercentage,\r\n options: {\r\n createMipMaps: false,\r\n samples: this.samples,\r\n types,\r\n formats,\r\n useSRGBBuffers,\r\n labels,\r\n },\r\n });\r\n\r\n const handles: FrameGraphTextureHandle[] = [];\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n handles.push(baseHandle + i);\r\n }\r\n\r\n return handles;\r\n }\r\n\r\n private _checkDepthTextureCompatibility(): boolean {\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth/stencil back buffer is not allowed as a depth texture`);\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== this.samples) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n return depthEnabled;\r\n }\r\n\r\n private _buildClearAttachmentsLayout() {\r\n const clearAttachmentsLayout = new Map<GeometryRenderingTextureClearType, boolean[]>();\r\n const allAttachmentsLayout: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n let layout = clearAttachmentsLayout.get(geometryDescription.clearType);\r\n if (layout === undefined) {\r\n layout = [];\r\n clearAttachmentsLayout.set(geometryDescription.clearType, layout);\r\n for (let j = 0; j < i; j++) {\r\n layout[j] = false;\r\n }\r\n }\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n layout.push(clearType === geometryDescription.clearType);\r\n });\r\n\r\n allAttachmentsLayout.push(true);\r\n }\r\n\r\n this._clearAttachmentsLayout = new Map();\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));\r\n });\r\n\r\n this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);\r\n }\r\n\r\n private _registerForRenderPassId(renderPassId: number) {\r\n const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n configuration.defines[geometryDescription.defineIndex] = i;\r\n }\r\n\r\n configuration.reverseCulling = this.reverseCulling;\r\n }\r\n}\r\n"]}
|
|
@@ -15,6 +15,7 @@ export declare class FrameGraph {
|
|
|
15
15
|
*/
|
|
16
16
|
readonly textureManager: FrameGraphTextureManager;
|
|
17
17
|
private readonly _engine;
|
|
18
|
+
private readonly _scene;
|
|
18
19
|
private readonly _tasks;
|
|
19
20
|
private readonly _passContext;
|
|
20
21
|
private readonly _renderContext;
|
|
@@ -32,17 +33,20 @@ export declare class FrameGraph {
|
|
|
32
33
|
* Gets the engine used by the frame graph
|
|
33
34
|
*/
|
|
34
35
|
get engine(): AbstractEngine;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the scene used by the frame graph
|
|
38
|
+
*/
|
|
39
|
+
get scene(): Scene;
|
|
35
40
|
/**
|
|
36
41
|
* Gets the list of tasks in the frame graph
|
|
37
42
|
*/
|
|
38
43
|
get tasks(): FrameGraphTask[];
|
|
39
44
|
/**
|
|
40
45
|
* Constructs the frame graph
|
|
41
|
-
* @param engine defines the hosting engine
|
|
42
|
-
* @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector
|
|
43
46
|
* @param scene defines the scene the frame graph is associated with
|
|
47
|
+
* @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)
|
|
44
48
|
*/
|
|
45
|
-
constructor(
|
|
49
|
+
constructor(scene: Scene, debugTextures?: boolean);
|
|
46
50
|
/**
|
|
47
51
|
* Gets a task by name
|
|
48
52
|
* @param name Name of the task to get
|
package/FrameGraph/frameGraph.js
CHANGED
|
@@ -24,6 +24,12 @@ export class FrameGraph {
|
|
|
24
24
|
get engine() {
|
|
25
25
|
return this._engine;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the scene used by the frame graph
|
|
29
|
+
*/
|
|
30
|
+
get scene() {
|
|
31
|
+
return this._scene;
|
|
32
|
+
}
|
|
27
33
|
/**
|
|
28
34
|
* Gets the list of tasks in the frame graph
|
|
29
35
|
*/
|
|
@@ -32,11 +38,10 @@ export class FrameGraph {
|
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Constructs the frame graph
|
|
35
|
-
* @param engine defines the hosting engine
|
|
36
|
-
* @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector
|
|
37
41
|
* @param scene defines the scene the frame graph is associated with
|
|
42
|
+
* @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)
|
|
38
43
|
*/
|
|
39
|
-
constructor(
|
|
44
|
+
constructor(scene, debugTextures = false) {
|
|
40
45
|
this._tasks = [];
|
|
41
46
|
this._currentProcessedTask = null;
|
|
42
47
|
this._whenReadyAsyncCancel = null;
|
|
@@ -48,7 +53,8 @@ export class FrameGraph {
|
|
|
48
53
|
* Observable raised when the node render graph is built
|
|
49
54
|
*/
|
|
50
55
|
this.onBuildObservable = new Observable();
|
|
51
|
-
this.
|
|
56
|
+
this._scene = scene;
|
|
57
|
+
this._engine = scene.getEngine();
|
|
52
58
|
this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);
|
|
53
59
|
this._passContext = new FrameGraphContext();
|
|
54
60
|
this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);
|