Skip to content

Commit

Permalink
Examples: Clean up. (#27711)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Feb 8, 2024
1 parent 528ab95 commit 9239009
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
15 changes: 2 additions & 13 deletions examples/jsm/renderers/common/RenderContexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@ class RenderContexts {

} else {

let format, count;

if ( renderTarget.isWebGLMultipleRenderTargets ) {

format = renderTarget.texture[ 0 ].format;
count = renderTarget.texture.length;

} else {

format = renderTarget.texture.format;
count = 1;

}
const format = renderTarget.texture.format;
const count = renderTarget.count;

attachmentState = `${ count }:${ format }:${ renderTarget.samples }:${ renderTarget.depthBuffer }:${ renderTarget.stencilBuffer }`;

Expand Down
15 changes: 2 additions & 13 deletions examples/jsm/renderers/common/Textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ class Textures extends DataMap {
const sampleCount = renderTarget.samples === 0 ? 1 : renderTarget.samples;
const depthTextureMips = renderTargetData.depthTextureMips || ( renderTargetData.depthTextureMips = {} );

let texture, textures;

if ( renderTarget.isWebGLMultipleRenderTargets ) {

textures = renderTarget.texture;
texture = renderTarget.texture[ 0 ];

} else {

textures = [ renderTarget.texture ];
texture = renderTarget.texture;

}
const texture = renderTarget.texture;
const textures = renderTarget.textures;

const size = this.getSize( texture );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl2_multisampled_renderbuffers.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<div id="info">
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - Multisampled Renderbuffers<br />
Left: WebGLRenderTarget, Right: WebGLMultisampleRenderTarget.
Left: WebGLRenderTarget, Right: WebGLRenderTarget (multisampled).
</div>
<div id="container">
</div>
Expand Down
11 changes: 5 additions & 6 deletions examples/webgpu_multiple_rendertargets.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,16 @@

// Create a multi render target with Float buffers

renderTarget = new THREE.WebGLMultipleRenderTargets(
renderTarget = new THREE.RenderTarget(
window.innerWidth * window.devicePixelRatio,
window.innerHeight * window.devicePixelRatio,
2,
{ minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }
{ count: 2, minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }
);

// Name our G-Buffer attachments for debugging

renderTarget.texture[ 0 ].name = 'diffuse';
renderTarget.texture[ 1 ].name = 'normal';
renderTarget.textures[ 0 ].name = 'diffuse';
renderTarget.textures[ 1 ].name = 'normal';

// Scene setup

Expand All @@ -157,7 +156,7 @@

// PostProcessing setup

quadMesh = new QuadMesh( new ReadGBufferMaterial( renderTarget.texture[ 0 ], renderTarget.texture[ 1 ] ) );
quadMesh = new QuadMesh( new ReadGBufferMaterial( renderTarget.textures[ 0 ], renderTarget.textures[ 1 ] ) );

// Controls

Expand Down

0 comments on commit 9239009

Please sign in to comment.