Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
].value = this.m_renderTargetsVertical[2].texture;
this.m_compositeMaterial.uniforms[
"blurTexture4"
].value = this.m_renderTargetsVertical[3].texture;
this.m_compositeMaterial.uniforms[
"blurTexture5"
].value = this.m_renderTargetsVertical[4].texture;
this.m_compositeMaterial.uniforms["bloomStrength"].value = strength;
this.m_compositeMaterial.uniforms["bloomRadius"].value = 0.1;
this.m_compositeMaterial.needsUpdate = true;
const bloomFactors = [1.0, 0.8, 0.6, 0.4, 0.2];
this.m_compositeMaterial.uniforms["bloomFactors"].value = bloomFactors;
this.m_compositeMaterial.uniforms["bloomTintColors"].value = this.m_bloomTintColors;
this.m_copyUniforms = THREE.UniformsUtils.clone(CopyShader.uniforms);
this.m_copyUniforms["opacity"].value = 1.0;
// tslint:enable:no-string-literal
this.m_materialCopy = new THREE.ShaderMaterial({
uniforms: this.m_copyUniforms,
vertexShader: CopyShader.vertexShader,
fragmentShader: CopyShader.fragmentShader,
blending: THREE.AdditiveBlending,
depthTest: false,
depthWrite: false,
transparent: true
});
}
dispose() {
* @default `SamplingLevel.Level_1`
*/
samplingLevel: MSAASampling = MSAASampling.Level_1;
private m_renderTarget: THREE.WebGLRenderTarget | null = null;
private readonly m_localCamera: THREE.OrthographicCamera = new THREE.OrthographicCamera(
-1,
1,
1,
-1,
0,
1
);
private readonly m_quadScene: THREE.Scene = new THREE.Scene();
private readonly m_quadUniforms: { [uniformName: string]: THREE.IUniform } =
CopyShader.uniforms;
private readonly m_quadMaterial: THREE.ShaderMaterial = new MSAAMaterial(this.m_quadUniforms);
private readonly m_quad: THREE.Mesh = new THREE.Mesh(
new THREE.PlaneBufferGeometry(2, 2),
this.m_quadMaterial
);
/**
* The constructor for `MSAARenderPass`. It builds an internal scene with a camera looking at a
* quad.
*
* @param m_scene The scene to render.
* @param m_camera The camera to render the scene through.
*/
constructor() {
super();
this.m_quad.frustumCulled = false;
* @note Since no anti-aliasing is applied during dynamic rendering, visual artifacts may be
* visible.
*/
export class LowResRenderPass extends Pass {
private m_renderTarget: THREE.WebGLRenderTarget | null = null;
private readonly m_localCamera: THREE.OrthographicCamera = new THREE.OrthographicCamera(
-1,
1,
1,
-1,
0,
1
);
private readonly m_quadScene: THREE.Scene = new THREE.Scene();
private readonly m_quadUniforms: { [uniformName: string]: THREE.IUniform } =
CopyShader.uniforms;
private readonly m_quadMaterial: THREE.ShaderMaterial = new CopyMaterial(this.m_quadUniforms);
private readonly m_quad: THREE.Mesh = new THREE.Mesh(
new THREE.PlaneBufferGeometry(2, 2),
this.m_quadMaterial
);
private m_pixelRatio: number | undefined;
private m_savedWidth = 0;
private m_savedHeight = 0;
/**
* The constructor for `LowResRenderPass`. It builds an internal scene with a camera looking at
* a quad.
*
* @param lowResPixelRatio The `pixelRatio` determines the resolution of the internal
* `WebGLRenderTarget`. Values between 0.5 and `window.devicePixelRatio` can be tried to give
* good results. A value of `undefined` disables the low res render pass. The value should not