Просмотр исходного кода

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

WestLangley 6 лет назад
Родитель
Сommit
8c7380a129
3 измененных файлов с 32 добавлено и 0 удалено
  1. 10 0
      docs/api/en/renderers/WebGLRenderer.html
  2. 10 0
      src/renderers/WebGLRenderer.d.ts
  3. 12 0
      src/renderers/WebGLRenderer.js

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

@@ -365,6 +365,16 @@
 		<h3>[method:number getPixelRatio]()</h3>
 		<h3>[method:number getPixelRatio]()</h3>
 		<p>Returns current device pixel ratio used.</p>
 		<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>
 		<h3>[method:Vector2 getSize]( [param:Vector2 target] )</h3>
 		<p>
 		<p>
 		[page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
 		[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;
   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).
    * Sets the scissor area from (x, y) to (x + width, y + height).
    */
    */
   setScissor(x: number, y: number, width: number, height: number): void;
   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.
    * 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 ) {
 	this.setScissor = function ( x, y, width, height ) {
 
 
 		_scissor.set( 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 ) {
 	this.setScissorTest = function ( boolean ) {
 
 
 		state.setScissorTest( _scissorTest = boolean );
 		state.setScissorTest( _scissorTest = boolean );