UNPKG

@forbespro/lead-agent

Version:
38 lines (37 loc) 2.22 kB
import { Color as s } from "three"; import { Pass as r } from "./index52.js"; class u extends r { /** * Constructs a new render pass. * * @param {Scene} scene - The scene to render. * @param {Camera} camera - The camera. * @param {?Material} [overrideMaterial=null] - The override material. If set, this material is used * for all objects in the scene. * @param {?(number|Color|string)} [clearColor=null] - The clear color of the render pass. * @param {?number} [clearAlpha=null] - The clear alpha of the render pass. */ constructor(l, i, t = null, e = null, a = null) { super(), this.scene = l, this.camera = i, this.overrideMaterial = t, this.clearColor = e, this.clearAlpha = a, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this._oldClearColor = new s(); } /** * Performs a beauty pass with the configured scene and camera. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering * destination for the pass. * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the * previous pass from this buffer. * @param {number} deltaTime - The delta time in seconds. * @param {boolean} maskActive - Whether masking is active or not. */ render(l, i, t) { const e = l.autoClear; l.autoClear = !1; let a, o; this.overrideMaterial !== null && (o = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (l.getClearColor(this._oldClearColor), l.setClearColor(this.clearColor, l.getClearAlpha())), this.clearAlpha !== null && (a = l.getClearAlpha(), l.setClearAlpha(this.clearAlpha)), this.clearDepth == !0 && l.clearDepth(), l.setRenderTarget(this.renderToScreen ? null : t), this.clear === !0 && l.clear(l.autoClearColor, l.autoClearDepth, l.autoClearStencil), l.render(this.scene, this.camera), this.clearColor !== null && l.setClearColor(this._oldClearColor), this.clearAlpha !== null && l.setClearAlpha(a), this.overrideMaterial !== null && (this.scene.overrideMaterial = o), l.autoClear = e; } } export { u as RenderPass };