未验证 提交 749f4eb6 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15796 from WestLangley/dev-set_viewport

WebGLRenderer: support Vector4 arg in setViewport()
...@@ -468,8 +468,16 @@ ...@@ -468,8 +468,16 @@
The slot number can be found as a value of the uniform of the sampler. The slot number can be found as a value of the uniform of the sampler.
</p> </p>
<h3>[method:null setViewport]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )</h3> <h3>[method:null setViewport]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )<br />
<p>Sets the viewport to render from (x, y) to (x + width, y + height).</p> [method:null setViewport]( [param:Vector4 vector] )</h3>
<p>
The x, y, width, and height parameters of the viewport.<br />
Optionally, a 4-component vector specifying the parameters of a viewport.<br /><br />
Sets the viewport to render from (x, y) to (x + width, y + height).<br />
(x, y) is the lower-left corner of the region.
</p>
<h2>Source</h2> <h2>Source</h2>
......
...@@ -223,8 +223,9 @@ export class WebGLRenderer implements Renderer { ...@@ -223,8 +223,9 @@ export class WebGLRenderer implements Renderer {
/** /**
* Sets the viewport to render from (x, y) to (x + width, y + height). * Sets the viewport to render from (x, y) to (x + width, y + height).
* (x, y) is the lower-left corner of the region.
*/ */
setViewport(x?: number, y?: number, width?: number, height?: number): void; setViewport(x: Vector4 | number, y?: number, width?: number, height?: number): void;
/** /**
* Sets the scissor area from (x, y) to (x + width, y + height). * Sets the scissor area from (x, y) to (x + width, y + height).
......
...@@ -452,7 +452,16 @@ function WebGLRenderer( parameters ) { ...@@ -452,7 +452,16 @@ function WebGLRenderer( parameters ) {
this.setViewport = function ( x, y, width, height ) { this.setViewport = function ( x, y, width, height ) {
_viewport.set( x, y, width, height ); if ( x.isVector4 ) {
_viewport.set( x.x, x.y, x.z, x.w );
} else {
_viewport.set( x, y, width, height );
}
state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ) ); state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ) );
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册