Explorar o código

WebGLRenderer: Add .getScissor(), .getScissorTest() methods

WestLangley %!s(int64=6) %!d(string=hai) anos
pai
achega
8c7380a129

+ 10 - 0
docs/api/en/renderers/WebGLRenderer.html

@@ -365,6 +365,16 @@
 		<h3>[method:number getPixelRatio]()</h3>
 		<p>Returns current device pixel ratio used.</p>
 
+		<h3>[method:Vector4 getScissor]( [param:Vector4 target] )</h3>
+		<p>
+		[page:Vector4 target] — the result will be copied into this Vector4.<br /><br />
+
+		Returns the scissor region.
+		</p>
+
+		<h3>[method:Boolean getScissorTest]()</h3>
+		<p>Returns *true* if scissor test is enabled; returns *false* otherwise.</p>
+
 		<h3>[method:Vector2 getSize]( [param:Vector2 target] )</h3>
 		<p>
 		[page:Vector2 target] — the result will be copied into this Vector2.<br /><br />

+ 10 - 0
src/renderers/WebGLRenderer.d.ts

@@ -227,11 +227,21 @@ export class WebGLRenderer implements Renderer {
    */
   setViewport(x: Vector4 | number, y?: number, width?: number, height?: number): void;
 
+  /**
+   * Copies the scissor area into target.
+   */
+  getScissor(target: Vector4): Vector4;
+
   /**
    * Sets the scissor area from (x, y) to (x + width, y + height).
    */
   setScissor(x: number, y: number, width: number, height: number): void;
 
+  /**
+   * Returns true if scissor test is enabled; returns false otherwise.
+   */
+  getScissorTest(): boolean;
+
   /**
    * Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.
    */

+ 12 - 0
src/renderers/WebGLRenderer.js

@@ -466,6 +466,12 @@ function WebGLRenderer( parameters ) {
 
 	};
 
+	this.getScissor = function ( target ) {
+
+		return target.copy( _scissor );
+
+	};
+
 	this.setScissor = function ( x, y, width, height ) {
 
 		_scissor.set( x, y, width, height );
@@ -473,6 +479,12 @@ function WebGLRenderer( parameters ) {
 
 	};
 
+	this.getScissorTest = function () {
+
+		return _scissorTest;
+
+	};
+
 	this.setScissorTest = function ( boolean ) {
 
 		state.setScissorTest( _scissorTest = boolean );