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

Method setRenderer

src/core/EffectComposer.js:221–252  ·  view source on GitHub ↗

* Sets the renderer. * * @param {WebGLRenderer} renderer - The renderer.

(renderer)

Source from the content-addressed store, hash-verified

219 */
220
221 setRenderer(renderer) {
222
223 this.renderer = renderer;
224
225 if(renderer !== null) {
226
227 const size = renderer.getSize(new Vector2());
228 const alpha = renderer.getContext().getContextAttributes().alpha;
229 const frameBufferType = this.inputBuffer.texture.type;
230
231 if(frameBufferType === UnsignedByteType && renderer.outputColorSpace === SRGBColorSpace) {
232
233 this.inputBuffer.texture.colorSpace = SRGBColorSpace;
234 this.outputBuffer.texture.colorSpace = SRGBColorSpace;
235
236 this.inputBuffer.dispose();
237 this.outputBuffer.dispose();
238
239 }
240
241 renderer.autoClear = false;
242 this.setSize(size.width, size.height);
243
244 for(const pass of this.passes) {
245
246 pass.initialize(renderer, alpha, frameBufferType);
247
248 }
249
250 }
251
252 }
253
254 /**
255 * Replaces the current renderer with the given one.

Callers 2

constructorMethod · 0.95
replaceRendererMethod · 0.95

Calls 3

setSizeMethod · 0.95
disposeMethod · 0.65
initializeMethod · 0.65

Tested by

no test coverage detected