Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: Add transition effect. #28174

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions examples/jsm/postprocessing/RenderTransitionPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class RenderTransitionPass extends Pass {
this.renderTargetB = new WebGLRenderTarget();
this.renderTargetB.texture.type = HalfFloatType;

this.pixelRatio = 1;

}

setTransition( value ) {
Expand All @@ -52,17 +50,8 @@ class RenderTransitionPass extends Pass {

}

setPixelRatio( value ) {

this.pixelRatio = value;

}

setSize( width, height ) {

const pixelRatio = this.pixelRatio;
width = pixelRatio * width;
height = pixelRatio * height;
this.renderTargetA.setSize( width, height );
this.renderTargetB.setSize( width, height );

Expand Down
16 changes: 3 additions & 13 deletions examples/webgl_postprocessing_crossfade.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,9 @@
initGUI();
initTextures();

const width = window.innerWidth;
const height = window.innerHeight;
const dpr = window.devicePixelRatio;

renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( dpr );
renderer.setSize( width, height );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animate );
document.body.appendChild( renderer.domElement );

Expand All @@ -76,8 +72,6 @@
document.body.appendChild( stats.dom );

renderTransitionPass = new RenderTransitionPass( fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera );
renderTransitionPass.setPixelRatio( dpr );
renderTransitionPass.setSize( width, height );
renderTransitionPass.setTexture( textures[ 0 ] );
composer.addPass( renderTransitionPass );

Expand All @@ -92,11 +86,7 @@

fxSceneA.resize();
fxSceneB.resize();
const width = window.innerWidth;
const height = window.innerHeight;
renderTransitionPass.setSize( width, height );
renderer.setSize( width, height );
Mugen87 marked this conversation as resolved.
Show resolved Hide resolved
composer.setSize( width, height );
composer.setSize( window.innerWidth, window.innerHeight );

}

Expand Down