@forbespro/lead-agent
Version:
Lead Chat Agent React Component
56 lines (55 loc) • 2.62 kB
JavaScript
import { Pass as r } from "./index52.js";
class o extends r {
/**
* Constructs a new mask pass.
*
* @param {Scene} scene - The 3D objects in this scene will define the mask.
* @param {Camera} camera - The camera.
*/
constructor(s, f) {
super(), this.scene = s, this.camera = f, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
}
/**
* Performs a mask 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(s, f, u) {
const t = s.getContext(), e = s.state;
e.buffers.color.setMask(!1), e.buffers.depth.setMask(!1), e.buffers.color.setLocked(!0), e.buffers.depth.setLocked(!0);
let c, a;
this.inverse ? (c = 0, a = 1) : (c = 1, a = 0), e.buffers.stencil.setTest(!0), e.buffers.stencil.setOp(t.REPLACE, t.REPLACE, t.REPLACE), e.buffers.stencil.setFunc(t.ALWAYS, c, 4294967295), e.buffers.stencil.setClear(a), e.buffers.stencil.setLocked(!0), s.setRenderTarget(u), this.clear && s.clear(), s.render(this.scene, this.camera), s.setRenderTarget(f), this.clear && s.clear(), s.render(this.scene, this.camera), e.buffers.color.setLocked(!1), e.buffers.depth.setLocked(!1), e.buffers.color.setMask(!0), e.buffers.depth.setMask(!0), e.buffers.stencil.setLocked(!1), e.buffers.stencil.setFunc(t.EQUAL, 1, 4294967295), e.buffers.stencil.setOp(t.KEEP, t.KEEP, t.KEEP), e.buffers.stencil.setLocked(!0);
}
}
class n extends r {
/**
* Constructs a new clear mask pass.
*/
constructor() {
super(), this.needsSwap = !1;
}
/**
* Performs the clear of the currently defined mask.
*
* @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(s) {
s.state.buffers.stencil.setLocked(!1), s.state.buffers.stencil.setTest(!1);
}
}
export {
n as ClearMaskPass,
o as MaskPass
};