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

Method constructor

src/passes/NormalPass.js:26–86  ·  view source on GitHub ↗

* Constructs a new normal pass. * * @param {Scene} scene - The scene to render. * @param {Camera} camera - The camera to use to render the scene. * @param {Object} [options] - The options. * @param {WebGLRenderTarget} [options.renderTarget] - A custom render target. * @param {Number} [op

(scene, camera, {
		renderTarget,
		resolutionScale = 1.0,
		width = Resolution.AUTO_SIZE,
		height = Resolution.AUTO_SIZE,
		resolutionX = width,
		resolutionY = height
	} = {})

Source from the content-addressed store, hash-verified

24 */
25
26 constructor(scene, camera, {
27 renderTarget,
28 resolutionScale = 1.0,
29 width = Resolution.AUTO_SIZE,
30 height = Resolution.AUTO_SIZE,
31 resolutionX = width,
32 resolutionY = height
33 } = {}) {
34
35 super("NormalPass");
36
37 this.needsSwap = false;
38
39 /**
40 * A render pass.
41 *
42 * @type {RenderPass}
43 * @private
44 */
45
46 this.renderPass = new RenderPass(scene, camera, new MeshNormalMaterial());
47
48 const renderPass = this.renderPass;
49 renderPass.ignoreBackground = true;
50 renderPass.skipShadowMapUpdate = true;
51
52 const clearPass = renderPass.getClearPass();
53 clearPass.overrideClearColor = new Color(0x7777ff);
54 clearPass.overrideClearAlpha = 1.0;
55
56 /**
57 * A render target for the scene normals.
58 *
59 * @type {WebGLRenderTarget}
60 * @readonly
61 */
62
63 this.renderTarget = renderTarget;
64
65 if(this.renderTarget === undefined) {
66
67 this.renderTarget = new WebGLRenderTarget(1, 1, {
68 minFilter: NearestFilter,
69 magFilter: NearestFilter
70 });
71
72 this.renderTarget.texture.name = "NormalPass.Target";
73
74 }
75
76 /**
77 * The resolution.
78 *
79 * @type {Resolution}
80 * @readonly
81 */
82
83 const resolution = this.resolution = new Resolution(this, resolutionX, resolutionY, resolutionScale);

Callers

nothing calls this directly

Calls 2

setSizeMethod · 0.95
getClearPassMethod · 0.45

Tested by

no test coverage detected