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

WebGLCubeRenderTarget: simplify constructor signature #18300

Merged
merged 3 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/api/en/renderers/WebGLCubeRenderTarget.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ <h2>Examples</h2>
<h2>Constructor</h2>


<h3>[name]([param:Number width], [param:Number height], [param:Object options])</h3>
<h3>[name]([param:Number size], param:Object options])</h3>
<p>
[page:Float width] - The width of the renderTarget. <br />
[page:Float height] - The height of the renderTarget. <br />
[page:Float size] - the size, in pixels. <br />
options - (optional) object that holds texture parameters for an auto-generated target
texture and depthBuffer/stencilBuffer booleans.

Expand Down
5 changes: 2 additions & 3 deletions docs/api/zh/renderers/WebGLCubeRenderTarget.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ <h2>例子</h2>
<h2>构造器</h2>


<h3>[name]([param:Number width], [param:Number height], [param:Object options])</h3>
<h3>[name]([param:Number size], [param:Object options])</h3>
<p>
[page:Float width] - renderTarget的宽度 <br />
[page:Float height] - renderTarget的高度 <br />
[page:Float size] - the size, in pixels. <br />
options - (可选)一个保存着自动生成的目标纹理的纹理参数以及表示是否使用深度缓存/模板缓存的布尔值的对象。
有关纹理参数的说明,请参阅[page:Texture Texture]. 以下是合理选项:<br /><br />

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_materials_cubemap_dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
magFilter: THREE.LinearFilter
};

scene.background = new THREE.WebGLCubeRenderTarget( 1024, 1024, options ).fromEquirectangularTexture( renderer, texture );
scene.background = new THREE.WebGLCubeRenderTarget( 1024, options ).fromEquirectangularTexture( renderer, texture );

//

Expand Down
4 changes: 2 additions & 2 deletions src/Three.Legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1796,8 +1796,8 @@ Object.defineProperties( WebGLShadowMap.prototype, {

export function WebGLRenderTargetCube( width, height, options ) {

console.warn( 'THREE.WebGLRenderTargetCube has been renamed to WebGLCubeRenderTarget.' );
return new WebGLCubeRenderTarget( width, height, options );
console.warn( 'THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).' );
return new WebGLCubeRenderTarget( width, options );

}

Expand Down
2 changes: 1 addition & 1 deletion src/cameras/CubeCamera.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function CubeCamera( near, far, cubeResolution, options ) {

options = options || { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter };

this.renderTarget = new WebGLCubeRenderTarget( cubeResolution, cubeResolution, options );
this.renderTarget = new WebGLCubeRenderTarget( cubeResolution, options );
this.renderTarget.texture.name = "CubeCamera";

this.update = function ( renderer, scene ) {
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/WebGLCubeRenderTarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Texture } from './../textures/Texture';
export class WebGLCubeRenderTarget extends WebGLRenderTarget {

constructor(
width: number,
height: number,
size: number,
options?: WebGLRenderTargetOptions
);

Expand Down
12 changes: 10 additions & 2 deletions src/renderers/WebGLCubeRenderTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ import { CubeCamera } from '../cameras/CubeCamera.js';
* @author WestLangley / http://github.com/WestLangley
*/

function WebGLCubeRenderTarget( width, height, options ) {
function WebGLCubeRenderTarget( size, options, dummy ) {

WebGLRenderTarget.call( this, width, height, options );
if ( Number.isInteger( options ) ) {

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

options = dummy;

}

WebGLRenderTarget.call( this, size, size, options );

}

Expand Down