From 0e8e04305a1d9c47997e6e85773dc6c8be3dc79a Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 30 Mar 2021 22:16:07 +0100 Subject: [PATCH] EffectComposer: Clean up. --- examples/js/postprocessing/EffectComposer.js | 9 +++++---- examples/jsm/postprocessing/EffectComposer.js | 13 +++++++------ examples/jsm/postprocessing/Pass.js | 13 +++++++------ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/examples/js/postprocessing/EffectComposer.js b/examples/js/postprocessing/EffectComposer.js index 5c87f8f47a..d548abdb6f 100644 --- a/examples/js/postprocessing/EffectComposer.js +++ b/examples/js/postprocessing/EffectComposer.js @@ -261,11 +261,12 @@ Object.assign( THREE.Pass.prototype, { THREE.Pass.FullScreenQuad = ( function () { var camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); + + // https://github.com/mrdoob/three.js/pull/21358 + var geometry = new THREE.BufferGeometry(); - const vertices = new Float32Array([-1, 3, 0, -1, -1, 0, 3, -1, 0]); - geometry.setAttribute("position", new THREE.BufferAttribute(vertices, 3)); - const uv = new Float32Array([0, 2, 0, 0, 2, 0]); - geometry.setAttribute("uv", new THREE.BufferAttribute(uv, 2)); + geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) ); + geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) ); var FullScreenQuad = function ( material ) { diff --git a/examples/jsm/postprocessing/EffectComposer.js b/examples/jsm/postprocessing/EffectComposer.js index d6e99814b9..b76da556be 100644 --- a/examples/jsm/postprocessing/EffectComposer.js +++ b/examples/jsm/postprocessing/EffectComposer.js @@ -1,10 +1,10 @@ import { + BufferGeometry, Clock, + Float32BufferAttribute, LinearFilter, Mesh, OrthographicCamera, - BufferGeometry, - BufferAttribute, RGBAFormat, Vector2, WebGLRenderTarget @@ -277,11 +277,12 @@ Object.assign( Pass.prototype, { Pass.FullScreenQuad = ( function () { var camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); + + // https://github.com/mrdoob/three.js/pull/21358 + var geometry = new BufferGeometry(); - const vertices = new Float32Array([-1, 3, 0, -1, -1, 0, 3, -1, 0]); - geometry.setAttribute("position", new BufferAttribute(vertices, 3)); - const uv = new Float32Array([0, 2, 0, 0, 2, 0]); - geometry.setAttribute("uv", new BufferAttribute(uv, 2)); + geometry.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) ); + geometry.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) ); var FullScreenQuad = function ( material ) { diff --git a/examples/jsm/postprocessing/Pass.js b/examples/jsm/postprocessing/Pass.js index 0788da9092..9d4166a2d0 100644 --- a/examples/jsm/postprocessing/Pass.js +++ b/examples/jsm/postprocessing/Pass.js @@ -1,7 +1,7 @@ import { - OrthographicCamera, BufferGeometry, - BufferAttribute, + Float32BufferAttribute, + OrthographicCamera, Mesh } from '../../../build/three.module.js'; @@ -42,11 +42,12 @@ Object.assign( Pass.prototype, { Pass.FullScreenQuad = ( function () { var camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); + + // https://github.com/mrdoob/three.js/pull/21358 + var geometry = new BufferGeometry(); - const vertices = new Float32Array([-1, 3, 0, -1, -1, 0, 3, -1, 0]); - geometry.setAttribute("position", new BufferAttribute(vertices, 3)); - const uv = new Float32Array([0, 2, 0, 0, 2, 0]); - geometry.setAttribute("uv", new BufferAttribute(uv, 2)); + geometry.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) ); + geometry.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) ); var FullScreenQuad = function ( material ) { -- GitLab