Skip to content

Commit

Permalink
WebGLCubeRenderTarget: Simplify constructor. (#23443)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Feb 8, 2022
1 parent 1637e9d commit ce51b61
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/renderers/WebGLCubeRenderTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ import { CubeTexture } from '../textures/CubeTexture.js';

class WebGLCubeRenderTarget extends WebGLRenderTarget {

constructor( size, options, dummy ) {

if ( Number.isInteger( options ) ) {

console.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );

options = dummy;

}
constructor( size, options = {} ) {

super( size, size, options );

options = options || {};
const image = { width: size, height: size, depth: 1 };
const images = [ image, image, image, image, image, image ];

this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );

// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
Expand All @@ -31,10 +26,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).

const image = { width: size, height: size, depth: 1 };
const images = [ image, image, image, image, image, image ];

this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
this.texture.isRenderTargetTexture = true;

this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
Expand Down

0 comments on commit ce51b61

Please sign in to comment.