UNPKG

threepipe

Version:

A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.

32 lines 1.39 kB
import { ShaderMaterial } from 'three'; import { HorizontalBlurShader } from 'three/examples/jsm/shaders/HorizontalBlurShader.js'; import { VerticalBlurShader } from 'three/examples/jsm/shaders/VerticalBlurShader.js'; export class HVBlurHelper { constructor(_viewer) { this._viewer = _viewer; this.horizontalBlurMaterial = new ShaderMaterial(HorizontalBlurShader); this.verticalBlurMaterial = new ShaderMaterial(VerticalBlurShader); this.horizontalBlurMaterial.depthTest = false; this.verticalBlurMaterial.depthTest = false; } blur(source, dest, tempTarget, amountMultiplier = 1) { this.horizontalBlurMaterial.uniforms.h.value = amountMultiplier; this.verticalBlurMaterial.uniforms.v.value = amountMultiplier; this._viewer.renderManager.blit(tempTarget, { material: this.horizontalBlurMaterial, clear: true, source: source, // this._depthPass.target.texture, }); // this._viewer.renderManager.blit(this._depthPass.target, { this._viewer.renderManager.blit(dest, { material: this.verticalBlurMaterial, clear: true, source: tempTarget.texture, }); } dispose() { this.horizontalBlurMaterial.dispose(); this.verticalBlurMaterial.dispose(); } } //# sourceMappingURL=HVBlurHelper.js.map