MCPcopy Create free account
hub / github.com/pmndrs/postprocessing / setSize

Method setSize

src/core/EffectComposer.js:725–761  ·  view source on GitHub ↗

* Sets the size of the buffers, passes and the renderer. * * @param {Number} width - The width. * @param {Number} height - The height. * @param {Boolean} [updateStyle] - Determines whether the style of the canvas should be updated.

(width, height, updateStyle)

Source from the content-addressed store, hash-verified

723 */
724
725 setSize(width, height, updateStyle) {
726
727 const renderer = this.renderer;
728 const currentSize = renderer.getSize(new Vector2());
729
730 if(width === undefined || height === undefined) {
731
732 width = currentSize.width;
733 height = currentSize.height;
734
735 }
736
737 if(currentSize.width !== width || currentSize.height !== height) {
738
739 // Update the logical render size.
740 renderer.setSize(width, height, updateStyle);
741
742 }
743
744 // The drawing buffer size takes the device pixel ratio into account.
745 const drawingBufferSize = renderer.getDrawingBufferSize(new Vector2());
746 this.inputBuffer.setSize(drawingBufferSize.width, drawingBufferSize.height);
747 this.outputBuffer.setSize(drawingBufferSize.width, drawingBufferSize.height);
748
749 if(this.depthRenderTarget !== null) {
750
751 this.depthRenderTarget.setSize(drawingBufferSize.width, drawingBufferSize.height);
752
753 }
754
755 for(const pass of this.passes) {
756
757 pass.setSize(drawingBufferSize.width, drawingBufferSize.height);
758
759 }
760
761 }
762
763 /**
764 * Resets this composer by deleting all passes and creating new buffers.

Callers 1

setRendererMethod · 0.95

Calls 1

setSizeMethod · 0.65

Tested by

no test coverage detected