提交 7d9f979b 编写于 作者: M Mr.doob

Replaced Rectangle with Vector4.

上级 3179ceac
/**
* @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;
}
};
......@@ -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 || {};
......
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册