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

Method constructor

src/passes/DepthPass.js:26–83  ·  view source on GitHub ↗

* Constructs a new depth 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} [opt

(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("DepthPass");
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 MeshDepthMaterial({
47 depthPacking: RGBADepthPacking
48 }));
49
50 const renderPass = this.renderPass;
51 renderPass.skipShadowMapUpdate = true;
52 renderPass.ignoreBackground = true;
53
54 /**
55 * A render target that contains the scene depth.
56 *
57 * @type {WebGLRenderTarget}
58 * @readonly
59 */
60
61 this.renderTarget = renderTarget;
62
63 if(this.renderTarget === undefined) {
64
65 this.renderTarget = new WebGLRenderTarget(1, 1, {
66 minFilter: NearestFilter,
67 magFilter: NearestFilter
68 });
69
70 this.renderTarget.texture.name = "DepthPass.Target";
71
72 }
73
74 /**
75 * The resolution.
76 *
77 * @type {Resolution}
78 */
79
80 const resolution = this.resolution = new Resolution(this, resolutionX, resolutionY, resolutionScale);
81 resolution.addEventListener("change", (e) => this.setSize(resolution.baseWidth, resolution.baseHeight));
82
83 }

Callers

nothing calls this directly

Calls 1

setSizeMethod · 0.95

Tested by

no test coverage detected