You can now specify an autoResize boolean in the RenderTargetConfig which is passed to the Render Targets when they are created by a pipeline.

This commit is contained in:
Richard Davey 2024-01-31 19:15:21 +00:00
parent c6f5638e45
commit 92065facf0
2 changed files with 4 additions and 2 deletions

View file

@ -501,16 +501,17 @@ var WebGLPipeline = new Class({
var scale = GetFastValue(targets[i], 'scale', 1); var scale = GetFastValue(targets[i], 'scale', 1);
var minFilter = GetFastValue(targets[i], 'minFilter', 0); var minFilter = GetFastValue(targets[i], 'minFilter', 0);
var autoClear = GetFastValue(targets[i], 'autoClear', 1); var autoClear = GetFastValue(targets[i], 'autoClear', 1);
var autoResize = GetFastValue(targets[i], 'autoResize', false);
var targetWidth = GetFastValue(targets[i], 'width', null); var targetWidth = GetFastValue(targets[i], 'width', null);
var targetHeight = GetFastValue(targets[i], 'height', targetWidth); var targetHeight = GetFastValue(targets[i], 'height', targetWidth);
if (targetWidth) if (targetWidth)
{ {
renderTargets.push(new RenderTarget(renderer, targetWidth, targetHeight, 1, minFilter, autoClear)); renderTargets.push(new RenderTarget(renderer, targetWidth, targetHeight, 1, minFilter, autoClear, autoResize));
} }
else else
{ {
renderTargets.push(new RenderTarget(renderer, width, height, scale, minFilter, autoClear)); renderTargets.push(new RenderTarget(renderer, width, height, scale, minFilter, autoClear, autoResize));
} }
} }
} }

View file

@ -5,6 +5,7 @@
* @property {number} [scale=1] - A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc. * @property {number} [scale=1] - A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc.
* @property {number} [minFilter=0] - The minFilter mode of the texture. 0 is `LINEAR`, 1 is `NEAREST`. * @property {number} [minFilter=0] - The minFilter mode of the texture. 0 is `LINEAR`, 1 is `NEAREST`.
* @property {boolean} [autoClear=true] - Controls if this Render Target is automatically cleared (via `gl.COLOR_BUFFER_BIT`) during the bind. * @property {boolean} [autoClear=true] - Controls if this Render Target is automatically cleared (via `gl.COLOR_BUFFER_BIT`) during the bind.
* @property {boolean} [autoResize=false] - Controls if this Render Target is automatically resized when the Renderer resizes.
* @property {number} [width] - The width of the Render Target. This is optional. If given it overrides the `scale` property. * @property {number} [width] - The width of the Render Target. This is optional. If given it overrides the `scale` property.
* @property {number} [height=width] - The height of the Render Target. This is optional. If not given, it will be set to the same as the `width` value. * @property {number} [height=width] - The height of the Render Target. This is optional. If not given, it will be set to the same as the `width` value.
*/ */