@babylonjs/core 7.34.1 → 7.34.3

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 (95) hide show
  1. package/Animations/animationGroup.js +1 -1
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Behaviors/Meshes/pointerDragBehavior.js +1 -0
  4. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  5. package/Collisions/gpuPicker.d.ts +1 -1
  6. package/Collisions/gpuPicker.js +1 -1
  7. package/Collisions/gpuPicker.js.map +1 -1
  8. package/Compat/index.d.ts +1 -1
  9. package/Compat/index.js +1 -1
  10. package/Compat/index.js.map +1 -1
  11. package/Engines/WebGPU/Extensions/engine.query.js +9 -9
  12. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  13. package/Engines/abstractEngine.js +2 -2
  14. package/Engines/abstractEngine.js.map +1 -1
  15. package/Engines/thinWebGPUEngine.d.ts +3 -0
  16. package/Engines/thinWebGPUEngine.js.map +1 -1
  17. package/Engines/webgpuEngine.d.ts +1 -3
  18. package/Engines/webgpuEngine.js +1 -0
  19. package/Engines/webgpuEngine.js.map +1 -1
  20. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +1 -2
  21. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +9 -1
  23. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +20 -2
  24. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  25. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +5 -1
  26. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +18 -2
  27. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  28. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.d.ts +5 -1
  29. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +16 -2
  30. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -1
  31. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +9 -6
  32. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +27 -25
  33. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  34. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +9 -6
  35. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +25 -23
  36. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  37. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +3 -2
  38. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +8 -8
  39. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  40. package/FrameGraph/frameGraphRenderContext.d.ts +7 -3
  41. package/FrameGraph/frameGraphRenderContext.js +23 -4
  42. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  43. package/Gizmos/boundingBoxGizmo.d.ts +52 -10
  44. package/Gizmos/boundingBoxGizmo.js +17 -0
  45. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  46. package/Gizmos/positionGizmo.js +1 -0
  47. package/Gizmos/positionGizmo.js.map +1 -1
  48. package/Gizmos/rotationGizmo.js +1 -0
  49. package/Gizmos/rotationGizmo.js.map +1 -1
  50. package/Materials/PBR/pbrSubSurfaceConfiguration.js +1 -0
  51. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  52. package/Materials/Textures/baseTexture.d.ts +4 -0
  53. package/Materials/Textures/baseTexture.js +3 -0
  54. package/Materials/Textures/baseTexture.js.map +1 -1
  55. package/Materials/Textures/multiRenderTarget.js +1 -1
  56. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  57. package/Materials/Textures/renderTargetTexture.d.ts +46 -42
  58. package/Materials/Textures/renderTargetTexture.js +249 -435
  59. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  60. package/Meshes/abstractMesh.hotSpot.d.ts +4 -2
  61. package/Meshes/abstractMesh.hotSpot.js +34 -7
  62. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  63. package/Meshes/csg2.js +1 -1
  64. package/Meshes/csg2.js.map +1 -1
  65. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +1 -1
  66. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +3 -9
  67. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  68. package/Rendering/index.d.ts +1 -0
  69. package/Rendering/index.js +1 -0
  70. package/Rendering/index.js.map +1 -1
  71. package/Rendering/objectRenderer.d.ts +228 -0
  72. package/Rendering/objectRenderer.js +517 -0
  73. package/Rendering/objectRenderer.js.map +1 -0
  74. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +2 -3
  75. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  76. package/XR/features/WebXRControllerTeleportation.js +6 -0
  77. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  78. package/XR/features/WebXRDepthSensing.js +1 -0
  79. package/XR/features/WebXRDepthSensing.js.map +1 -1
  80. package/XR/features/WebXRHandTracking.js +1 -0
  81. package/XR/features/WebXRHandTracking.js.map +1 -1
  82. package/XR/motionController/webXRAbstractMotionController.js +1 -0
  83. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  84. package/XR/webXRCamera.js +1 -0
  85. package/XR/webXRCamera.js.map +1 -1
  86. package/XR/webXRManagedOutputCanvas.js +1 -0
  87. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  88. package/XR/webXRSessionManager.js +1 -0
  89. package/XR/webXRSessionManager.js.map +1 -1
  90. package/index.d.ts +6 -6
  91. package/index.js +6 -6
  92. package/index.js.map +1 -1
  93. package/package.json +1 -1
  94. package/scene.js +21 -7
  95. package/scene.js.map +1 -1
@@ -2,12 +2,11 @@ import { Observable } from "../../Misc/observable.js";
2
2
  import { Matrix, Vector3 } from "../../Maths/math.vector.js";
3
3
  import { Texture } from "../../Materials/Textures/texture.js";
4
4
  import { PostProcessManager } from "../../PostProcesses/postProcessManager.js";
5
- import { RenderingManager } from "../../Rendering/renderingManager.js";
6
5
 
7
- import { _ObserveArray } from "../../Misc/arrayTools.js";
8
6
  import { FloorPOT, NearestPOT } from "../../Misc/tools.functions.js";
9
7
  import { Effect } from "../effect.js";
10
8
  import { Logger } from "../../Misc/logger.js";
9
+ import { ObjectRenderer } from "../../Rendering/objectRenderer.js";
11
10
  /**
12
11
  * Sets a depth stencil texture from a render target on the engine to be used in the shader.
13
12
  * @param channel Name of the sampler variable.
@@ -22,24 +21,103 @@ Effect.prototype.setDepthStencilTexture = function (channel, texture) {
22
21
  * Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...
23
22
  */
24
23
  export class RenderTargetTexture extends Texture {
24
+ /**
25
+ * Use this predicate to dynamically define the list of mesh you want to render.
26
+ * If set, the renderList property will be overwritten.
27
+ */
28
+ get renderListPredicate() {
29
+ return this._objectRenderer.renderListPredicate;
30
+ }
31
+ set renderListPredicate(value) {
32
+ this._objectRenderer.renderListPredicate = value;
33
+ }
25
34
  /**
26
35
  * Use this list to define the list of mesh you want to render.
27
36
  */
28
37
  get renderList() {
29
- return this._renderList;
38
+ return this._objectRenderer.renderList;
30
39
  }
31
40
  set renderList(value) {
32
- if (this._renderList === value) {
33
- return;
34
- }
35
- if (this._unObserveRenderList) {
36
- this._unObserveRenderList();
37
- this._unObserveRenderList = null;
38
- }
39
- if (value) {
40
- this._unObserveRenderList = _ObserveArray(value, this._renderListHasChanged);
41
- }
42
- this._renderList = value;
41
+ this._objectRenderer.renderList = value;
42
+ }
43
+ /**
44
+ * Define the list of particle systems to render in the texture. If not provided, will render all the particle systems of the scene.
45
+ * Note that the particle systems are rendered only if renderParticles is set to true.
46
+ */
47
+ get particleSystemList() {
48
+ return this._objectRenderer.particleSystemList;
49
+ }
50
+ set particleSystemList(value) {
51
+ this._objectRenderer.particleSystemList = value;
52
+ }
53
+ /**
54
+ * Use this function to overload the renderList array at rendering time.
55
+ * Return null to render with the current renderList, else return the list of meshes to use for rendering.
56
+ * For 2DArray RTT, layerOrFace is the index of the layer that is going to be rendered, else it is the faceIndex of
57
+ * the cube (if the RTT is a cube, else layerOrFace=0).
58
+ * The renderList passed to the function is the current render list (the one that will be used if the function returns null).
59
+ * The length of this list is passed through renderListLength: don't use renderList.length directly because the array can
60
+ * hold dummy elements!
61
+ */
62
+ get getCustomRenderList() {
63
+ return this._objectRenderer.getCustomRenderList;
64
+ }
65
+ set getCustomRenderList(value) {
66
+ this._objectRenderer.getCustomRenderList = value;
67
+ }
68
+ /**
69
+ * Define if particles should be rendered in your texture (default: true).
70
+ */
71
+ get renderParticles() {
72
+ return this._objectRenderer.renderParticles;
73
+ }
74
+ set renderParticles(value) {
75
+ this._objectRenderer.renderParticles = value;
76
+ }
77
+ /**
78
+ * Define if sprites should be rendered in your texture (default: false).
79
+ */
80
+ get renderSprites() {
81
+ return this._objectRenderer.renderSprites;
82
+ }
83
+ set renderSprites(value) {
84
+ this._objectRenderer.renderSprites = value;
85
+ }
86
+ /**
87
+ * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined) (default: false).
88
+ */
89
+ get forceLayerMaskCheck() {
90
+ return this._objectRenderer.forceLayerMaskCheck;
91
+ }
92
+ set forceLayerMaskCheck(value) {
93
+ this._objectRenderer.forceLayerMaskCheck = value;
94
+ }
95
+ /**
96
+ * Define the camera used to render the texture.
97
+ */
98
+ get activeCamera() {
99
+ return this._objectRenderer.activeCamera;
100
+ }
101
+ set activeCamera(value) {
102
+ this._objectRenderer.activeCamera = value;
103
+ }
104
+ /**
105
+ * Override the mesh isReady function with your own one.
106
+ */
107
+ get customIsReadyFunction() {
108
+ return this._objectRenderer.customIsReadyFunction;
109
+ }
110
+ set customIsReadyFunction(value) {
111
+ this._objectRenderer.customIsReadyFunction = value;
112
+ }
113
+ /**
114
+ * Override the render function of the texture with your own one.
115
+ */
116
+ get customRenderFunction() {
117
+ return this._objectRenderer.customRenderFunction;
118
+ }
119
+ set customRenderFunction(value) {
120
+ this._objectRenderer.customRenderFunction = value;
43
121
  }
44
122
  /**
45
123
  * Post-processes for this render target
@@ -60,6 +138,12 @@ export class RenderTargetTexture extends Texture {
60
138
  }
61
139
  this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);
62
140
  }
141
+ /**
142
+ * An event triggered before rendering the texture
143
+ */
144
+ get onBeforeRenderObservable() {
145
+ return this._objectRenderer.onBeforeRenderObservable;
146
+ }
63
147
  /**
64
148
  * Set a before render callback in the texture.
65
149
  * This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.
@@ -70,6 +154,12 @@ export class RenderTargetTexture extends Texture {
70
154
  }
71
155
  this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);
72
156
  }
157
+ /**
158
+ * An event triggered after rendering the texture
159
+ */
160
+ get onAfterRenderObservable() {
161
+ return this._objectRenderer.onAfterRenderObservable;
162
+ }
73
163
  /**
74
164
  * Set a after render callback in the texture.
75
165
  * This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.
@@ -90,18 +180,32 @@ export class RenderTargetTexture extends Texture {
90
180
  }
91
181
  this._onClearObserver = this.onClearObservable.add(callback);
92
182
  }
183
+ /** @internal */
184
+ get _waitingRenderList() {
185
+ return this._objectRenderer._waitingRenderList;
186
+ }
187
+ /** @internal */
188
+ set _waitingRenderList(value) {
189
+ this._objectRenderer._waitingRenderList = value;
190
+ }
191
+ /**
192
+ * Current render pass id of the render target texture. Note it can change over the rendering as there's a separate id for each face of a cube / each layer of an array layer!
193
+ */
194
+ get renderPassId() {
195
+ return this._objectRenderer.renderPassId;
196
+ }
93
197
  /**
94
198
  * Gets the render pass ids used by the render target texture. For a single render target the array length will be 1, for a cube texture it will be 6 and for
95
199
  * a 2D texture array it will return an array of ids the size of the 2D texture array
96
200
  */
97
201
  get renderPassIds() {
98
- return this._renderPassIds;
202
+ return this._objectRenderer.renderPassIds;
99
203
  }
100
204
  /**
101
205
  * Gets the current value of the refreshId counter
102
206
  */
103
207
  get currentRefreshId() {
104
- return this._currentRefreshId;
208
+ return this._objectRenderer.currentRefreshId;
105
209
  }
106
210
  /**
107
211
  * Sets a specific material to be used to render a mesh/a list of meshes in this render target texture
@@ -109,18 +213,7 @@ export class RenderTargetTexture extends Texture {
109
213
  * @param material material or array of materials to use for this render pass. If undefined is passed, no specific material will be used but the regular material instead (mesh.material). It's possible to provide an array of materials to use a different material for each rendering in the case of a cube texture (6 rendering) and a 2D texture array (as many rendering as the length of the array)
110
214
  */
111
215
  setMaterialForRendering(mesh, material) {
112
- let meshes;
113
- if (!Array.isArray(mesh)) {
114
- meshes = [mesh];
115
- }
116
- else {
117
- meshes = mesh;
118
- }
119
- for (let j = 0; j < meshes.length; ++j) {
120
- for (let i = 0; i < this._renderPassIds.length; ++i) {
121
- meshes[j].setMaterialForRenderPass(this._renderPassIds[i], material !== undefined ? (Array.isArray(material) ? material[i] : material) : undefined);
122
- }
123
- }
216
+ this._objectRenderer.setMaterialForRendering(mesh, material);
124
217
  }
125
218
  /**
126
219
  * Define if the texture has multiple draw buffers or if false a single draw buffer.
@@ -196,32 +289,6 @@ export class RenderTargetTexture extends Texture {
196
289
  gammaSpace = options.gammaSpace ?? gammaSpace;
197
290
  }
198
291
  super(null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format);
199
- this._unObserveRenderList = null;
200
- this._renderListHasChanged = (_functionName, previousLength) => {
201
- const newLength = this._renderList ? this._renderList.length : 0;
202
- if ((previousLength === 0 && newLength > 0) || newLength === 0) {
203
- this.getScene()?.meshes.forEach((mesh) => {
204
- mesh._markSubMeshesAsLightDirty();
205
- });
206
- }
207
- };
208
- /**
209
- * Define the list of particle systems to render in the texture. If not provided, will render all the particle systems of the scene.
210
- * Note that the particle systems are rendered only if renderParticles is set to true.
211
- */
212
- this.particleSystemList = null;
213
- /**
214
- * Define if particles should be rendered in your texture.
215
- */
216
- this.renderParticles = true;
217
- /**
218
- * Define if sprites should be rendered in your texture.
219
- */
220
- this.renderSprites = false;
221
- /**
222
- * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined)
223
- */
224
- this.forceLayerMaskCheck = false;
225
292
  /**
226
293
  * Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.
227
294
  */
@@ -234,14 +301,6 @@ export class RenderTargetTexture extends Texture {
234
301
  * An event triggered when the texture is unbind.
235
302
  */
236
303
  this.onAfterUnbindObservable = new Observable();
237
- /**
238
- * An event triggered before rendering the texture
239
- */
240
- this.onBeforeRenderObservable = new Observable();
241
- /**
242
- * An event triggered after rendering the texture
243
- */
244
- this.onAfterRenderObservable = new Observable();
245
304
  /**
246
305
  * An event triggered after the texture clear
247
306
  */
@@ -256,8 +315,6 @@ export class RenderTargetTexture extends Texture {
256
315
  * Skip the initial clear of the rtt at the beginning of the frame render loop
257
316
  */
258
317
  this.skipInitialClear = false;
259
- this._currentRefreshId = -1;
260
- this._refreshRate = 1;
261
318
  this._samples = 1;
262
319
  this._canRescale = true;
263
320
  this._renderTarget = null;
@@ -274,20 +331,83 @@ export class RenderTargetTexture extends Texture {
274
331
  const engine = this.getScene().getEngine();
275
332
  this._gammaSpace = gammaSpace;
276
333
  this._coordinatesMode = Texture.PROJECTION_MODE;
277
- this.renderList = [];
278
334
  this.name = name;
279
335
  this.isRenderTarget = true;
280
336
  this._initialSizeParameter = size;
281
- this._renderPassIds = [];
282
- this._isCubeData = isCube;
283
337
  this._processSizeParameter(size);
284
- this.renderPassId = this._renderPassIds[0];
338
+ this._objectRenderer = new ObjectRenderer(name, scene, {
339
+ numPasses: isCube ? 6 : this.getRenderLayers() || 1,
340
+ doNotChangeAspectRatio,
341
+ });
342
+ this._objectRenderer.onBeforeRenderingManagerRenderObservable.add(() => {
343
+ // Before clear
344
+ for (const step of this._scene._beforeRenderTargetClearStage) {
345
+ step.action(this, this._currentFaceIndex, this._currentLayer);
346
+ }
347
+ // Clear
348
+ if (this.onClearObservable.hasObservers()) {
349
+ this.onClearObservable.notifyObservers(engine);
350
+ }
351
+ else if (!this.skipInitialClear) {
352
+ engine.clear(this.clearColor || this._scene.clearColor, true, true, true);
353
+ }
354
+ if (!this._doNotChangeAspectRatio) {
355
+ this._scene.updateTransformMatrix(true);
356
+ }
357
+ // Before Camera Draw
358
+ for (const step of this._scene._beforeRenderTargetDrawStage) {
359
+ step.action(this, this._currentFaceIndex, this._currentLayer);
360
+ }
361
+ });
362
+ this._objectRenderer.onAfterRenderingManagerRenderObservable.add(() => {
363
+ // After Camera Draw
364
+ for (const step of this._scene._afterRenderTargetDrawStage) {
365
+ step.action(this, this._currentFaceIndex, this._currentLayer);
366
+ }
367
+ const saveGenerateMipMaps = this._texture?.generateMipMaps ?? false;
368
+ if (this._texture) {
369
+ this._texture.generateMipMaps = false; // if left true, the mipmaps will be generated (if this._texture.generateMipMaps = true) when the first post process binds its own RTT: by doing so it will unbind the current RTT,
370
+ // which will trigger a mipmap generation. We don't want this because it's a wasted work, we will do an unbind of the current RTT at the end of the process (see unbindFrameBuffer) which will
371
+ // trigger the generation of the final mipmaps
372
+ }
373
+ if (this._postProcessManager) {
374
+ this._postProcessManager._finalizeFrame(false, this._renderTarget ?? undefined, this._currentFaceIndex, this._postProcesses, this.ignoreCameraViewport);
375
+ }
376
+ else if (this._currentUseCameraPostProcess) {
377
+ this._scene.postProcessManager._finalizeFrame(false, this._renderTarget ?? undefined, this._currentFaceIndex);
378
+ }
379
+ for (const step of this._scene._afterRenderTargetPostProcessStage) {
380
+ step.action(this, this._currentFaceIndex, this._currentLayer);
381
+ }
382
+ if (this._texture) {
383
+ this._texture.generateMipMaps = saveGenerateMipMaps;
384
+ }
385
+ if (!this._doNotChangeAspectRatio) {
386
+ this._scene.updateTransformMatrix(true);
387
+ }
388
+ // Dump ?
389
+ if (this._currentDumpForDebug) {
390
+ if (!this._dumpTools) {
391
+ Logger.Error("dumpTools module is still being loaded. To speed up the process import dump tools directly in your project");
392
+ }
393
+ else {
394
+ this._dumpTools.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);
395
+ }
396
+ }
397
+ });
398
+ this._objectRenderer.onFastPathRenderObservable.add(() => {
399
+ if (this.onClearObservable.hasObservers()) {
400
+ this.onClearObservable.notifyObservers(engine);
401
+ }
402
+ else {
403
+ if (!this.skipInitialClear) {
404
+ engine.clear(this.clearColor || this._scene.clearColor, true, true, true);
405
+ }
406
+ }
407
+ });
285
408
  this._resizeObserver = engine.onResizeObservable.add(() => { });
286
409
  this._generateMipMaps = generateMipMaps ? true : false;
287
410
  this._doNotChangeAspectRatio = doNotChangeAspectRatio;
288
- // Rendering groups
289
- this._renderingManager = new RenderingManager(scene);
290
- this._renderingManager._useSceneAutoClearSetup = true;
291
411
  if (isMulti) {
292
412
  return;
293
413
  }
@@ -337,24 +457,7 @@ export class RenderTargetTexture extends Texture {
337
457
  createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = 14, label) {
338
458
  this._renderTarget?.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);
339
459
  }
340
- _releaseRenderPassId() {
341
- if (this._scene) {
342
- const engine = this._scene.getEngine();
343
- for (let i = 0; i < this._renderPassIds.length; ++i) {
344
- engine.releaseRenderPassId(this._renderPassIds[i]);
345
- }
346
- }
347
- this._renderPassIds = [];
348
- }
349
- _createRenderPassId() {
350
- this._releaseRenderPassId();
351
- const engine = this._scene.getEngine(); // scene can't be null in a RenderTargetTexture, see constructor
352
- const numPasses = this._isCubeData ? 6 : this.getRenderLayers() || 1;
353
- for (let i = 0; i < numPasses; ++i) {
354
- this._renderPassIds[i] = engine.createRenderPassId(`RenderTargetTexture - ${this.name}#${i}`);
355
- }
356
- }
357
- _processSizeParameter(size, createRenderPassIds = true) {
460
+ _processSizeParameter(size) {
358
461
  if (size.ratio) {
359
462
  this._sizeRatio = size.ratio;
360
463
  const engine = this._getEngine();
@@ -366,9 +469,6 @@ export class RenderTargetTexture extends Texture {
366
469
  else {
367
470
  this._size = size;
368
471
  }
369
- if (createRenderPassIds) {
370
- this._createRenderPassId();
371
- }
372
472
  }
373
473
  /**
374
474
  * Define the number of samples to use in case of MSAA.
@@ -382,24 +482,6 @@ export class RenderTargetTexture extends Texture {
382
482
  this._samples = this._renderTarget.setSamples(value);
383
483
  }
384
484
  }
385
- /**
386
- * Resets the refresh counter of the texture and start bak from scratch.
387
- * Could be useful to regenerate the texture if it is setup to render only once.
388
- */
389
- resetRefreshCounter() {
390
- this._currentRefreshId = -1;
391
- }
392
- /**
393
- * Define the refresh rate of the texture or the rendering frequency.
394
- * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
395
- */
396
- get refreshRate() {
397
- return this._refreshRate;
398
- }
399
- set refreshRate(value) {
400
- this._refreshRate = value;
401
- this.resetRefreshCounter();
402
- }
403
485
  /**
404
486
  * Adds a post process to the render target rendering passes.
405
487
  * @param postProcess define the post process to add
@@ -448,19 +530,26 @@ export class RenderTargetTexture extends Texture {
448
530
  this._postProcesses[0].autoClear = false;
449
531
  }
450
532
  }
533
+ /**
534
+ * Resets the refresh counter of the texture and start bak from scratch.
535
+ * Could be useful to regenerate the texture if it is setup to render only once.
536
+ */
537
+ resetRefreshCounter() {
538
+ this._objectRenderer.resetRefreshCounter();
539
+ }
540
+ /**
541
+ * Define the refresh rate of the texture or the rendering frequency.
542
+ * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
543
+ */
544
+ get refreshRate() {
545
+ return this._objectRenderer.refreshRate;
546
+ }
547
+ set refreshRate(value) {
548
+ this._objectRenderer.refreshRate = value;
549
+ }
451
550
  /** @internal */
452
551
  _shouldRender() {
453
- if (this._currentRefreshId === -1) {
454
- // At least render once
455
- this._currentRefreshId = 1;
456
- return true;
457
- }
458
- if (this.refreshRate === this._currentRefreshId) {
459
- this._currentRefreshId = 1;
460
- return true;
461
- }
462
- this._currentRefreshId++;
463
- return false;
552
+ return this._objectRenderer.shouldRender();
464
553
  }
465
554
  /**
466
555
  * Gets the actual render size of the texture.
@@ -550,7 +639,7 @@ export class RenderTargetTexture extends Texture {
550
639
  if (!scene) {
551
640
  return;
552
641
  }
553
- this._processSizeParameter(size, false);
642
+ this._processSizeParameter(size);
554
643
  if (wasCube) {
555
644
  this._renderTarget = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);
556
645
  }
@@ -583,145 +672,44 @@ export class RenderTargetTexture extends Texture {
583
672
  // avoid a static import to allow ignoring the import in some cases
584
673
  import("../../Misc/dumpTools.js").then((module) => (this._dumpTools = module));
585
674
  }
586
- return this._render(false, false, true);
675
+ this._objectRenderer.prepareRenderList();
676
+ this.onBeforeBindObservable.notifyObservers(this);
677
+ this._objectRenderer.initRender(this.getRenderWidth(), this.getRenderHeight());
678
+ const isReady = this._objectRenderer._checkReadiness();
679
+ this.onAfterUnbindObservable.notifyObservers(this);
680
+ this._objectRenderer.finishRender();
681
+ return isReady;
587
682
  }
588
- _render(useCameraPostProcess = false, dumpForDebug = false, checkReadiness = false) {
683
+ _render(useCameraPostProcess = false, dumpForDebug = false) {
589
684
  const scene = this.getScene();
590
685
  if (!scene) {
591
- return checkReadiness;
686
+ return;
592
687
  }
593
- const engine = scene.getEngine();
594
688
  if (this.useCameraPostProcesses !== undefined) {
595
689
  useCameraPostProcess = this.useCameraPostProcesses;
596
690
  }
597
- if (this._waitingRenderList) {
598
- if (!this.renderListPredicate) {
599
- this.renderList = [];
600
- for (let index = 0; index < this._waitingRenderList.length; index++) {
601
- const id = this._waitingRenderList[index];
602
- const mesh = scene.getMeshById(id);
603
- if (mesh) {
604
- this.renderList.push(mesh);
605
- }
606
- }
607
- }
608
- this._waitingRenderList = undefined;
609
- }
610
- // Is predicate defined?
611
- if (this.renderListPredicate) {
612
- if (this.renderList) {
613
- this.renderList.length = 0; // Clear previous renderList
614
- }
615
- else {
616
- this.renderList = [];
617
- }
618
- const scene = this.getScene();
619
- if (!scene) {
620
- return checkReadiness;
621
- }
622
- const sceneMeshes = scene.meshes;
623
- for (let index = 0; index < sceneMeshes.length; index++) {
624
- const mesh = sceneMeshes[index];
625
- if (this.renderListPredicate(mesh)) {
626
- this.renderList.push(mesh);
627
- }
628
- }
629
- }
630
- const currentRenderPassId = engine.currentRenderPassId;
691
+ this._objectRenderer.prepareRenderList();
631
692
  this.onBeforeBindObservable.notifyObservers(this);
632
- // Set custom projection.
633
- // Needs to be before binding to prevent changing the aspect ratio.
634
- const camera = this.activeCamera ?? scene.activeCamera;
635
- const sceneCamera = scene.activeCamera;
636
- if (camera) {
637
- if (camera !== scene.activeCamera) {
638
- scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(true));
639
- scene.activeCamera = camera;
693
+ this._objectRenderer.initRender(this.getRenderWidth(), this.getRenderHeight());
694
+ if ((this.is2DArray || this.is3D) && !this.isMulti) {
695
+ for (let layer = 0; layer < this.getRenderLayers(); layer++) {
696
+ this._renderToTarget(0, useCameraPostProcess, dumpForDebug, layer);
697
+ scene.incrementRenderId();
698
+ scene.resetCachedMaterial();
640
699
  }
641
- engine.setViewport(camera.rigParent ? camera.rigParent.viewport : camera.viewport, this.getRenderWidth(), this.getRenderHeight());
642
700
  }
643
- this._defaultRenderListPrepared = false;
644
- let returnValue = checkReadiness;
645
- if (!checkReadiness) {
646
- if ((this.is2DArray || this.is3D) && !this.isMulti) {
647
- for (let layer = 0; layer < this.getRenderLayers(); layer++) {
648
- this._renderToTarget(0, useCameraPostProcess, dumpForDebug, layer, camera);
649
- scene.incrementRenderId();
650
- scene.resetCachedMaterial();
651
- }
652
- }
653
- else if (this.isCube && !this.isMulti) {
654
- for (let face = 0; face < 6; face++) {
655
- this._renderToTarget(face, useCameraPostProcess, dumpForDebug, undefined, camera);
656
- scene.incrementRenderId();
657
- scene.resetCachedMaterial();
658
- }
659
- }
660
- else {
661
- this._renderToTarget(0, useCameraPostProcess, dumpForDebug, undefined, camera);
701
+ else if (this.isCube && !this.isMulti) {
702
+ for (let face = 0; face < 6; face++) {
703
+ this._renderToTarget(face, useCameraPostProcess, dumpForDebug);
704
+ scene.incrementRenderId();
705
+ scene.resetCachedMaterial();
662
706
  }
663
707
  }
664
708
  else {
665
- if (!scene.getViewMatrix()) {
666
- // We probably didn't execute scene.render() yet, so make sure we have a view/projection matrix setup for the scene
667
- scene.updateTransformMatrix();
668
- }
669
- const numLayers = this.is2DArray || this.is3D ? this.getRenderLayers() : this.isCube ? 6 : 1;
670
- for (let layer = 0; layer < numLayers && returnValue; layer++) {
671
- let currentRenderList = null;
672
- const defaultRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;
673
- const defaultRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;
674
- engine.currentRenderPassId = this._renderPassIds[layer];
675
- this.onBeforeRenderObservable.notifyObservers(layer);
676
- if (this.getCustomRenderList) {
677
- currentRenderList = this.getCustomRenderList(layer, defaultRenderList, defaultRenderListLength);
678
- }
679
- if (!currentRenderList) {
680
- currentRenderList = defaultRenderList;
681
- }
682
- if (!this._doNotChangeAspectRatio) {
683
- scene.updateTransformMatrix(true);
684
- }
685
- for (let i = 0; i < currentRenderList.length && returnValue; ++i) {
686
- const mesh = currentRenderList[i];
687
- if (!mesh.isEnabled() || mesh.isBlocked || !mesh.isVisible || !mesh.subMeshes) {
688
- continue;
689
- }
690
- if (this.customIsReadyFunction) {
691
- if (!this.customIsReadyFunction(mesh, this.refreshRate, checkReadiness)) {
692
- returnValue = false;
693
- continue;
694
- }
695
- }
696
- else if (!mesh.isReady(true)) {
697
- returnValue = false;
698
- continue;
699
- }
700
- }
701
- this.onAfterRenderObservable.notifyObservers(layer);
702
- if (this.is2DArray || this.is3D || this.isCube) {
703
- scene.incrementRenderId();
704
- scene.resetCachedMaterial();
705
- }
706
- }
707
- const particleSystems = this.particleSystemList || scene.particleSystems;
708
- for (const particleSystem of particleSystems) {
709
- if (!particleSystem.isReady()) {
710
- returnValue = false;
711
- }
712
- }
709
+ this._renderToTarget(0, useCameraPostProcess, dumpForDebug);
713
710
  }
714
711
  this.onAfterUnbindObservable.notifyObservers(this);
715
- engine.currentRenderPassId = currentRenderPassId;
716
- scene.activeCamera = sceneCamera;
717
- if (sceneCamera) {
718
- if (this.activeCamera && this.activeCamera !== scene.activeCamera) {
719
- scene.setTransformMatrix(sceneCamera.getViewMatrix(), sceneCamera.getProjectionMatrix(true));
720
- }
721
- engine.setViewport(sceneCamera.viewport);
722
- }
723
- scene.resetCachedMaterial();
724
- return returnValue;
712
+ this._objectRenderer.finishRender();
725
713
  }
726
714
  _bestReflectionRenderTargetDimension(renderDimension, scale) {
727
715
  const minimum = 128;
@@ -730,79 +718,6 @@ export class RenderTargetTexture extends Texture {
730
718
  // Ensure we don't exceed the render dimension (while staying POT)
731
719
  return Math.min(FloorPOT(renderDimension), curved);
732
720
  }
733
- _prepareRenderingManager(currentRenderList, currentRenderListLength, camera, checkLayerMask) {
734
- const scene = this.getScene();
735
- if (!scene) {
736
- return;
737
- }
738
- this._renderingManager.reset();
739
- const sceneRenderId = scene.getRenderId();
740
- for (let meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {
741
- const mesh = currentRenderList[meshIndex];
742
- if (mesh && !mesh.isBlocked) {
743
- if (this.customIsReadyFunction) {
744
- if (!this.customIsReadyFunction(mesh, this.refreshRate, false)) {
745
- this.resetRefreshCounter();
746
- continue;
747
- }
748
- }
749
- else if (!mesh.isReady(this.refreshRate === 0)) {
750
- this.resetRefreshCounter();
751
- continue;
752
- }
753
- if (!mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate && camera) {
754
- mesh._internalAbstractMeshDataInfo._currentLOD = scene.customLODSelector ? scene.customLODSelector(mesh, camera) : mesh.getLOD(camera);
755
- mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;
756
- }
757
- if (!mesh._internalAbstractMeshDataInfo._currentLOD) {
758
- continue;
759
- }
760
- let meshToRender = mesh._internalAbstractMeshDataInfo._currentLOD;
761
- if (meshToRender !== mesh && meshToRender.billboardMode !== 0) {
762
- meshToRender.computeWorldMatrix(); // Compute world matrix if LOD is billboard
763
- }
764
- meshToRender._preActivateForIntermediateRendering(sceneRenderId);
765
- let isMasked;
766
- if (checkLayerMask && camera) {
767
- isMasked = (mesh.layerMask & camera.layerMask) === 0;
768
- }
769
- else {
770
- isMasked = false;
771
- }
772
- if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {
773
- if (meshToRender !== mesh) {
774
- meshToRender._activate(sceneRenderId, true);
775
- }
776
- if (mesh._activate(sceneRenderId, true) && mesh.subMeshes.length) {
777
- if (!mesh.isAnInstance) {
778
- meshToRender._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;
779
- }
780
- else {
781
- if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {
782
- meshToRender = mesh;
783
- }
784
- }
785
- meshToRender._internalAbstractMeshDataInfo._isActiveIntermediate = true;
786
- scene._prepareSkeleton(meshToRender);
787
- for (let subIndex = 0; subIndex < meshToRender.subMeshes.length; subIndex++) {
788
- const subMesh = meshToRender.subMeshes[subIndex];
789
- this._renderingManager.dispatch(subMesh, meshToRender);
790
- }
791
- }
792
- mesh._postActivate();
793
- }
794
- }
795
- }
796
- const particleSystems = this.particleSystemList || scene.particleSystems;
797
- for (let particleIndex = 0; particleIndex < particleSystems.length; particleIndex++) {
798
- const particleSystem = particleSystems[particleIndex];
799
- const emitter = particleSystem.emitter;
800
- if (!particleSystem.isStarted() || !emitter || (emitter.position && !emitter.isEnabled())) {
801
- continue;
802
- }
803
- this._renderingManager.dispatchParticles(particleSystem);
804
- }
805
- }
806
721
  /**
807
722
  * @internal
808
723
  * @param faceIndex face index to bind to if this is a cubetexture
@@ -839,113 +754,20 @@ export class RenderTargetTexture extends Texture {
839
754
  this._bindFrameBuffer(faceIndex, layer);
840
755
  }
841
756
  }
842
- _renderToTarget(faceIndex, useCameraPostProcess, dumpForDebug, layer = 0, camera = null) {
757
+ _renderToTarget(faceIndex, useCameraPostProcess, dumpForDebug, layer = 0) {
843
758
  const scene = this.getScene();
844
759
  if (!scene) {
845
760
  return;
846
761
  }
847
762
  const engine = scene.getEngine();
848
- // Bind
763
+ this._currentFaceIndex = faceIndex;
764
+ this._currentLayer = layer;
765
+ this._currentUseCameraPostProcess = useCameraPostProcess;
766
+ this._currentDumpForDebug = dumpForDebug;
849
767
  this._prepareFrame(scene, faceIndex, layer, useCameraPostProcess);
850
768
  engine._debugPushGroup?.(`render to face #${faceIndex} layer #${layer}`, 2);
851
- if (this.is2DArray || this.is3D) {
852
- engine.currentRenderPassId = this._renderPassIds[layer];
853
- this.onBeforeRenderObservable.notifyObservers(layer);
854
- }
855
- else {
856
- engine.currentRenderPassId = this._renderPassIds[faceIndex];
857
- this.onBeforeRenderObservable.notifyObservers(faceIndex);
858
- }
859
- const fastPath = engine.snapshotRendering && engine.snapshotRenderingMode === 1;
860
- if (!fastPath) {
861
- // Get the list of meshes to render
862
- let currentRenderList = null;
863
- const defaultRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;
864
- const defaultRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;
865
- if (this.getCustomRenderList) {
866
- currentRenderList = this.getCustomRenderList(this.is2DArray || this.is3D ? layer : faceIndex, defaultRenderList, defaultRenderListLength);
867
- }
868
- if (!currentRenderList) {
869
- // No custom render list provided, we prepare the rendering for the default list, but check
870
- // first if we did not already performed the preparation before so as to avoid re-doing it several times
871
- if (!this._defaultRenderListPrepared) {
872
- this._prepareRenderingManager(defaultRenderList, defaultRenderListLength, camera, !this.renderList || this.forceLayerMaskCheck);
873
- this._defaultRenderListPrepared = true;
874
- }
875
- currentRenderList = defaultRenderList;
876
- }
877
- else {
878
- // Prepare the rendering for the custom render list provided
879
- this._prepareRenderingManager(currentRenderList, currentRenderList.length, camera, this.forceLayerMaskCheck);
880
- }
881
- // Before clear
882
- for (const step of scene._beforeRenderTargetClearStage) {
883
- step.action(this, faceIndex, layer);
884
- }
885
- // Clear
886
- if (this.onClearObservable.hasObservers()) {
887
- this.onClearObservable.notifyObservers(engine);
888
- }
889
- else if (!this.skipInitialClear) {
890
- engine.clear(this.clearColor || scene.clearColor, true, true, true);
891
- }
892
- if (!this._doNotChangeAspectRatio) {
893
- scene.updateTransformMatrix(true);
894
- }
895
- // Before Camera Draw
896
- for (const step of scene._beforeRenderTargetDrawStage) {
897
- step.action(this, faceIndex, layer);
898
- }
899
- // Render
900
- this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);
901
- // After Camera Draw
902
- for (const step of scene._afterRenderTargetDrawStage) {
903
- step.action(this, faceIndex, layer);
904
- }
905
- const saveGenerateMipMaps = this._texture?.generateMipMaps ?? false;
906
- if (this._texture) {
907
- this._texture.generateMipMaps = false; // if left true, the mipmaps will be generated (if this._texture.generateMipMaps = true) when the first post process binds its own RTT: by doing so it will unbind the current RTT,
908
- // which will trigger a mipmap generation. We don't want this because it's a wasted work, we will do an unbind of the current RTT at the end of the process (see unbindFrameBuffer) which will
909
- // trigger the generation of the final mipmaps
910
- }
911
- if (this._postProcessManager) {
912
- this._postProcessManager._finalizeFrame(false, this._renderTarget ?? undefined, faceIndex, this._postProcesses, this.ignoreCameraViewport);
913
- }
914
- else if (useCameraPostProcess) {
915
- scene.postProcessManager._finalizeFrame(false, this._renderTarget ?? undefined, faceIndex);
916
- }
917
- for (const step of scene._afterRenderTargetPostProcessStage) {
918
- step.action(this, faceIndex, layer);
919
- }
920
- if (this._texture) {
921
- this._texture.generateMipMaps = saveGenerateMipMaps;
922
- }
923
- if (!this._doNotChangeAspectRatio) {
924
- scene.updateTransformMatrix(true);
925
- }
926
- // Dump ?
927
- if (dumpForDebug) {
928
- if (!this._dumpTools) {
929
- Logger.Error("dumpTools module is still being loaded. To speed up the process import dump tools directly in your project");
930
- }
931
- else {
932
- this._dumpTools.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);
933
- }
934
- }
935
- }
936
- else {
937
- // Clear
938
- if (this.onClearObservable.hasObservers()) {
939
- this.onClearObservable.notifyObservers(engine);
940
- }
941
- else {
942
- if (!this.skipInitialClear) {
943
- engine.clear(this.clearColor || scene.clearColor, true, true, true);
944
- }
945
- }
946
- }
769
+ this._objectRenderer.render(faceIndex + layer, true); // only faceIndex or layer (if any) will be different from 0 (we don't support array of cubes), so it's safe to add them to get the pass index
947
770
  engine._debugPopGroup?.(2);
948
- // Unbind
949
771
  this._unbindFrameBuffer(engine, faceIndex);
950
772
  if (this._texture && this.isCube && faceIndex === 5) {
951
773
  engine.generateMipMapsForCubemap(this._texture, true);
@@ -961,7 +783,7 @@ export class RenderTargetTexture extends Texture {
961
783
  * @param transparentSortCompareFn The transparent queue comparison function use to sort.
962
784
  */
963
785
  setRenderingOrder(renderingGroupId, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {
964
- this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);
786
+ this._objectRenderer.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);
965
787
  }
966
788
  /**
967
789
  * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
@@ -970,8 +792,7 @@ export class RenderTargetTexture extends Texture {
970
792
  * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
971
793
  */
972
794
  setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil) {
973
- this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);
974
- this._renderingManager._useSceneAutoClearSetup = false;
795
+ this._objectRenderer.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);
975
796
  }
976
797
  /**
977
798
  * Clones the texture.
@@ -1027,10 +848,8 @@ export class RenderTargetTexture extends Texture {
1027
848
  dispose() {
1028
849
  this.onResizeObservable.clear();
1029
850
  this.onClearObservable.clear();
1030
- this.onAfterRenderObservable.clear();
1031
851
  this.onAfterUnbindObservable.clear();
1032
852
  this.onBeforeBindObservable.clear();
1033
- this.onBeforeRenderObservable.clear();
1034
853
  if (this._postProcessManager) {
1035
854
  this._postProcessManager.dispose();
1036
855
  this._postProcessManager = null;
@@ -1038,13 +857,12 @@ export class RenderTargetTexture extends Texture {
1038
857
  if (this._prePassRenderTarget) {
1039
858
  this._prePassRenderTarget.dispose();
1040
859
  }
1041
- this._releaseRenderPassId();
860
+ this._objectRenderer.dispose();
1042
861
  this.clearPostProcesses(true);
1043
862
  if (this._resizeObserver) {
1044
863
  this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver);
1045
864
  this._resizeObserver = null;
1046
865
  }
1047
- this.renderList = null;
1048
866
  // Remove from custom render targets
1049
867
  const scene = this.getScene();
1050
868
  if (!scene) {
@@ -1067,9 +885,7 @@ export class RenderTargetTexture extends Texture {
1067
885
  }
1068
886
  /** @internal */
1069
887
  _rebuild() {
1070
- if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {
1071
- this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;
1072
- }
888
+ this._objectRenderer._rebuild();
1073
889
  if (this._postProcessManager) {
1074
890
  this._postProcessManager._rebuild();
1075
891
  }
@@ -1078,9 +894,7 @@ export class RenderTargetTexture extends Texture {
1078
894
  * Clear the info related to rendering groups preventing retention point in material dispose.
1079
895
  */
1080
896
  freeRenderingGroups() {
1081
- if (this._renderingManager) {
1082
- this._renderingManager.freeRenderingGroups();
1083
- }
897
+ this._objectRenderer.freeRenderingGroups();
1084
898
  }
1085
899
  /**
1086
900
  * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)
@@ -1093,16 +907,16 @@ export class RenderTargetTexture extends Texture {
1093
907
  /**
1094
908
  * The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.
1095
909
  */
1096
- RenderTargetTexture.REFRESHRATE_RENDER_ONCE = 0;
910
+ RenderTargetTexture.REFRESHRATE_RENDER_ONCE = ObjectRenderer.REFRESHRATE_RENDER_ONCE;
1097
911
  /**
1098
- * The texture will only be rendered rendered every frame and is recommended for dynamic contents.
912
+ * The texture will be rendered every frame and is recommended for dynamic contents.
1099
913
  */
1100
- RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = 1;
914
+ RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = ObjectRenderer.REFRESHRATE_RENDER_ONEVERYFRAME;
1101
915
  /**
1102
916
  * The texture will be rendered every 2 frames which could be enough if your dynamic objects are not
1103
917
  * the central point of your effect and can save a lot of performances.
1104
918
  */
1105
- RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;
919
+ RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = ObjectRenderer.REFRESHRATE_RENDER_ONEVERYTWOFRAMES;
1106
920
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1107
921
  Texture._CreateRenderTargetTexture = (name, renderTargetSize, scene, generateMipMaps, creationFlags) => {
1108
922
  return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);