@babylonjs/core 6.31.0 → 6.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/Actions/action.js.map +1 -1
  2. package/Animations/animatable.js +13 -1
  3. package/Animations/animatable.js.map +1 -1
  4. package/Animations/animation.d.ts +8 -2
  5. package/Animations/animation.js +21 -13
  6. package/Animations/animation.js.map +1 -1
  7. package/Animations/runtimeAnimation.js +17 -16
  8. package/Animations/runtimeAnimation.js.map +1 -1
  9. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  10. package/Debug/skeletonViewer.d.ts +2 -2
  11. package/Debug/skeletonViewer.js +38 -12
  12. package/Debug/skeletonViewer.js.map +1 -1
  13. package/DeviceInput/InputDevices/deviceSource.js.map +1 -1
  14. package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
  15. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  16. package/Engines/ICanvas.d.ts +45 -0
  17. package/Engines/ICanvas.js.map +1 -1
  18. package/Engines/Processors/shaderCodeNode.js.map +1 -1
  19. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  20. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  21. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  22. package/Engines/thinEngine.js +2 -2
  23. package/Engines/thinEngine.js.map +1 -1
  24. package/Engines/webgpuEngine.js.map +1 -1
  25. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +12 -12
  26. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
  27. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +4 -4
  28. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
  29. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +9 -9
  30. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +11 -11
  32. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
  33. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +10 -10
  34. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
  35. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +2 -2
  36. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +1 -1
  38. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  39. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +4 -4
  40. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  41. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +1 -1
  42. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +4 -4
  44. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +2 -2
  46. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  48. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  49. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +4 -4
  50. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +16 -6
  51. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +1 -0
  53. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +5 -1
  54. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  55. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +1 -1
  56. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  57. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +17 -6
  58. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +16 -9
  59. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  60. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +1 -1
  61. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  62. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +1 -1
  63. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  64. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +1 -1
  65. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  66. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +1 -1
  67. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -1
  69. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -2
  71. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  72. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +2 -2
  73. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +1 -1
  75. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +4 -4
  77. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  78. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +1 -0
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +8 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +1 -0
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +5 -1
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +2 -2
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +1 -1
  87. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  88. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +1 -0
  89. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +4 -0
  90. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  91. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +1 -0
  92. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +6 -1
  93. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +1 -1
  95. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
  96. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +2 -2
  97. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +8 -12
  99. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +9 -19
  100. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  101. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +2 -2
  102. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  103. package/FlowGraph/flowGraphBlock.d.ts +2 -2
  104. package/FlowGraph/flowGraphBlock.js +20 -4
  105. package/FlowGraph/flowGraphBlock.js.map +1 -1
  106. package/FlowGraph/flowGraphContext.d.ts +4 -4
  107. package/FlowGraph/flowGraphContext.js +22 -40
  108. package/FlowGraph/flowGraphContext.js.map +1 -1
  109. package/FlowGraph/flowGraphPath.d.ts +27 -0
  110. package/FlowGraph/flowGraphPath.js +136 -0
  111. package/FlowGraph/flowGraphPath.js.map +1 -0
  112. package/FlowGraph/flowGraphPathComponent.d.ts +42 -0
  113. package/FlowGraph/flowGraphPathComponent.js +51 -0
  114. package/FlowGraph/flowGraphPathComponent.js.map +1 -0
  115. package/FlowGraph/index.d.ts +1 -0
  116. package/FlowGraph/index.js +1 -0
  117. package/FlowGraph/index.js.map +1 -1
  118. package/Gizmos/axisScaleGizmo.d.ts +3 -1
  119. package/Gizmos/axisScaleGizmo.js +5 -3
  120. package/Gizmos/axisScaleGizmo.js.map +1 -1
  121. package/Gizmos/planeDragGizmo.d.ts +3 -1
  122. package/Gizmos/planeDragGizmo.js +5 -3
  123. package/Gizmos/planeDragGizmo.js.map +1 -1
  124. package/Lights/Shadows/shadowGenerator.d.ts +8 -0
  125. package/Lights/Shadows/shadowGenerator.js +12 -0
  126. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  127. package/Loading/sceneLoader.js.map +1 -1
  128. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  129. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  130. package/Materials/Node/Blocks/modBlock.js +1 -0
  131. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  132. package/Maths/math.size.d.ts +6 -0
  133. package/Maths/math.size.js +8 -0
  134. package/Maths/math.size.js.map +1 -1
  135. package/Maths/math.vector.js +1 -1
  136. package/Maths/math.vector.js.map +1 -1
  137. package/Meshes/geometry.d.ts +8 -0
  138. package/Meshes/geometry.js +20 -1
  139. package/Meshes/geometry.js.map +1 -1
  140. package/Meshes/mesh.d.ts +8 -0
  141. package/Meshes/mesh.js +14 -2
  142. package/Meshes/mesh.js.map +1 -1
  143. package/Meshes/mesh.vertexData.js.map +1 -1
  144. package/Misc/dds.js.map +1 -1
  145. package/Misc/greasedLineTools.js.map +1 -1
  146. package/Misc/tools.js.map +1 -1
  147. package/PostProcesses/postProcess.d.ts +97 -4
  148. package/PostProcesses/postProcess.js +50 -27
  149. package/PostProcesses/postProcess.js.map +1 -1
  150. package/Rendering/geometryBufferRenderer.d.ts +6 -3
  151. package/Rendering/geometryBufferRenderer.js +28 -10
  152. package/Rendering/geometryBufferRenderer.js.map +1 -1
  153. package/Rendering/geometryBufferRendererSceneComponent.d.ts +5 -2
  154. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  155. package/Shaders/ShadersInclude/bonesDeclaration.js +1 -1
  156. package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
  157. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  158. package/package.json +1 -1
  159. package/types.js.map +1 -1
@@ -138,25 +138,9 @@ export class PostProcess {
138
138
  }
139
139
  return this._texelSize;
140
140
  }
141
- /**
142
- * Creates a new instance PostProcess
143
- * @param name The name of the PostProcess.
144
- * @param fragmentUrl The url of the fragment shader to be used.
145
- * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.
146
- * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.
147
- * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)
148
- * @param camera The camera to apply the render pass to.
149
- * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
150
- * @param engine The engine which the post process will be applied. (default: current engine)
151
- * @param reusable If the post process can be reused on the same frame. (default: false)
152
- * @param defines String of defines that will be set when running the fragment shader. (default: null)
153
- * @param textureType Type of textures used when performing the post process. (default: 0)
154
- * @param vertexUrl The url of the vertex shader to be used. (default: "postprocess")
155
- * @param indexParameters The index parameters to be used for babylons include syntax "#include<kernelBlurVaryingDeclaration>[0..varyingCount]". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx
156
- * @param blockCompilation If the shader should not be compiled immediatly. (default: false)
157
- * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)
158
- */
159
- constructor(name, fragmentUrl, parameters, samplers, options, camera, samplingMode = 1, engine, reusable, defines = null, textureType = 0, vertexUrl = "postprocess", indexParameters, blockCompilation = false, textureFormat = 5, shaderLanguage = ShaderLanguage.GLSL) {
141
+ /** @internal */
142
+ constructor(name, fragmentUrl, parameters, samplers, _size, camera, samplingMode = 1, engine, reusable, defines = null, textureType = 0, vertexUrl = "postprocess", indexParameters, blockCompilation = false, textureFormat = 5, shaderLanguage = ShaderLanguage.GLSL) {
143
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
160
144
  /** @internal */
161
145
  this._parentContainer = null;
162
146
  /**
@@ -270,6 +254,34 @@ export class PostProcess {
270
254
  */
271
255
  this.onAfterRenderObservable = new Observable();
272
256
  this.name = name;
257
+ let size = 1;
258
+ let uniformBuffers = null;
259
+ if (parameters && !Array.isArray(parameters)) {
260
+ const options = parameters;
261
+ parameters = (_a = options.uniforms) !== null && _a !== void 0 ? _a : null;
262
+ samplers = (_b = options.samplers) !== null && _b !== void 0 ? _b : null;
263
+ size = (_c = options.size) !== null && _c !== void 0 ? _c : 1;
264
+ camera = (_d = options.camera) !== null && _d !== void 0 ? _d : null;
265
+ samplingMode = (_e = options.samplingMode) !== null && _e !== void 0 ? _e : 1;
266
+ engine = options.engine;
267
+ reusable = options.reusable;
268
+ defines = (_f = options.defines) !== null && _f !== void 0 ? _f : null;
269
+ textureType = (_g = options.textureType) !== null && _g !== void 0 ? _g : 0;
270
+ vertexUrl = (_h = options.vertexUrl) !== null && _h !== void 0 ? _h : "postprocess";
271
+ indexParameters = options.indexParameters;
272
+ blockCompilation = (_j = options.blockCompilation) !== null && _j !== void 0 ? _j : false;
273
+ textureFormat = (_k = options.textureFormat) !== null && _k !== void 0 ? _k : 5;
274
+ shaderLanguage = (_l = options.shaderLanguage) !== null && _l !== void 0 ? _l : ShaderLanguage.GLSL;
275
+ uniformBuffers = (_m = options.uniformBuffers) !== null && _m !== void 0 ? _m : null;
276
+ }
277
+ else if (_size) {
278
+ if (typeof _size === "number") {
279
+ size = _size;
280
+ }
281
+ else {
282
+ size = { width: _size.width, height: _size.height };
283
+ }
284
+ }
273
285
  if (camera != null) {
274
286
  this._camera = camera;
275
287
  this._scene = camera.getScene();
@@ -282,7 +294,7 @@ export class PostProcess {
282
294
  this._engine = engine;
283
295
  this._engine.postProcesses.push(this);
284
296
  }
285
- this._options = options;
297
+ this._options = size;
286
298
  this.renderTargetSamplingMode = samplingMode ? samplingMode : 1;
287
299
  this._reusable = reusable || false;
288
300
  this._textureType = textureType;
@@ -294,6 +306,7 @@ export class PostProcess {
294
306
  this._vertexUrl = vertexUrl;
295
307
  this._parameters = parameters || [];
296
308
  this._parameters.push("scale");
309
+ this._uniformBuffers = uniformBuffers || [];
297
310
  this._indexParameters = indexParameters;
298
311
  this._drawWrapper = new DrawWrapper(this._engine);
299
312
  if (!blockCompilation) {
@@ -368,7 +381,7 @@ export class PostProcess {
368
381
  this._drawWrapper.effect = this._engine.createEffect({ vertex: vertexUrl !== null && vertexUrl !== void 0 ? vertexUrl : this._vertexUrl, fragment: fragmentUrl !== null && fragmentUrl !== void 0 ? fragmentUrl : this._fragmentUrl }, {
369
382
  attributes: ["position"],
370
383
  uniformsNames: uniforms || this._parameters,
371
- uniformBuffersNames: [],
384
+ uniformBuffersNames: this._uniformBuffers,
372
385
  samplers: samplers || this._samplers,
373
386
  defines: defines !== null ? defines : "",
374
387
  fallbacks: null,
@@ -427,17 +440,27 @@ export class PostProcess {
427
440
  }
428
441
  }
429
442
  }
430
- _resize(width, height, camera, needMipMaps, forceDepthStencil) {
443
+ /**
444
+ * Resizes the post-process texture
445
+ * @param width Width of the texture
446
+ * @param height Height of the texture
447
+ * @param camera The camera this post-process is applied to. Pass null if the post-process is used outside the context of a camera post-process chain (default: null)
448
+ * @param needMipMaps True if mip maps need to be generated after render (default: false)
449
+ * @param forceDepthStencil True to force post-process texture creation with stencil depth and buffer (default: false)
450
+ */
451
+ resize(width, height, camera = null, needMipMaps = false, forceDepthStencil = false) {
431
452
  if (this._textures.length > 0) {
432
453
  this._textures.reset();
433
454
  }
434
455
  this.width = width;
435
456
  this.height = height;
436
457
  let firstPP = null;
437
- for (let i = 0; i < camera._postProcesses.length; i++) {
438
- if (camera._postProcesses[i] !== null) {
439
- firstPP = camera._postProcesses[i];
440
- break;
458
+ if (camera) {
459
+ for (let i = 0; i < camera._postProcesses.length; i++) {
460
+ if (camera._postProcesses[i] !== null) {
461
+ firstPP = camera._postProcesses[i];
462
+ break;
463
+ }
441
464
  }
442
465
  }
443
466
  const textureSize = { width: this.width, height: this.height };
@@ -522,7 +545,7 @@ export class PostProcess {
522
545
  }
523
546
  }
524
547
  if (this.width !== desiredWidth || this.height !== desiredHeight || !(target = this._getTarget())) {
525
- this._resize(desiredWidth, desiredHeight, camera, needMipMaps, forceDepthStencil);
548
+ this.resize(desiredWidth, desiredHeight, camera, needMipMaps, forceDepthStencil);
526
549
  }
527
550
  this._textures.forEach((texture) => {
528
551
  if (texture.samples !== this.samples) {
@@ -1 +1 @@
1
- {"version":3,"file":"postProcess.js","sourceRoot":"","sources":["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KtC;IADN,SAAS,EAAE;mDACkB;AAGtB;IADP,SAAS,CAAC,SAAS,CAAC;6CACA;AAqBd;IADN,SAAS,EAAE;gEAC+B;AAw0B/C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { RenderTargetCreationOptions } from \"../Materials/Textures/textureCreationOptions\";\r\nimport \"../Shaders/postprocess.vertex\";\r\nimport type { IInspectable } from \"../Misc/iInspectable\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\n\r\nimport \"../Engines/Extensions/engine.renderTarget\";\r\nimport type { NodeMaterial } from \"../Materials/Node/nodeMaterial\";\r\nimport { serialize, serializeAsColor4, SerializationHelper } from \"../Misc/decorators\";\r\nimport { GetClass, RegisterClass } from \"../Misc/typeStore\";\r\nimport { DrawWrapper } from \"../Materials/drawWrapper\";\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport type { RenderTargetWrapper } from \"../Engines/renderTargetWrapper\";\r\nimport { ShaderLanguage } from \"../Materials/shaderLanguage\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { PrePassRenderer } from \"../Rendering/prePassRenderer\";\r\nimport type { PrePassEffectConfiguration } from \"../Rendering/prePassEffectConfiguration\";\r\n\r\n/**\r\n * Allows for custom processing of the shader code used by a post process\r\n */\r\nexport type PostProcessCustomShaderCodeProcessing = {\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed\r\n */\r\n processCodeAfterIncludes?: (postProcessName: string, shaderType: string, code: string) => string;\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU\r\n */\r\n processFinalCode?: (postProcessName: string, shaderType: string, code: string) => string;\r\n /**\r\n * If provided, will be called before creating the effect to collect additional custom bindings (defines, uniforms, samplers)\r\n */\r\n defineCustomBindings?: (postProcessName: string, defines: Nullable<string>, uniforms: string[], samplers: string[]) => Nullable<string>;\r\n /**\r\n * If provided, will be called when binding inputs to the shader code to allow the user to add custom bindings\r\n */\r\n bindCustomBindings?: (postProcessName: string, effect: Effect) => void;\r\n};\r\n\r\n/**\r\n * Size options for a post process\r\n */\r\nexport type PostProcessOptions = { width: number; height: number };\r\n\r\ntype TextureCache = { texture: RenderTargetWrapper; postProcessChannel: number; lastUsedRenderId: number };\r\n\r\n/**\r\n * PostProcess can be used to apply a shader to a texture after it has been rendered\r\n * See https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses\r\n */\r\nexport class PostProcess {\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n private static _CustomShaderCodeProcessing: { [postProcessName: string]: PostProcessCustomShaderCodeProcessing } = {};\r\n\r\n /**\r\n * Registers a shader code processing with a post process name.\r\n * @param postProcessName name of the post process. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to a post process name\r\n * @param customShaderCodeProcessing shader code processing to associate to the post process name\r\n * @returns\r\n */\r\n public static RegisterShaderCodeProcessing(postProcessName: Nullable<string>, customShaderCodeProcessing?: PostProcessCustomShaderCodeProcessing) {\r\n if (!customShaderCodeProcessing) {\r\n delete PostProcess._CustomShaderCodeProcessing[postProcessName ?? \"\"];\r\n return;\r\n }\r\n\r\n PostProcess._CustomShaderCodeProcessing[postProcessName ?? \"\"] = customShaderCodeProcessing;\r\n }\r\n\r\n private static _GetShaderCodeProcessing(postProcessName: string) {\r\n return PostProcess._CustomShaderCodeProcessing[postProcessName] ?? PostProcess._CustomShaderCodeProcessing[\"\"];\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the post process\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /** Name of the PostProcess. */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Width of the texture to apply the post process on\r\n */\r\n @serialize()\r\n public width = -1;\r\n\r\n /**\r\n * Height of the texture to apply the post process on\r\n */\r\n @serialize()\r\n public height = -1;\r\n\r\n /**\r\n * Gets the node material used to create this postprocess (null if the postprocess was manually created)\r\n */\r\n public nodeMaterialSource: Nullable<NodeMaterial> = null;\r\n\r\n /**\r\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\r\n * @internal\r\n */\r\n public _outputTexture: Nullable<RenderTargetWrapper> = null;\r\n /**\r\n * Sampling mode used by the shader\r\n * See https://doc.babylonjs.com/classes/3.1/texture\r\n */\r\n @serialize()\r\n public renderTargetSamplingMode: number;\r\n /**\r\n * Clear color to use when screen clearing\r\n */\r\n @serializeAsColor4()\r\n public clearColor: Color4;\r\n /**\r\n * If the buffer needs to be cleared before applying the post process. (default: true)\r\n * Should be set to false if shader will overwrite all previous pixels.\r\n */\r\n @serialize()\r\n public autoClear = true;\r\n /**\r\n * If clearing the buffer should be forced in autoClear mode, even when alpha mode is enabled (default: false).\r\n * By default, the buffer will only be cleared if alpha mode is disabled (and autoClear is true).\r\n */\r\n @serialize()\r\n public forceAutoClearInAlphaMode = false;\r\n /**\r\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\r\n */\r\n @serialize()\r\n public alphaMode = Constants.ALPHA_DISABLE;\r\n /**\r\n * Sets the setAlphaBlendConstants of the babylon engine\r\n */\r\n @serialize()\r\n public alphaConstants: Color4;\r\n /**\r\n * Animations to be used for the post processing\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\r\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\r\n */\r\n @serialize()\r\n public enablePixelPerfectMode = false;\r\n\r\n /**\r\n * Force the postprocess to be applied without taking in account viewport\r\n */\r\n @serialize()\r\n public forceFullscreenViewport = true;\r\n\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n public inspectableCustomProperties: IInspectable[];\r\n\r\n /**\r\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\r\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\r\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\r\n *\r\n */\r\n @serialize()\r\n public scaleMode = Constants.SCALEMODE_FLOOR;\r\n /**\r\n * Force textures to be a power of two (default: false)\r\n */\r\n @serialize()\r\n public alwaysForcePOT = false;\r\n\r\n @serialize(\"samples\")\r\n private _samples = 1;\r\n\r\n /**\r\n * Number of sample textures (default: 1)\r\n */\r\n public get samples() {\r\n return this._samples;\r\n }\r\n\r\n public set samples(n: number) {\r\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\r\n\r\n this._textures.forEach((texture) => {\r\n texture.setSamples(this._samples);\r\n });\r\n }\r\n\r\n /**\r\n * Modify the scale of the post process to be the same as the viewport (default: false)\r\n */\r\n @serialize()\r\n public adaptScaleToCurrentViewport = false;\r\n\r\n private _camera: Camera;\r\n protected _scene: Scene;\r\n private _engine: Engine;\r\n\r\n private _options: number | PostProcessOptions;\r\n private _reusable = false;\r\n private _renderId = 0;\r\n private _textureType: number;\r\n private _textureFormat: number;\r\n private _shaderLanguage: ShaderLanguage;\r\n\r\n /**\r\n * if externalTextureSamplerBinding is true, the \"apply\" method won't bind the textureSampler texture, it is expected to be done by the \"outside\" (by the onApplyObservable observer most probably).\r\n * counter-productive in some cases because if the texture bound by \"apply\" is different from the currently texture bound, (the one set by the onApplyObservable observer, for eg) some\r\n * internal structures (materialContext) will be dirtified, which may impact performances\r\n */\r\n public externalTextureSamplerBinding = false;\r\n\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @internal\r\n */\r\n public _textures = new SmartArray<RenderTargetWrapper>(2);\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @internal\r\n */\r\n private _textureCache: TextureCache[] = [];\r\n /**\r\n * The index in _textures that corresponds to the output texture.\r\n * @internal\r\n */\r\n public _currentRenderTextureInd = 0;\r\n private _drawWrapper: DrawWrapper;\r\n private _samplers: string[];\r\n private _fragmentUrl: string;\r\n private _vertexUrl: string;\r\n private _parameters: string[];\r\n protected _postProcessDefines: Nullable<string>;\r\n private _scaleRatio = new Vector2(1, 1);\r\n protected _indexParameters: any;\r\n private _shareOutputWithPostProcess: Nullable<PostProcess>;\r\n private _texelSize = Vector2.Zero();\r\n\r\n /** @internal */\r\n public _forcedOutputTexture: Nullable<RenderTargetWrapper>;\r\n\r\n /**\r\n * Prepass configuration in case this post process needs a texture from prepass\r\n * @internal\r\n */\r\n public _prePassEffectConfiguration: PrePassEffectConfiguration;\r\n\r\n /**\r\n * Returns the fragment url or shader name used in the post process.\r\n * @returns the fragment url or name in the shader store.\r\n */\r\n public getEffectName(): string {\r\n return this._fragmentUrl;\r\n }\r\n\r\n // Events\r\n\r\n /**\r\n * An event triggered when the postprocess is activated.\r\n */\r\n public onActivateObservable = new Observable<Camera>();\r\n\r\n private _onActivateObserver: Nullable<Observer<Camera>>;\r\n /**\r\n * A function that is added to the onActivateObservable\r\n */\r\n public set onActivate(callback: Nullable<(camera: Camera) => void>) {\r\n if (this._onActivateObserver) {\r\n this.onActivateObservable.remove(this._onActivateObserver);\r\n }\r\n if (callback) {\r\n this._onActivateObserver = this.onActivateObservable.add(callback);\r\n }\r\n }\r\n\r\n /**\r\n * An event triggered when the postprocess changes its size.\r\n */\r\n public onSizeChangedObservable = new Observable<PostProcess>();\r\n\r\n private _onSizeChangedObserver: Nullable<Observer<PostProcess>>;\r\n /**\r\n * A function that is added to the onSizeChangedObservable\r\n */\r\n public set onSizeChanged(callback: (postProcess: PostProcess) => void) {\r\n if (this._onSizeChangedObserver) {\r\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\r\n }\r\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered when the postprocess applies its effect.\r\n */\r\n public onApplyObservable = new Observable<Effect>();\r\n\r\n private _onApplyObserver: Nullable<Observer<Effect>>;\r\n /**\r\n * A function that is added to the onApplyObservable\r\n */\r\n public set onApply(callback: (effect: Effect) => void) {\r\n if (this._onApplyObserver) {\r\n this.onApplyObservable.remove(this._onApplyObserver);\r\n }\r\n this._onApplyObserver = this.onApplyObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered before rendering the postprocess\r\n */\r\n public onBeforeRenderObservable = new Observable<Effect>();\r\n\r\n private _onBeforeRenderObserver: Nullable<Observer<Effect>>;\r\n /**\r\n * A function that is added to the onBeforeRenderObservable\r\n */\r\n public set onBeforeRender(callback: (effect: Effect) => void) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered after rendering the postprocess\r\n */\r\n public onAfterRenderObservable = new Observable<Effect>();\r\n\r\n private _onAfterRenderObserver: Nullable<Observer<Effect>>;\r\n /**\r\n * A function that is added to the onAfterRenderObservable\r\n */\r\n public set onAfterRender(callback: (efect: Effect) => void) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n }\r\n\r\n /**\r\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\r\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\r\n */\r\n public get inputTexture(): RenderTargetWrapper {\r\n return this._textures.data[this._currentRenderTextureInd];\r\n }\r\n\r\n public set inputTexture(value: RenderTargetWrapper) {\r\n this._forcedOutputTexture = value;\r\n }\r\n\r\n /**\r\n * Since inputTexture should always be defined, if we previously manually set `inputTexture`,\r\n * the only way to unset it is to use this function to restore its internal state\r\n */\r\n public restoreDefaultInputTexture() {\r\n if (this._forcedOutputTexture) {\r\n this._forcedOutputTexture = null;\r\n this.markTextureDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the camera which post process is applied to.\r\n * @returns The camera the post process is applied to.\r\n */\r\n public getCamera(): Camera {\r\n return this._camera;\r\n }\r\n\r\n /**\r\n * Gets the texel size of the postprocess.\r\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\r\n */\r\n public get texelSize(): Vector2 {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.texelSize;\r\n }\r\n\r\n if (this._forcedOutputTexture) {\r\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\r\n }\r\n\r\n return this._texelSize;\r\n }\r\n\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\r\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param blockCompilation If the shader should not be compiled immediatly. (default: false)\r\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\r\n */\r\n constructor(\r\n name: string,\r\n fragmentUrl: string,\r\n parameters: Nullable<string[]>,\r\n samplers: Nullable<string[]>,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode: number = Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n engine?: Engine,\r\n reusable?: boolean,\r\n defines: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n vertexUrl: string = \"postprocess\",\r\n indexParameters?: any,\r\n blockCompilation = false,\r\n textureFormat = Constants.TEXTUREFORMAT_RGBA,\r\n shaderLanguage = ShaderLanguage.GLSL\r\n ) {\r\n this.name = name;\r\n if (camera != null) {\r\n this._camera = camera;\r\n this._scene = camera.getScene();\r\n camera.attachPostProcess(this);\r\n this._engine = this._scene.getEngine();\r\n\r\n this._scene.postProcesses.push(this);\r\n this.uniqueId = this._scene.getUniqueId();\r\n } else if (engine) {\r\n this._engine = engine;\r\n this._engine.postProcesses.push(this);\r\n }\r\n this._options = options;\r\n this.renderTargetSamplingMode = samplingMode ? samplingMode : Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n this._reusable = reusable || false;\r\n this._textureType = textureType;\r\n this._textureFormat = textureFormat;\r\n this._shaderLanguage = shaderLanguage;\r\n\r\n this._samplers = samplers || [];\r\n this._samplers.push(\"textureSampler\");\r\n\r\n this._fragmentUrl = fragmentUrl;\r\n this._vertexUrl = vertexUrl;\r\n this._parameters = parameters || [];\r\n\r\n this._parameters.push(\"scale\");\r\n\r\n this._indexParameters = indexParameters;\r\n this._drawWrapper = new DrawWrapper(this._engine);\r\n\r\n if (!blockCompilation) {\r\n this.updateEffect(defines);\r\n }\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"PostProcess\" string\r\n */\r\n public getClassName(): string {\r\n return \"PostProcess\";\r\n }\r\n\r\n /**\r\n * Gets the engine which this post process belongs to.\r\n * @returns The engine the post process was enabled with.\r\n */\r\n public getEngine(): Engine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the postprocess.\r\n */\r\n public getEffect(): Effect {\r\n return this._drawWrapper.effect!;\r\n }\r\n\r\n /**\r\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\r\n * @param postProcess The post process to share the output with.\r\n * @returns This post process.\r\n */\r\n public shareOutputWith(postProcess: PostProcess): PostProcess {\r\n this._disposeTextures();\r\n\r\n this._shareOutputWithPostProcess = postProcess;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\r\n * This should be called if the post process that shares output with this post process is disabled/disposed.\r\n */\r\n public useOwnOutput() {\r\n if (this._textures.length == 0) {\r\n this._textures = new SmartArray<RenderTargetWrapper>(2);\r\n }\r\n\r\n this._shareOutputWithPostProcess = null;\r\n }\r\n\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\r\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\r\n */\r\n public updateEffect(\r\n defines: Nullable<string> = null,\r\n uniforms: Nullable<string[]> = null,\r\n samplers: Nullable<string[]> = null,\r\n indexParameters?: any,\r\n onCompiled?: (effect: Effect) => void,\r\n onError?: (effect: Effect, errors: string) => void,\r\n vertexUrl?: string,\r\n fragmentUrl?: string\r\n ) {\r\n const customShaderCodeProcessing = PostProcess._GetShaderCodeProcessing(this.name);\r\n if (customShaderCodeProcessing?.defineCustomBindings) {\r\n const newUniforms = uniforms?.slice() ?? [];\r\n newUniforms.push(...this._parameters);\r\n\r\n const newSamplers = samplers?.slice() ?? [];\r\n newSamplers.push(...this._samplers);\r\n\r\n defines = customShaderCodeProcessing.defineCustomBindings(this.name, defines, newUniforms, newSamplers);\r\n uniforms = newUniforms;\r\n samplers = newSamplers;\r\n }\r\n this._postProcessDefines = defines;\r\n this._drawWrapper.effect = this._engine.createEffect(\r\n { vertex: vertexUrl ?? this._vertexUrl, fragment: fragmentUrl ?? this._fragmentUrl },\r\n {\r\n attributes: [\"position\"],\r\n uniformsNames: uniforms || this._parameters,\r\n uniformBuffersNames: [],\r\n samplers: samplers || this._samplers,\r\n defines: defines !== null ? defines : \"\",\r\n fallbacks: null,\r\n onCompiled: onCompiled ?? null,\r\n onError: onError ?? null,\r\n indexParameters: indexParameters || this._indexParameters,\r\n processCodeAfterIncludes: customShaderCodeProcessing?.processCodeAfterIncludes\r\n ? (shaderType: string, code: string) => customShaderCodeProcessing!.processCodeAfterIncludes!(this.name, shaderType, code)\r\n : null,\r\n processFinalCode: customShaderCodeProcessing?.processFinalCode\r\n ? (shaderType: string, code: string) => customShaderCodeProcessing!.processFinalCode!(this.name, shaderType, code)\r\n : null,\r\n shaderLanguage: this._shaderLanguage,\r\n },\r\n this._engine\r\n );\r\n }\r\n\r\n /**\r\n * The post process is reusable if it can be used multiple times within one frame.\r\n * @returns If the post process is reusable\r\n */\r\n public isReusable(): boolean {\r\n return this._reusable;\r\n }\r\n\r\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\r\n public markTextureDirty(): void {\r\n this.width = -1;\r\n }\r\n\r\n private _createRenderTargetTexture(textureSize: { width: number; height: number }, textureOptions: RenderTargetCreationOptions, channel = 0) {\r\n for (let i = 0; i < this._textureCache.length; i++) {\r\n if (\r\n this._textureCache[i].texture.width === textureSize.width &&\r\n this._textureCache[i].texture.height === textureSize.height &&\r\n this._textureCache[i].postProcessChannel === channel &&\r\n this._textureCache[i].texture._generateDepthBuffer === textureOptions.generateDepthBuffer &&\r\n this._textureCache[i].texture.samples === textureOptions.samples\r\n ) {\r\n return this._textureCache[i].texture;\r\n }\r\n }\r\n\r\n const tex = this._engine.createRenderTargetTexture(textureSize, textureOptions);\r\n this._textureCache.push({ texture: tex, postProcessChannel: channel, lastUsedRenderId: -1 });\r\n\r\n return tex;\r\n }\r\n\r\n private _flushTextureCache() {\r\n const currentRenderId = this._renderId;\r\n\r\n for (let i = this._textureCache.length - 1; i >= 0; i--) {\r\n if (currentRenderId - this._textureCache[i].lastUsedRenderId > 100) {\r\n let currentlyUsed = false;\r\n for (let j = 0; j < this._textures.length; j++) {\r\n if (this._textures.data[j] === this._textureCache[i].texture) {\r\n currentlyUsed = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!currentlyUsed) {\r\n this._textureCache[i].texture.dispose();\r\n this._textureCache.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _resize(width: number, height: number, camera: Camera, needMipMaps: boolean, forceDepthStencil?: boolean) {\r\n if (this._textures.length > 0) {\r\n this._textures.reset();\r\n }\r\n\r\n this.width = width;\r\n this.height = height;\r\n\r\n let firstPP = null;\r\n for (let i = 0; i < camera._postProcesses.length; i++) {\r\n if (camera._postProcesses[i] !== null) {\r\n firstPP = camera._postProcesses[i];\r\n break;\r\n }\r\n }\r\n\r\n const textureSize = { width: this.width, height: this.height };\r\n const textureOptions = {\r\n generateMipMaps: needMipMaps,\r\n generateDepthBuffer: forceDepthStencil || firstPP === this,\r\n generateStencilBuffer: (forceDepthStencil || firstPP === this) && this._engine.isStencilEnable,\r\n samplingMode: this.renderTargetSamplingMode,\r\n type: this._textureType,\r\n format: this._textureFormat,\r\n samples: this._samples,\r\n label: \"PostProcessRTT-\" + this.name,\r\n };\r\n\r\n this._textures.push(this._createRenderTargetTexture(textureSize, textureOptions, 0));\r\n\r\n if (this._reusable) {\r\n this._textures.push(this._createRenderTargetTexture(textureSize, textureOptions, 1));\r\n }\r\n\r\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\r\n\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n }\r\n\r\n private _getTarget() {\r\n let target: RenderTargetWrapper;\r\n\r\n if (this._shareOutputWithPostProcess) {\r\n target = this._shareOutputWithPostProcess.inputTexture;\r\n } else if (this._forcedOutputTexture) {\r\n target = this._forcedOutputTexture;\r\n\r\n this.width = this._forcedOutputTexture.width;\r\n this.height = this._forcedOutputTexture.height;\r\n } else {\r\n target = this.inputTexture;\r\n\r\n let cache;\r\n for (let i = 0; i < this._textureCache.length; i++) {\r\n if (this._textureCache[i].texture === target) {\r\n cache = this._textureCache[i];\r\n break;\r\n }\r\n }\r\n\r\n if (cache) {\r\n cache.lastUsedRenderId = this._renderId;\r\n }\r\n }\r\n\r\n return target;\r\n }\r\n\r\n /**\r\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\r\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\r\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\r\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\r\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\r\n * @returns The render target wrapper that was bound to be written to.\r\n */\r\n public activate(camera: Nullable<Camera>, sourceTexture: Nullable<InternalTexture> = null, forceDepthStencil?: boolean): RenderTargetWrapper {\r\n camera = camera || this._camera;\r\n\r\n const scene = camera.getScene();\r\n const engine = scene.getEngine();\r\n const maxSize = engine.getCaps().maxTextureSize;\r\n\r\n const requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * <number>this._options) | 0;\r\n const requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * <number>this._options) | 0;\r\n\r\n let desiredWidth = (<PostProcessOptions>this._options).width || requiredWidth;\r\n let desiredHeight = (<PostProcessOptions>this._options).height || requiredHeight;\r\n\r\n const needMipMaps =\r\n this.renderTargetSamplingMode !== Constants.TEXTURE_NEAREST_LINEAR &&\r\n this.renderTargetSamplingMode !== Constants.TEXTURE_NEAREST_NEAREST &&\r\n this.renderTargetSamplingMode !== Constants.TEXTURE_LINEAR_LINEAR;\r\n\r\n let target: Nullable<RenderTargetWrapper> = null;\r\n\r\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\r\n if (this.adaptScaleToCurrentViewport) {\r\n const currentViewport = engine.currentViewport;\r\n\r\n if (currentViewport) {\r\n desiredWidth *= currentViewport.width;\r\n desiredHeight *= currentViewport.height;\r\n }\r\n }\r\n\r\n if (needMipMaps || this.alwaysForcePOT) {\r\n if (!(<PostProcessOptions>this._options).width) {\r\n desiredWidth = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\r\n }\r\n\r\n if (!(<PostProcessOptions>this._options).height) {\r\n desiredHeight = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\r\n }\r\n }\r\n\r\n if (this.width !== desiredWidth || this.height !== desiredHeight || !(target = this._getTarget())) {\r\n this._resize(desiredWidth, desiredHeight, camera, needMipMaps, forceDepthStencil);\r\n }\r\n\r\n this._textures.forEach((texture) => {\r\n if (texture.samples !== this.samples) {\r\n this._engine.updateRenderTargetTextureSampleCount(texture, this.samples);\r\n }\r\n });\r\n\r\n this._flushTextureCache();\r\n this._renderId++;\r\n }\r\n\r\n if (!target) {\r\n target = this._getTarget();\r\n }\r\n\r\n // Bind the input of this post process to be used as the output of the previous post process.\r\n if (this.enablePixelPerfectMode) {\r\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\r\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\r\n } else {\r\n this._scaleRatio.copyFromFloats(1, 1);\r\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\r\n }\r\n\r\n this._engine._debugInsertMarker?.(`post process ${this.name} input`);\r\n\r\n this.onActivateObservable.notifyObservers(camera);\r\n\r\n // Clear\r\n if (this.autoClear && (this.alphaMode === Constants.ALPHA_DISABLE || this.forceAutoClearInAlphaMode)) {\r\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\r\n }\r\n\r\n if (this._reusable) {\r\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\r\n }\r\n return target;\r\n }\r\n\r\n /**\r\n * If the post process is supported.\r\n */\r\n public get isSupported(): boolean {\r\n return this._drawWrapper.effect!.isSupported;\r\n }\r\n\r\n /**\r\n * The aspect ratio of the output texture.\r\n */\r\n public get aspectRatio(): number {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.aspectRatio;\r\n }\r\n\r\n if (this._forcedOutputTexture) {\r\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\r\n }\r\n return this.width / this.height;\r\n }\r\n\r\n /**\r\n * Get a value indicating if the post-process is ready to be used\r\n * @returns true if the post-process is ready (shader is compiled)\r\n */\r\n public isReady(): boolean {\r\n return this._drawWrapper.effect?.isReady() ?? false;\r\n }\r\n\r\n /**\r\n * Binds all textures and uniforms to the shader, this will be run on every pass.\r\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\r\n */\r\n public apply(): Nullable<Effect> {\r\n // Check\r\n if (!this._drawWrapper.effect?.isReady()) {\r\n return null;\r\n }\r\n\r\n // States\r\n this._engine.enableEffect(this._drawWrapper);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n\r\n // Alpha\r\n this._engine.setAlphaMode(this.alphaMode);\r\n if (this.alphaConstants) {\r\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\r\n }\r\n\r\n // Bind the output texture of the preivous post process as the input to this post process.\r\n let source: RenderTargetWrapper;\r\n if (this._shareOutputWithPostProcess) {\r\n source = this._shareOutputWithPostProcess.inputTexture;\r\n } else if (this._forcedOutputTexture) {\r\n source = this._forcedOutputTexture;\r\n } else {\r\n source = this.inputTexture;\r\n }\r\n\r\n if (!this.externalTextureSamplerBinding) {\r\n this._drawWrapper.effect._bindTexture(\"textureSampler\", source?.texture);\r\n }\r\n\r\n // Parameters\r\n this._drawWrapper.effect.setVector2(\"scale\", this._scaleRatio);\r\n this.onApplyObservable.notifyObservers(this._drawWrapper.effect);\r\n\r\n PostProcess._GetShaderCodeProcessing(this.name)?.bindCustomBindings?.(this.name, this._drawWrapper.effect);\r\n\r\n return this._drawWrapper.effect;\r\n }\r\n\r\n private _disposeTextures() {\r\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\r\n this._disposeTextureCache();\r\n return;\r\n }\r\n\r\n this._disposeTextureCache();\r\n this._textures.dispose();\r\n }\r\n\r\n private _disposeTextureCache() {\r\n for (let i = this._textureCache.length - 1; i >= 0; i--) {\r\n this._textureCache[i].texture.dispose();\r\n }\r\n\r\n this._textureCache.length = 0;\r\n }\r\n\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup.\r\n * @returns true if the pre pass is needed.\r\n */\r\n public setPrePassRenderer(prePassRenderer: PrePassRenderer): boolean {\r\n if (this._prePassEffectConfiguration) {\r\n this._prePassEffectConfiguration = prePassRenderer.addEffectConfiguration(this._prePassEffectConfiguration);\r\n this._prePassEffectConfiguration.enabled = true;\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n public dispose(camera?: Camera): void {\r\n camera = camera || this._camera;\r\n\r\n this._disposeTextures();\r\n\r\n let index;\r\n if (this._scene) {\r\n index = this._scene.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.postProcesses.splice(index, 1);\r\n }\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.postProcesses.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.postProcesses.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n index = this._engine.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._engine.postProcesses.splice(index, 1);\r\n }\r\n\r\n if (!camera) {\r\n return;\r\n }\r\n camera.detachPostProcess(this);\r\n\r\n index = camera._postProcesses.indexOf(this);\r\n if (index === 0 && camera._postProcesses.length > 0) {\r\n const firstPostProcess = this._camera._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n }\r\n\r\n this.onActivateObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onApplyObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Serializes the post process to a JSON object\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n const camera = this.getCamera() || (this._scene && this._scene.activeCamera);\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.cameraId = camera ? camera.id : null;\r\n serializationObject.reusable = this._reusable;\r\n serializationObject.textureType = this._textureType;\r\n serializationObject.fragmentUrl = this._fragmentUrl;\r\n serializationObject.parameters = this._parameters;\r\n serializationObject.samplers = this._samplers;\r\n serializationObject.options = this._options;\r\n serializationObject.defines = this._postProcessDefines;\r\n serializationObject.textureFormat = this._textureFormat;\r\n serializationObject.vertexUrl = this._vertexUrl;\r\n serializationObject.indexParameters = this._indexParameters;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Clones this post process\r\n * @returns a new post process similar to this one\r\n */\r\n public clone(): Nullable<PostProcess> {\r\n const serializationObject = this.serialize();\r\n serializationObject._engine = this._engine;\r\n serializationObject.cameraId = null;\r\n\r\n const result = PostProcess.Parse(serializationObject, this._scene, \"\");\r\n\r\n if (!result) {\r\n return null;\r\n }\r\n\r\n result.onActivateObservable = this.onActivateObservable.clone();\r\n result.onSizeChangedObservable = this.onSizeChangedObservable.clone();\r\n result.onApplyObservable = this.onApplyObservable.clone();\r\n result.onBeforeRenderObservable = this.onBeforeRenderObservable.clone();\r\n result.onAfterRenderObservable = this.onAfterRenderObservable.clone();\r\n\r\n result._prePassEffectConfiguration = this._prePassEffectConfiguration;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedPostProcess defines parsed post process data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new post process\r\n */\r\n public static Parse(parsedPostProcess: any, scene: Scene, rootUrl: string): Nullable<PostProcess> {\r\n const postProcessType = GetClass(parsedPostProcess.customType);\r\n\r\n if (!postProcessType || !postProcessType._Parse) {\r\n return null;\r\n }\r\n\r\n const camera = scene ? scene.getCameraById(parsedPostProcess.cameraId) : null;\r\n return postProcessType._Parse(parsedPostProcess, camera, scene, rootUrl);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<PostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new PostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.fragmentUrl,\r\n parsedPostProcess.parameters,\r\n parsedPostProcess.samplers,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n parsedPostProcess._engine,\r\n parsedPostProcess.reusable,\r\n parsedPostProcess.defines,\r\n parsedPostProcess.textureType,\r\n parsedPostProcess.vertexUrl,\r\n parsedPostProcess.indexParameters,\r\n false,\r\n parsedPostProcess.textureFormat\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PostProcess\", PostProcess);\r\n"]}
1
+ {"version":3,"file":"postProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/postProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,2CAA2C,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAkH7D;;;GAGG;AACH,MAAM,OAAO,WAAW;IAMpB;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,eAAiC,EAAE,0BAAkE;QAC5I,IAAI,CAAC,0BAA0B,EAAE;YAC7B,OAAO,WAAW,CAAC,2BAA2B,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,CAAC,CAAC;YACtE,OAAO;SACV;QAED,WAAW,CAAC,2BAA2B,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,CAAC,GAAG,0BA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ClC,CAAC;QACN,CAAC,EACD,iBAAiB,EACjB,KAAK,EACL,OAAO,CACV,CAAC;IACN,CAAC;;AAhiCc,uCAA2B,GAAyE,EAAE,AAA3E,CAA4E;AAyB/G;IADN,SAAS,EAAE;6CACY;AAIjB;IADN,SAAS,EAAE;yCACQ;AAMb;IADN,SAAS,EAAE;0CACM;AAMX;IADN,SAAS,EAAE;2CACO;AAiBZ;IADN,SAAS,EAAE;6DAC4B;AAKjC;IADN,iBAAiB,EAAE;+CACM;AAMnB;IADN,SAAS,EAAE;8CACY;AAMjB;IADN,SAAS,EAAE;8DAC6B;AAKlC;IADN,SAAS,EAAE;8CAC+B;AAKpC;IADN,SAAS,EAAE;mDACkB;AAWvB;IADN,SAAS,EAAE;2DAC0B;AAM/B;IADN,SAAS,EAAE;4DAC0B;AAmB/B;IADN,SAAS,EAAE;8CACiC;AAKtC;IADN,SAAS,EAAE;mDACkB;AAGtB;IADP,SAAS,CAAC,SAAS,CAAC;6CACA;AAqBd;IADN,SAAS,EAAE;gEAC+B;AA64B/C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { RenderTargetCreationOptions } from \"../Materials/Textures/textureCreationOptions\";\r\nimport \"../Shaders/postprocess.vertex\";\r\nimport type { IInspectable } from \"../Misc/iInspectable\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\n\r\nimport \"../Engines/Extensions/engine.renderTarget\";\r\nimport type { NodeMaterial } from \"../Materials/Node/nodeMaterial\";\r\nimport { serialize, serializeAsColor4, SerializationHelper } from \"../Misc/decorators\";\r\nimport { GetClass, RegisterClass } from \"../Misc/typeStore\";\r\nimport { DrawWrapper } from \"../Materials/drawWrapper\";\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport type { RenderTargetWrapper } from \"../Engines/renderTargetWrapper\";\r\nimport { ShaderLanguage } from \"../Materials/shaderLanguage\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { PrePassRenderer } from \"../Rendering/prePassRenderer\";\r\nimport type { PrePassEffectConfiguration } from \"../Rendering/prePassEffectConfiguration\";\r\n\r\n/**\r\n * Allows for custom processing of the shader code used by a post process\r\n */\r\nexport type PostProcessCustomShaderCodeProcessing = {\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed\r\n */\r\n processCodeAfterIncludes?: (postProcessName: string, shaderType: string, code: string) => string;\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU\r\n */\r\n processFinalCode?: (postProcessName: string, shaderType: string, code: string) => string;\r\n /**\r\n * If provided, will be called before creating the effect to collect additional custom bindings (defines, uniforms, samplers)\r\n */\r\n defineCustomBindings?: (postProcessName: string, defines: Nullable<string>, uniforms: string[], samplers: string[]) => Nullable<string>;\r\n /**\r\n * If provided, will be called when binding inputs to the shader code to allow the user to add custom bindings\r\n */\r\n bindCustomBindings?: (postProcessName: string, effect: Effect) => void;\r\n};\r\n\r\n/**\r\n * Options for the PostProcess constructor\r\n */\r\nexport type PostProcessOptions = {\r\n /**\r\n * The width of the texture created for this post process.\r\n * This parameter (and height) is only used when passing a value for the 5th parameter (options) to the PostProcess constructor function.\r\n * If you use a PostProcessOptions for the 3rd parameter of the constructor, size is used instead of width and height.\r\n */\r\n width?: number;\r\n /**\r\n * The height of the texture created for this post process.\r\n * This parameter (and width) is only used when passing a value for the 5th parameter (options) to the PostProcess constructor function.\r\n * If you use a PostProcessOptions for the 3rd parameter of the constructor, size is used instead of width and height.\r\n */\r\n height?: number;\r\n\r\n /**\r\n * The list of uniforms used in the shader (if any)\r\n */\r\n uniforms?: Nullable<string[]>;\r\n /**\r\n * The list of samplers used in the shader (if any)\r\n */\r\n samplers?: Nullable<string[]>;\r\n /**\r\n * The list of uniform buffers used in the shader (if any)\r\n */\r\n uniformBuffers?: Nullable<string[]>;\r\n /**\r\n * String of defines that will be set when running the fragment shader. (default: null)\r\n */\r\n defines?: Nullable<string>;\r\n /**\r\n * The size of the post process texture.\r\n * It is either a ratio to downscale or upscale the texture create for this post process, or an object containing width and height values.\r\n * Default: 1\r\n */\r\n size?: number | { width: number; height: number };\r\n /**\r\n * The camera that the post process will be attached to (default: null)\r\n */\r\n camera?: Nullable<Camera>;\r\n /**\r\n * The sampling mode to be used by the shader (default: Constants.TEXTURE_NEAREST_SAMPLINGMODE)\r\n */\r\n samplingMode?: number;\r\n /**\r\n * The engine to be used to render the post process (default: engine from scene)\r\n */\r\n engine?: Engine;\r\n /**\r\n * If the post process can be reused on the same frame. (default: false)\r\n */\r\n reusable?: boolean;\r\n /**\r\n * Type of the texture created for this post process (default: Constants.TEXTURETYPE_UNSIGNED_INT)\r\n */\r\n textureType?: number;\r\n /**\r\n * The url of the vertex shader to be used. (default: \"postprocess\")\r\n */\r\n vertexUrl?: string;\r\n /**\r\n * The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined)\r\n * See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n */\r\n indexParameters?: any;\r\n /**\r\n * If the shader should not be compiled immediately. (default: false)\r\n */\r\n blockCompilation?: boolean;\r\n /**\r\n * Format of the texture created for this post process (default: TEXTUREFORMAT_RGBA)\r\n */\r\n textureFormat?: number;\r\n /**\r\n * The shader language of the shader. (default: GLSL)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n};\r\n\r\ntype TextureCache = { texture: RenderTargetWrapper; postProcessChannel: number; lastUsedRenderId: number };\r\n\r\n/**\r\n * PostProcess can be used to apply a shader to a texture after it has been rendered\r\n * See https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses\r\n */\r\nexport class PostProcess {\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n private static _CustomShaderCodeProcessing: { [postProcessName: string]: PostProcessCustomShaderCodeProcessing } = {};\r\n\r\n /**\r\n * Registers a shader code processing with a post process name.\r\n * @param postProcessName name of the post process. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to a post process name\r\n * @param customShaderCodeProcessing shader code processing to associate to the post process name\r\n * @returns\r\n */\r\n public static RegisterShaderCodeProcessing(postProcessName: Nullable<string>, customShaderCodeProcessing?: PostProcessCustomShaderCodeProcessing) {\r\n if (!customShaderCodeProcessing) {\r\n delete PostProcess._CustomShaderCodeProcessing[postProcessName ?? \"\"];\r\n return;\r\n }\r\n\r\n PostProcess._CustomShaderCodeProcessing[postProcessName ?? \"\"] = customShaderCodeProcessing;\r\n }\r\n\r\n private static _GetShaderCodeProcessing(postProcessName: string) {\r\n return PostProcess._CustomShaderCodeProcessing[postProcessName] ?? PostProcess._CustomShaderCodeProcessing[\"\"];\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the post process\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /** Name of the PostProcess. */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Width of the texture to apply the post process on\r\n */\r\n @serialize()\r\n public width = -1;\r\n\r\n /**\r\n * Height of the texture to apply the post process on\r\n */\r\n @serialize()\r\n public height = -1;\r\n\r\n /**\r\n * Gets the node material used to create this postprocess (null if the postprocess was manually created)\r\n */\r\n public nodeMaterialSource: Nullable<NodeMaterial> = null;\r\n\r\n /**\r\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\r\n * @internal\r\n */\r\n public _outputTexture: Nullable<RenderTargetWrapper> = null;\r\n /**\r\n * Sampling mode used by the shader\r\n * See https://doc.babylonjs.com/classes/3.1/texture\r\n */\r\n @serialize()\r\n public renderTargetSamplingMode: number;\r\n /**\r\n * Clear color to use when screen clearing\r\n */\r\n @serializeAsColor4()\r\n public clearColor: Color4;\r\n /**\r\n * If the buffer needs to be cleared before applying the post process. (default: true)\r\n * Should be set to false if shader will overwrite all previous pixels.\r\n */\r\n @serialize()\r\n public autoClear = true;\r\n /**\r\n * If clearing the buffer should be forced in autoClear mode, even when alpha mode is enabled (default: false).\r\n * By default, the buffer will only be cleared if alpha mode is disabled (and autoClear is true).\r\n */\r\n @serialize()\r\n public forceAutoClearInAlphaMode = false;\r\n /**\r\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\r\n */\r\n @serialize()\r\n public alphaMode = Constants.ALPHA_DISABLE;\r\n /**\r\n * Sets the setAlphaBlendConstants of the babylon engine\r\n */\r\n @serialize()\r\n public alphaConstants: Color4;\r\n /**\r\n * Animations to be used for the post processing\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\r\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\r\n */\r\n @serialize()\r\n public enablePixelPerfectMode = false;\r\n\r\n /**\r\n * Force the postprocess to be applied without taking in account viewport\r\n */\r\n @serialize()\r\n public forceFullscreenViewport = true;\r\n\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n public inspectableCustomProperties: IInspectable[];\r\n\r\n /**\r\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\r\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\r\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\r\n *\r\n */\r\n @serialize()\r\n public scaleMode = Constants.SCALEMODE_FLOOR;\r\n /**\r\n * Force textures to be a power of two (default: false)\r\n */\r\n @serialize()\r\n public alwaysForcePOT = false;\r\n\r\n @serialize(\"samples\")\r\n private _samples = 1;\r\n\r\n /**\r\n * Number of sample textures (default: 1)\r\n */\r\n public get samples() {\r\n return this._samples;\r\n }\r\n\r\n public set samples(n: number) {\r\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\r\n\r\n this._textures.forEach((texture) => {\r\n texture.setSamples(this._samples);\r\n });\r\n }\r\n\r\n /**\r\n * Modify the scale of the post process to be the same as the viewport (default: false)\r\n */\r\n @serialize()\r\n public adaptScaleToCurrentViewport = false;\r\n\r\n private _camera: Camera;\r\n protected _scene: Scene;\r\n private _engine: Engine;\r\n\r\n private _options: number | { width: number; height: number };\r\n private _reusable = false;\r\n private _renderId = 0;\r\n private _textureType: number;\r\n private _textureFormat: number;\r\n private _shaderLanguage: ShaderLanguage;\r\n\r\n /**\r\n * if externalTextureSamplerBinding is true, the \"apply\" method won't bind the textureSampler texture, it is expected to be done by the \"outside\" (by the onApplyObservable observer most probably).\r\n * counter-productive in some cases because if the texture bound by \"apply\" is different from the currently texture bound, (the one set by the onApplyObservable observer, for eg) some\r\n * internal structures (materialContext) will be dirtified, which may impact performances\r\n */\r\n public externalTextureSamplerBinding = false;\r\n\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @internal\r\n */\r\n public _textures = new SmartArray<RenderTargetWrapper>(2);\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @internal\r\n */\r\n private _textureCache: TextureCache[] = [];\r\n /**\r\n * The index in _textures that corresponds to the output texture.\r\n * @internal\r\n */\r\n public _currentRenderTextureInd = 0;\r\n private _drawWrapper: DrawWrapper;\r\n private _samplers: string[];\r\n private _fragmentUrl: string;\r\n private _vertexUrl: string;\r\n private _parameters: string[];\r\n private _uniformBuffers: string[];\r\n protected _postProcessDefines: Nullable<string>;\r\n private _scaleRatio = new Vector2(1, 1);\r\n protected _indexParameters: any;\r\n private _shareOutputWithPostProcess: Nullable<PostProcess>;\r\n private _texelSize = Vector2.Zero();\r\n\r\n /** @internal */\r\n public _forcedOutputTexture: Nullable<RenderTargetWrapper>;\r\n\r\n /**\r\n * Prepass configuration in case this post process needs a texture from prepass\r\n * @internal\r\n */\r\n public _prePassEffectConfiguration: PrePassEffectConfiguration;\r\n\r\n /**\r\n * Returns the fragment url or shader name used in the post process.\r\n * @returns the fragment url or name in the shader store.\r\n */\r\n public getEffectName(): string {\r\n return this._fragmentUrl;\r\n }\r\n\r\n // Events\r\n\r\n /**\r\n * An event triggered when the postprocess is activated.\r\n */\r\n public onActivateObservable = new Observable<Camera>();\r\n\r\n private _onActivateObserver: Nullable<Observer<Camera>>;\r\n /**\r\n * A function that is added to the onActivateObservable\r\n */\r\n public set onActivate(callback: Nullable<(camera: Camera) => void>) {\r\n if (this._onActivateObserver) {\r\n this.onActivateObservable.remove(this._onActivateObserver);\r\n }\r\n if (callback) {\r\n this._onActivateObserver = this.onActivateObservable.add(callback);\r\n }\r\n }\r\n\r\n /**\r\n * An event triggered when the postprocess changes its size.\r\n */\r\n public onSizeChangedObservable = new Observable<PostProcess>();\r\n\r\n private _onSizeChangedObserver: Nullable<Observer<PostProcess>>;\r\n /**\r\n * A function that is added to the onSizeChangedObservable\r\n */\r\n public set onSizeChanged(callback: (postProcess: PostProcess) => void) {\r\n if (this._onSizeChangedObserver) {\r\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\r\n }\r\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered when the postprocess applies its effect.\r\n */\r\n public onApplyObservable = new Observable<Effect>();\r\n\r\n private _onApplyObserver: Nullable<Observer<Effect>>;\r\n /**\r\n * A function that is added to the onApplyObservable\r\n */\r\n public set onApply(callback: (effect: Effect) => void) {\r\n if (this._onApplyObserver) {\r\n this.onApplyObservable.remove(this._onApplyObserver);\r\n }\r\n this._onApplyObserver = this.onApplyObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered before rendering the postprocess\r\n */\r\n public onBeforeRenderObservable = new Observable<Effect>();\r\n\r\n private _onBeforeRenderObserver: Nullable<Observer<Effect>>;\r\n /**\r\n * A function that is added to the onBeforeRenderObservable\r\n */\r\n public set onBeforeRender(callback: (effect: Effect) => void) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered after rendering the postprocess\r\n */\r\n public onAfterRenderObservable = new Observable<Effect>();\r\n\r\n private _onAfterRenderObserver: Nullable<Observer<Effect>>;\r\n /**\r\n * A function that is added to the onAfterRenderObservable\r\n */\r\n public set onAfterRender(callback: (efect: Effect) => void) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n }\r\n\r\n /**\r\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\r\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\r\n */\r\n public get inputTexture(): RenderTargetWrapper {\r\n return this._textures.data[this._currentRenderTextureInd];\r\n }\r\n\r\n public set inputTexture(value: RenderTargetWrapper) {\r\n this._forcedOutputTexture = value;\r\n }\r\n\r\n /**\r\n * Since inputTexture should always be defined, if we previously manually set `inputTexture`,\r\n * the only way to unset it is to use this function to restore its internal state\r\n */\r\n public restoreDefaultInputTexture() {\r\n if (this._forcedOutputTexture) {\r\n this._forcedOutputTexture = null;\r\n this.markTextureDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the camera which post process is applied to.\r\n * @returns The camera the post process is applied to.\r\n */\r\n public getCamera(): Camera {\r\n return this._camera;\r\n }\r\n\r\n /**\r\n * Gets the texel size of the postprocess.\r\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\r\n */\r\n public get texelSize(): Vector2 {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.texelSize;\r\n }\r\n\r\n if (this._forcedOutputTexture) {\r\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\r\n }\r\n\r\n return this._texelSize;\r\n }\r\n\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param options The options to be used when constructing the post process.\r\n */\r\n constructor(name: string, fragmentUrl: string, options?: PostProcessOptions);\r\n\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\r\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param blockCompilation If the shader should not be compiled immediatly. (default: false)\r\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\r\n * @param shaderLanguage The shader language of the shader. (default: GLSL)\r\n */\r\n constructor(\r\n name: string,\r\n fragmentUrl: string,\r\n parameters: Nullable<string[]>,\r\n samplers: Nullable<string[]>,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode?: number,\r\n engine?: Engine,\r\n reusable?: boolean,\r\n defines?: Nullable<string>,\r\n textureType?: number,\r\n vertexUrl?: string,\r\n indexParameters?: any,\r\n blockCompilation?: boolean,\r\n textureFormat?: number,\r\n shaderLanguage?: ShaderLanguage\r\n );\r\n\r\n /** @internal */\r\n constructor(\r\n name: string,\r\n fragmentUrl: string,\r\n parameters?: Nullable<string[]> | PostProcessOptions,\r\n samplers?: Nullable<string[]>,\r\n _size?: number | PostProcessOptions,\r\n camera?: Nullable<Camera>,\r\n samplingMode: number = Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n engine?: Engine,\r\n reusable?: boolean,\r\n defines: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n vertexUrl: string = \"postprocess\",\r\n indexParameters?: any,\r\n blockCompilation = false,\r\n textureFormat = Constants.TEXTUREFORMAT_RGBA,\r\n shaderLanguage = ShaderLanguage.GLSL\r\n ) {\r\n this.name = name;\r\n let size: number | { width: number; height: number } = 1;\r\n let uniformBuffers: Nullable<string[]> = null;\r\n if (parameters && !Array.isArray(parameters)) {\r\n const options = parameters;\r\n parameters = options.uniforms ?? null;\r\n samplers = options.samplers ?? null;\r\n size = options.size ?? 1;\r\n camera = options.camera ?? null;\r\n samplingMode = options.samplingMode ?? Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n engine = options.engine;\r\n reusable = options.reusable;\r\n defines = options.defines ?? null;\r\n textureType = options.textureType ?? Constants.TEXTURETYPE_UNSIGNED_INT;\r\n vertexUrl = options.vertexUrl ?? \"postprocess\";\r\n indexParameters = options.indexParameters;\r\n blockCompilation = options.blockCompilation ?? false;\r\n textureFormat = options.textureFormat ?? Constants.TEXTUREFORMAT_RGBA;\r\n shaderLanguage = options.shaderLanguage ?? ShaderLanguage.GLSL;\r\n uniformBuffers = options.uniformBuffers ?? null;\r\n } else if (_size) {\r\n if (typeof _size === \"number\") {\r\n size = _size;\r\n } else {\r\n size = { width: _size.width!, height: _size.height! };\r\n }\r\n }\r\n\r\n if (camera != null) {\r\n this._camera = camera;\r\n this._scene = camera.getScene();\r\n camera.attachPostProcess(this);\r\n this._engine = this._scene.getEngine();\r\n\r\n this._scene.postProcesses.push(this);\r\n this.uniqueId = this._scene.getUniqueId();\r\n } else if (engine) {\r\n this._engine = engine;\r\n this._engine.postProcesses.push(this);\r\n }\r\n\r\n this._options = size;\r\n this.renderTargetSamplingMode = samplingMode ? samplingMode : Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n this._reusable = reusable || false;\r\n this._textureType = textureType;\r\n this._textureFormat = textureFormat;\r\n this._shaderLanguage = shaderLanguage;\r\n\r\n this._samplers = samplers || [];\r\n this._samplers.push(\"textureSampler\");\r\n\r\n this._fragmentUrl = fragmentUrl;\r\n this._vertexUrl = vertexUrl;\r\n this._parameters = parameters || [];\r\n\r\n this._parameters.push(\"scale\");\r\n this._uniformBuffers = uniformBuffers || [];\r\n\r\n this._indexParameters = indexParameters;\r\n this._drawWrapper = new DrawWrapper(this._engine);\r\n\r\n if (!blockCompilation) {\r\n this.updateEffect(defines);\r\n }\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"PostProcess\" string\r\n */\r\n public getClassName(): string {\r\n return \"PostProcess\";\r\n }\r\n\r\n /**\r\n * Gets the engine which this post process belongs to.\r\n * @returns The engine the post process was enabled with.\r\n */\r\n public getEngine(): Engine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the postprocess.\r\n */\r\n public getEffect(): Effect {\r\n return this._drawWrapper.effect!;\r\n }\r\n\r\n /**\r\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\r\n * @param postProcess The post process to share the output with.\r\n * @returns This post process.\r\n */\r\n public shareOutputWith(postProcess: PostProcess): PostProcess {\r\n this._disposeTextures();\r\n\r\n this._shareOutputWithPostProcess = postProcess;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\r\n * This should be called if the post process that shares output with this post process is disabled/disposed.\r\n */\r\n public useOwnOutput() {\r\n if (this._textures.length == 0) {\r\n this._textures = new SmartArray<RenderTargetWrapper>(2);\r\n }\r\n\r\n this._shareOutputWithPostProcess = null;\r\n }\r\n\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\r\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\r\n */\r\n public updateEffect(\r\n defines: Nullable<string> = null,\r\n uniforms: Nullable<string[]> = null,\r\n samplers: Nullable<string[]> = null,\r\n indexParameters?: any,\r\n onCompiled?: (effect: Effect) => void,\r\n onError?: (effect: Effect, errors: string) => void,\r\n vertexUrl?: string,\r\n fragmentUrl?: string\r\n ) {\r\n const customShaderCodeProcessing = PostProcess._GetShaderCodeProcessing(this.name);\r\n if (customShaderCodeProcessing?.defineCustomBindings) {\r\n const newUniforms = uniforms?.slice() ?? [];\r\n newUniforms.push(...this._parameters);\r\n\r\n const newSamplers = samplers?.slice() ?? [];\r\n newSamplers.push(...this._samplers);\r\n\r\n defines = customShaderCodeProcessing.defineCustomBindings(this.name, defines, newUniforms, newSamplers);\r\n uniforms = newUniforms;\r\n samplers = newSamplers;\r\n }\r\n this._postProcessDefines = defines;\r\n this._drawWrapper.effect = this._engine.createEffect(\r\n { vertex: vertexUrl ?? this._vertexUrl, fragment: fragmentUrl ?? this._fragmentUrl },\r\n {\r\n attributes: [\"position\"],\r\n uniformsNames: uniforms || this._parameters,\r\n uniformBuffersNames: this._uniformBuffers,\r\n samplers: samplers || this._samplers,\r\n defines: defines !== null ? defines : \"\",\r\n fallbacks: null,\r\n onCompiled: onCompiled ?? null,\r\n onError: onError ?? null,\r\n indexParameters: indexParameters || this._indexParameters,\r\n processCodeAfterIncludes: customShaderCodeProcessing?.processCodeAfterIncludes\r\n ? (shaderType: string, code: string) => customShaderCodeProcessing!.processCodeAfterIncludes!(this.name, shaderType, code)\r\n : null,\r\n processFinalCode: customShaderCodeProcessing?.processFinalCode\r\n ? (shaderType: string, code: string) => customShaderCodeProcessing!.processFinalCode!(this.name, shaderType, code)\r\n : null,\r\n shaderLanguage: this._shaderLanguage,\r\n },\r\n this._engine\r\n );\r\n }\r\n\r\n /**\r\n * The post process is reusable if it can be used multiple times within one frame.\r\n * @returns If the post process is reusable\r\n */\r\n public isReusable(): boolean {\r\n return this._reusable;\r\n }\r\n\r\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\r\n public markTextureDirty(): void {\r\n this.width = -1;\r\n }\r\n\r\n private _createRenderTargetTexture(textureSize: { width: number; height: number }, textureOptions: RenderTargetCreationOptions, channel = 0) {\r\n for (let i = 0; i < this._textureCache.length; i++) {\r\n if (\r\n this._textureCache[i].texture.width === textureSize.width &&\r\n this._textureCache[i].texture.height === textureSize.height &&\r\n this._textureCache[i].postProcessChannel === channel &&\r\n this._textureCache[i].texture._generateDepthBuffer === textureOptions.generateDepthBuffer &&\r\n this._textureCache[i].texture.samples === textureOptions.samples\r\n ) {\r\n return this._textureCache[i].texture;\r\n }\r\n }\r\n\r\n const tex = this._engine.createRenderTargetTexture(textureSize, textureOptions);\r\n this._textureCache.push({ texture: tex, postProcessChannel: channel, lastUsedRenderId: -1 });\r\n\r\n return tex;\r\n }\r\n\r\n private _flushTextureCache() {\r\n const currentRenderId = this._renderId;\r\n\r\n for (let i = this._textureCache.length - 1; i >= 0; i--) {\r\n if (currentRenderId - this._textureCache[i].lastUsedRenderId > 100) {\r\n let currentlyUsed = false;\r\n for (let j = 0; j < this._textures.length; j++) {\r\n if (this._textures.data[j] === this._textureCache[i].texture) {\r\n currentlyUsed = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!currentlyUsed) {\r\n this._textureCache[i].texture.dispose();\r\n this._textureCache.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Resizes the post-process texture\r\n * @param width Width of the texture\r\n * @param height Height of the texture\r\n * @param camera The camera this post-process is applied to. Pass null if the post-process is used outside the context of a camera post-process chain (default: null)\r\n * @param needMipMaps True if mip maps need to be generated after render (default: false)\r\n * @param forceDepthStencil True to force post-process texture creation with stencil depth and buffer (default: false)\r\n */\r\n public resize(width: number, height: number, camera: Nullable<Camera> = null, needMipMaps = false, forceDepthStencil = false) {\r\n if (this._textures.length > 0) {\r\n this._textures.reset();\r\n }\r\n\r\n this.width = width;\r\n this.height = height;\r\n\r\n let firstPP = null;\r\n if (camera) {\r\n for (let i = 0; i < camera._postProcesses.length; i++) {\r\n if (camera._postProcesses[i] !== null) {\r\n firstPP = camera._postProcesses[i];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const textureSize = { width: this.width, height: this.height };\r\n const textureOptions = {\r\n generateMipMaps: needMipMaps,\r\n generateDepthBuffer: forceDepthStencil || firstPP === this,\r\n generateStencilBuffer: (forceDepthStencil || firstPP === this) && this._engine.isStencilEnable,\r\n samplingMode: this.renderTargetSamplingMode,\r\n type: this._textureType,\r\n format: this._textureFormat,\r\n samples: this._samples,\r\n label: \"PostProcessRTT-\" + this.name,\r\n };\r\n\r\n this._textures.push(this._createRenderTargetTexture(textureSize, textureOptions, 0));\r\n\r\n if (this._reusable) {\r\n this._textures.push(this._createRenderTargetTexture(textureSize, textureOptions, 1));\r\n }\r\n\r\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\r\n\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n }\r\n\r\n private _getTarget() {\r\n let target: RenderTargetWrapper;\r\n\r\n if (this._shareOutputWithPostProcess) {\r\n target = this._shareOutputWithPostProcess.inputTexture;\r\n } else if (this._forcedOutputTexture) {\r\n target = this._forcedOutputTexture;\r\n\r\n this.width = this._forcedOutputTexture.width;\r\n this.height = this._forcedOutputTexture.height;\r\n } else {\r\n target = this.inputTexture;\r\n\r\n let cache;\r\n for (let i = 0; i < this._textureCache.length; i++) {\r\n if (this._textureCache[i].texture === target) {\r\n cache = this._textureCache[i];\r\n break;\r\n }\r\n }\r\n\r\n if (cache) {\r\n cache.lastUsedRenderId = this._renderId;\r\n }\r\n }\r\n\r\n return target;\r\n }\r\n\r\n /**\r\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\r\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\r\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\r\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\r\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\r\n * @returns The render target wrapper that was bound to be written to.\r\n */\r\n public activate(camera: Nullable<Camera>, sourceTexture: Nullable<InternalTexture> = null, forceDepthStencil?: boolean): RenderTargetWrapper {\r\n camera = camera || this._camera;\r\n\r\n const scene = camera.getScene();\r\n const engine = scene.getEngine();\r\n const maxSize = engine.getCaps().maxTextureSize;\r\n\r\n const requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * <number>this._options) | 0;\r\n const requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * <number>this._options) | 0;\r\n\r\n let desiredWidth = (<PostProcessOptions>this._options).width || requiredWidth;\r\n let desiredHeight = (<PostProcessOptions>this._options).height || requiredHeight;\r\n\r\n const needMipMaps =\r\n this.renderTargetSamplingMode !== Constants.TEXTURE_NEAREST_LINEAR &&\r\n this.renderTargetSamplingMode !== Constants.TEXTURE_NEAREST_NEAREST &&\r\n this.renderTargetSamplingMode !== Constants.TEXTURE_LINEAR_LINEAR;\r\n\r\n let target: Nullable<RenderTargetWrapper> = null;\r\n\r\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\r\n if (this.adaptScaleToCurrentViewport) {\r\n const currentViewport = engine.currentViewport;\r\n\r\n if (currentViewport) {\r\n desiredWidth *= currentViewport.width;\r\n desiredHeight *= currentViewport.height;\r\n }\r\n }\r\n\r\n if (needMipMaps || this.alwaysForcePOT) {\r\n if (!(<PostProcessOptions>this._options).width) {\r\n desiredWidth = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\r\n }\r\n\r\n if (!(<PostProcessOptions>this._options).height) {\r\n desiredHeight = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\r\n }\r\n }\r\n\r\n if (this.width !== desiredWidth || this.height !== desiredHeight || !(target = this._getTarget())) {\r\n this.resize(desiredWidth, desiredHeight, camera, needMipMaps, forceDepthStencil);\r\n }\r\n\r\n this._textures.forEach((texture) => {\r\n if (texture.samples !== this.samples) {\r\n this._engine.updateRenderTargetTextureSampleCount(texture, this.samples);\r\n }\r\n });\r\n\r\n this._flushTextureCache();\r\n this._renderId++;\r\n }\r\n\r\n if (!target) {\r\n target = this._getTarget();\r\n }\r\n\r\n // Bind the input of this post process to be used as the output of the previous post process.\r\n if (this.enablePixelPerfectMode) {\r\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\r\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\r\n } else {\r\n this._scaleRatio.copyFromFloats(1, 1);\r\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\r\n }\r\n\r\n this._engine._debugInsertMarker?.(`post process ${this.name} input`);\r\n\r\n this.onActivateObservable.notifyObservers(camera);\r\n\r\n // Clear\r\n if (this.autoClear && (this.alphaMode === Constants.ALPHA_DISABLE || this.forceAutoClearInAlphaMode)) {\r\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\r\n }\r\n\r\n if (this._reusable) {\r\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\r\n }\r\n return target;\r\n }\r\n\r\n /**\r\n * If the post process is supported.\r\n */\r\n public get isSupported(): boolean {\r\n return this._drawWrapper.effect!.isSupported;\r\n }\r\n\r\n /**\r\n * The aspect ratio of the output texture.\r\n */\r\n public get aspectRatio(): number {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.aspectRatio;\r\n }\r\n\r\n if (this._forcedOutputTexture) {\r\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\r\n }\r\n return this.width / this.height;\r\n }\r\n\r\n /**\r\n * Get a value indicating if the post-process is ready to be used\r\n * @returns true if the post-process is ready (shader is compiled)\r\n */\r\n public isReady(): boolean {\r\n return this._drawWrapper.effect?.isReady() ?? false;\r\n }\r\n\r\n /**\r\n * Binds all textures and uniforms to the shader, this will be run on every pass.\r\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\r\n */\r\n public apply(): Nullable<Effect> {\r\n // Check\r\n if (!this._drawWrapper.effect?.isReady()) {\r\n return null;\r\n }\r\n\r\n // States\r\n this._engine.enableEffect(this._drawWrapper);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n\r\n // Alpha\r\n this._engine.setAlphaMode(this.alphaMode);\r\n if (this.alphaConstants) {\r\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\r\n }\r\n\r\n // Bind the output texture of the preivous post process as the input to this post process.\r\n let source: RenderTargetWrapper;\r\n if (this._shareOutputWithPostProcess) {\r\n source = this._shareOutputWithPostProcess.inputTexture;\r\n } else if (this._forcedOutputTexture) {\r\n source = this._forcedOutputTexture;\r\n } else {\r\n source = this.inputTexture;\r\n }\r\n\r\n if (!this.externalTextureSamplerBinding) {\r\n this._drawWrapper.effect._bindTexture(\"textureSampler\", source?.texture);\r\n }\r\n\r\n // Parameters\r\n this._drawWrapper.effect.setVector2(\"scale\", this._scaleRatio);\r\n this.onApplyObservable.notifyObservers(this._drawWrapper.effect);\r\n\r\n PostProcess._GetShaderCodeProcessing(this.name)?.bindCustomBindings?.(this.name, this._drawWrapper.effect);\r\n\r\n return this._drawWrapper.effect;\r\n }\r\n\r\n private _disposeTextures() {\r\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\r\n this._disposeTextureCache();\r\n return;\r\n }\r\n\r\n this._disposeTextureCache();\r\n this._textures.dispose();\r\n }\r\n\r\n private _disposeTextureCache() {\r\n for (let i = this._textureCache.length - 1; i >= 0; i--) {\r\n this._textureCache[i].texture.dispose();\r\n }\r\n\r\n this._textureCache.length = 0;\r\n }\r\n\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup.\r\n * @returns true if the pre pass is needed.\r\n */\r\n public setPrePassRenderer(prePassRenderer: PrePassRenderer): boolean {\r\n if (this._prePassEffectConfiguration) {\r\n this._prePassEffectConfiguration = prePassRenderer.addEffectConfiguration(this._prePassEffectConfiguration);\r\n this._prePassEffectConfiguration.enabled = true;\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n public dispose(camera?: Camera): void {\r\n camera = camera || this._camera;\r\n\r\n this._disposeTextures();\r\n\r\n let index;\r\n if (this._scene) {\r\n index = this._scene.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.postProcesses.splice(index, 1);\r\n }\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.postProcesses.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.postProcesses.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n index = this._engine.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._engine.postProcesses.splice(index, 1);\r\n }\r\n\r\n if (!camera) {\r\n return;\r\n }\r\n camera.detachPostProcess(this);\r\n\r\n index = camera._postProcesses.indexOf(this);\r\n if (index === 0 && camera._postProcesses.length > 0) {\r\n const firstPostProcess = this._camera._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n }\r\n\r\n this.onActivateObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onApplyObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Serializes the post process to a JSON object\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n const camera = this.getCamera() || (this._scene && this._scene.activeCamera);\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.cameraId = camera ? camera.id : null;\r\n serializationObject.reusable = this._reusable;\r\n serializationObject.textureType = this._textureType;\r\n serializationObject.fragmentUrl = this._fragmentUrl;\r\n serializationObject.parameters = this._parameters;\r\n serializationObject.samplers = this._samplers;\r\n serializationObject.options = this._options;\r\n serializationObject.defines = this._postProcessDefines;\r\n serializationObject.textureFormat = this._textureFormat;\r\n serializationObject.vertexUrl = this._vertexUrl;\r\n serializationObject.indexParameters = this._indexParameters;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Clones this post process\r\n * @returns a new post process similar to this one\r\n */\r\n public clone(): Nullable<PostProcess> {\r\n const serializationObject = this.serialize();\r\n serializationObject._engine = this._engine;\r\n serializationObject.cameraId = null;\r\n\r\n const result = PostProcess.Parse(serializationObject, this._scene, \"\");\r\n\r\n if (!result) {\r\n return null;\r\n }\r\n\r\n result.onActivateObservable = this.onActivateObservable.clone();\r\n result.onSizeChangedObservable = this.onSizeChangedObservable.clone();\r\n result.onApplyObservable = this.onApplyObservable.clone();\r\n result.onBeforeRenderObservable = this.onBeforeRenderObservable.clone();\r\n result.onAfterRenderObservable = this.onAfterRenderObservable.clone();\r\n\r\n result._prePassEffectConfiguration = this._prePassEffectConfiguration;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedPostProcess defines parsed post process data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new post process\r\n */\r\n public static Parse(parsedPostProcess: any, scene: Scene, rootUrl: string): Nullable<PostProcess> {\r\n const postProcessType = GetClass(parsedPostProcess.customType);\r\n\r\n if (!postProcessType || !postProcessType._Parse) {\r\n return null;\r\n }\r\n\r\n const camera = scene ? scene.getCameraById(parsedPostProcess.cameraId) : null;\r\n return postProcessType._Parse(parsedPostProcess, camera, scene, rootUrl);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<PostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new PostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.fragmentUrl,\r\n parsedPostProcess.parameters,\r\n parsedPostProcess.samplers,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n parsedPostProcess._engine,\r\n parsedPostProcess.reusable,\r\n parsedPostProcess.defines,\r\n parsedPostProcess.textureType,\r\n parsedPostProcess.vertexUrl,\r\n parsedPostProcess.indexParameters,\r\n false,\r\n parsedPostProcess.textureFormat\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PostProcess\", PostProcess);\r\n"]}
@@ -72,7 +72,7 @@ export declare class GeometryBufferRenderer {
72
72
  private _scene;
73
73
  private _resizeObserver;
74
74
  private _multiRenderTarget;
75
- private _ratio;
75
+ private _ratioOrDimensions;
76
76
  private _enablePosition;
77
77
  private _enableVelocity;
78
78
  private _enableReflectivity;
@@ -192,10 +192,13 @@ export declare class GeometryBufferRenderer {
192
192
  /**
193
193
  * Creates a new G Buffer for the scene
194
194
  * @param scene The scene the buffer belongs to
195
- * @param ratio How big is the buffer related to the main canvas (default: 1)
195
+ * @param ratioOrDimensions How big is the buffer related to the main canvas (default: 1). You can also directly pass a width and height for the generated textures @since
196
196
  * @param depthFormat Format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH16)
197
197
  */
198
- constructor(scene: Scene, ratio?: number, depthFormat?: number);
198
+ constructor(scene: Scene, ratioOrDimensions?: number | {
199
+ width: number;
200
+ height: number;
201
+ }, depthFormat?: number);
199
202
  /**
200
203
  * Checks whether everything is ready to render a submesh to the G buffer.
201
204
  * @param subMesh the submesh to check readiness for
@@ -33,6 +33,7 @@ const uniforms = [
33
33
  "morphTargetInfluences",
34
34
  "morphTargetTextureInfo",
35
35
  "morphTargetTextureIndices",
36
+ "boneTextureWidth",
36
37
  ];
37
38
  addClipPlaneUniforms(uniforms);
38
39
  /**
@@ -223,15 +224,15 @@ export class GeometryBufferRenderer {
223
224
  * How big is the buffer related to the main canvas.
224
225
  */
225
226
  get ratio() {
226
- return this._ratio;
227
+ return typeof this._ratioOrDimensions === "object" ? 1 : this._ratioOrDimensions;
227
228
  }
228
229
  /**
229
230
  * Creates a new G Buffer for the scene
230
231
  * @param scene The scene the buffer belongs to
231
- * @param ratio How big is the buffer related to the main canvas (default: 1)
232
+ * @param ratioOrDimensions How big is the buffer related to the main canvas (default: 1). You can also directly pass a width and height for the generated textures @since
232
233
  * @param depthFormat Format of the depth texture (default: 15)
233
234
  */
234
- constructor(scene, ratio = 1, depthFormat = 15) {
235
+ constructor(scene, ratioOrDimensions = 1, depthFormat = 15) {
235
236
  /**
236
237
  * Dictionary used to store the previous transformation matrices of each rendered mesh
237
238
  * in order to compute objects velocities when enableVelocity is set to "true"
@@ -273,7 +274,7 @@ export class GeometryBufferRenderer {
273
274
  */
274
275
  this.useSpecificClearForDepthTexture = false;
275
276
  this._scene = scene;
276
- this._ratio = ratio;
277
+ this._ratioOrDimensions = ratioOrDimensions;
277
278
  this._useUbo = scene.getEngine().supportsUniformBuffers;
278
279
  this._depthFormat = depthFormat;
279
280
  GeometryBufferRenderer._SceneComponentInitialization(this._scene);
@@ -471,7 +472,7 @@ export class GeometryBufferRenderer {
471
472
  defines.push("#define NORMAL_WORLDSPACE");
472
473
  }
473
474
  // Bones
474
- if (mesh.useBones && mesh.computeBonesUsingShaders) {
475
+ if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {
475
476
  attribs.push(VertexBuffer.MatricesIndicesKind);
476
477
  attribs.push(VertexBuffer.MatricesWeightsKind);
477
478
  if (mesh.numBoneInfluencers > 4) {
@@ -479,10 +480,13 @@ export class GeometryBufferRenderer {
479
480
  attribs.push(VertexBuffer.MatricesWeightsExtraKind);
480
481
  }
481
482
  defines.push("#define NUM_BONE_INFLUENCERS " + mesh.numBoneInfluencers);
482
- defines.push("#define BonesPerMesh " + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));
483
+ defines.push("#define BONETEXTURE " + mesh.skeleton.isUsingTextureForMatrices);
484
+ defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
483
485
  }
484
486
  else {
485
487
  defines.push("#define NUM_BONE_INFLUENCERS 0");
488
+ defines.push("#define BONETEXTURE false");
489
+ defines.push("#define BonesPerMesh 0");
486
490
  }
487
491
  // Morph targets
488
492
  const morphTargetManager = mesh.morphTargetManager;
@@ -523,7 +527,7 @@ export class GeometryBufferRenderer {
523
527
  drawWrapper.setEffect(engine.createEffect("geometry", {
524
528
  attributes: attribs,
525
529
  uniformsNames: uniforms,
526
- samplers: ["diffuseSampler", "bumpSampler", "reflectivitySampler", "albedoSampler", "morphTargets"],
530
+ samplers: ["diffuseSampler", "bumpSampler", "reflectivitySampler", "albedoSampler", "morphTargets", "boneSampler"],
527
531
  defines: join,
528
532
  onCompiled: null,
529
533
  fallbacks: null,
@@ -595,7 +599,10 @@ export class GeometryBufferRenderer {
595
599
  else if (engine._caps.textureHalfFloat && engine._caps.textureHalfFloatLinearFiltering) {
596
600
  type = 2;
597
601
  }
598
- this._multiRenderTarget = new MultiRenderTarget("gBuffer", { width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio }, count, this._scene, { generateMipMaps: false, generateDepthTexture: true, defaultType: type, depthTextureFormat: this._depthFormat }, textureNames.concat("gBuffer_DepthBuffer"));
602
+ const dimensions = this._ratioOrDimensions.width !== undefined
603
+ ? this._ratioOrDimensions
604
+ : { width: engine.getRenderWidth() * this._ratioOrDimensions, height: engine.getRenderHeight() * this._ratioOrDimensions };
605
+ this._multiRenderTarget = new MultiRenderTarget("gBuffer", dimensions, count, this._scene, { generateMipMaps: false, generateDepthTexture: true, defaultType: type, depthTextureFormat: this._depthFormat }, textureNames.concat("gBuffer_DepthBuffer"));
599
606
  if (!this.isSupported) {
600
607
  return;
601
608
  }
@@ -627,7 +634,10 @@ export class GeometryBufferRenderer {
627
634
  });
628
635
  this._resizeObserver = engine.onResizeObservable.add(() => {
629
636
  if (this._multiRenderTarget) {
630
- this._multiRenderTarget.resize({ width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio });
637
+ const dimensions = this._ratioOrDimensions.width !== undefined
638
+ ? this._ratioOrDimensions
639
+ : { width: engine.getRenderWidth() * this._ratioOrDimensions, height: engine.getRenderHeight() * this._ratioOrDimensions };
640
+ this._multiRenderTarget.resize(dimensions);
631
641
  }
632
642
  });
633
643
  // Custom render function
@@ -797,7 +807,15 @@ export class GeometryBufferRenderer {
797
807
  bindClipPlane(effect, material, this._scene);
798
808
  // Bones
799
809
  if (renderingMesh.useBones && renderingMesh.computeBonesUsingShaders && renderingMesh.skeleton) {
800
- effect.setMatrices("mBones", renderingMesh.skeleton.getTransformMatrices(renderingMesh));
810
+ const skeleton = renderingMesh.skeleton;
811
+ if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex("boneTextureWidth") > -1) {
812
+ const boneTexture = skeleton.getTransformMatrixTexture(renderingMesh);
813
+ effect.setTexture("boneSampler", boneTexture);
814
+ effect.setFloat("boneTextureWidth", 4.0 * (skeleton.bones.length + 1));
815
+ }
816
+ else {
817
+ effect.setMatrices("mBones", renderingMesh.skeleton.getTransformMatrices(renderingMesh));
818
+ }
801
819
  if (this._enableVelocity) {
802
820
  effect.setMatrices("mPreviousBones", this._previousBonesTransformationMatrices[renderingMesh.uniqueId]);
803
821
  }