提交 d8de242e 编写于 作者: W WestLangley

Require target Vector4 in WebGLRenderer getCurrentViewport()

上级 986635a3
......@@ -348,8 +348,12 @@
<h3>[method:RenderTarget getRenderTarget]()</h3>
<p>Returns the current RenderTarget, if any.</p>
<h3>[method:RenderTarget getCurrentViewport]()</h3>
<p>Returns the current viewport.</p>
<h3>[method:Vector4 getCurrentViewport]( [param:Vector4 target] )</h3>
<p>
[page:Vector4 target] — the result will be copied into this Vector4.<br /><br />
Returns the current viewport.
</p>
<h3>[method:Object getDrawingBufferSize]()</h3>
<p>Returns an object containing the width and height of the renderer's drawing buffer, in pixels.</p>
......
......@@ -162,7 +162,7 @@ THREE.Lensflare = function () {
this.onBeforeRender = function ( renderer, scene, camera ) {
viewport.copy( renderer.getCurrentViewport() );
renderer.getCurrentViewport( viewport );
var invAspect = viewport.w / viewport.z;
var halfViewportWidth = viewport.z / 2.0;
......
......@@ -213,7 +213,7 @@ export class WebGLRenderer implements Renderer {
*/
setSize(width: number, height: number, updateStyle?: boolean): void;
getCurrentViewport(): Vector4;
getCurrentViewport(target: Vector4): Vector4;
/**
* Sets the viewport to render from (x, y) to (x + width, y + height).
*/
......
......@@ -418,9 +418,17 @@ function WebGLRenderer( parameters ) {
};
this.getCurrentViewport = function () {
this.getCurrentViewport = function ( target ) {
return _currentViewport;
if ( target === undefined ) {
console.warn( 'WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument' );
target = new Vector4();
}
return target.copy( _currentViewport );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册