提交 e6f131ae 编写于 作者: W WestLangley

WebGLRenderer: add getViewport() method

上级 9e49e886
......@@ -372,6 +372,13 @@
Returns the width and height of the renderer's output canvas, in pixels.
</p>
<h3>[method:Vector4 getViewport]( [param:Vector4 target] )</h3>
<p>
[page:Vector4 target] — the result will be copied into this Vector4.<br /><br />
Returns the viewport.
</p>
<h3>[method:null resetGLState]( )</h3>
<p>Reset the GL state to default. Called internally if the WebGL context is lost.</p>
......
......@@ -215,6 +215,12 @@ export class WebGLRenderer implements Renderer {
setSize(width: number, height: number, updateStyle?: boolean): void;
getCurrentViewport(target: Vector4): Vector4;
/**
* Copies the viewport into target.
*/
getViewport(target: Vector4): Vector4;
/**
* Sets the viewport to render from (x, y) to (x + width, y + height).
*/
......
......@@ -443,6 +443,12 @@ function WebGLRenderer( parameters ) {
};
this.getViewport = function ( target ) {
return target.copy( _viewport );
};
this.setViewport = function ( x, y, width, height ) {
_viewport.set( x, y, width, height );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册