Browse Source

Replaced Rectangle with Vector4.

Mr.doob 9 years ago
parent
commit
7d9f979b2d

+ 0 - 43
src/math/Rectangle.js

@@ -1,43 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-THREE.Rectangle = function ( x, y, width, height ) {
-
-	this.set( x, y, width, height );
-
-};
-
-THREE.Rectangle.prototype = {
-
-	constructor: THREE.Rectangle,
-
-	set: function ( x, y, width, height ) {
-
-		this.x = x;
-		this.y = y;
-		this.width = width;
-		this.height = height;
-
-		return this;
-
-	},
-
-	copy: function ( source ) {
-
-		this.x = source.x;
-		this.y = source.y;
-		this.width = source.width;
-		this.height = source.height;
-
-		return this;
-
-	},
-
-	equals: function ( rectangle ) {
-
-		return this.x === rectangle.x && this.y === rectangle.y && this.width === rectangle.width && this.height === rectangle.height;
-
-	}
-
-};

+ 2 - 2
src/renderers/WebGLRenderTarget.js

@@ -16,10 +16,10 @@ THREE.WebGLRenderTarget = function ( width, height, options ) {
 	this.width = width;
 	this.height = height;
 
-	this.scissor = new THREE.Rectangle( 0, 0, width, height );
+	this.scissor = new THREE.Vector4( 0, 0, width, height );
 	this.scissorTest = false;
 
-	this.viewport = new THREE.Rectangle( 0, 0, width, height );
+	this.viewport = new THREE.Vector4( 0, 0, width, height );
 
 	options = options || {};
 

+ 3 - 3
src/renderers/WebGLRenderer.js

@@ -88,7 +88,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	_usedTextureUnits = 0,
 
-	_viewport = new THREE.Rectangle( 0, 0, _canvas.width, _canvas.height ),
+	_viewport = new THREE.Vector4( 0, 0, _canvas.width, _canvas.height ),
 
 	_currentWidth = 0,
 	_currentHeight = 0,
@@ -238,7 +238,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		state.init();
 
-		_gl.viewport( _viewport.x, _viewport.y, _viewport.width, _viewport.height );
+		_gl.viewport( _viewport.x, _viewport.y, _viewport.z, _viewport.w );
 
 		glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
 
@@ -3410,7 +3410,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( framebuffer !== _currentFramebuffer ) {
 
 			_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
-			_gl.viewport( viewport.x, viewport.y, viewport.width, viewport.height );
+			_gl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );
 
 			_currentFramebuffer = framebuffer;
 

+ 4 - 4
src/renderers/webgl/WebGLState.js

@@ -41,8 +41,8 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 	var currentTextureSlot = undefined;
 	var currentBoundTextures = {};
 
-	var currentScissor = new THREE.Rectangle();
-	var currentViewport = new THREE.Rectangle();
+	var currentScissor = new THREE.Vector4();
+	var currentViewport = new THREE.Vector4();
 
 	this.init = function () {
 
@@ -516,7 +516,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 		if ( currentScissor.equals( scissor ) === false ) {
 
-			gl.scissor( scissor.x, scissor.y, scissor.width, scissor.height );
+			gl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );
 			currentScissor.copy( scissor );
 
 		}
@@ -527,7 +527,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 		if ( currentViewport.equals( viewport ) === false ) {
 
-			gl.viewport( viewport.x, viewport.y, viewport.width, viewport.height );
+			gl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );
 			currentViewport.copy( viewport );
 
 		}

+ 0 - 1
utils/build/includes/common.json

@@ -16,7 +16,6 @@
 	"src/math/Frustum.js",
 	"src/math/Plane.js",
 	"src/math/Math.js",
-	"src/math/Rectangle.js",
 	"src/math/Spline.js",
 	"src/math/Triangle.js",
 	"src/math/Interpolant.js",