WebGLRenderer: add getViewport() method
@@ -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 );