|
@@ -51,9 +51,9 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
_image, _uvs,
|
|
|
_uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y,
|
|
|
|
|
|
- _clipBox2 = new THREE.Box2(),
|
|
|
- _clearBox2 = new THREE.Box2(),
|
|
|
- _elemBox2 = new THREE.Box2(),
|
|
|
+ _clipBox = new THREE.Box2(),
|
|
|
+ _clearBox = new THREE.Box2(),
|
|
|
+ _elemBox = new THREE.Box2(),
|
|
|
|
|
|
_enableLighting = false,
|
|
|
_ambientLight = new THREE.Color(),
|
|
@@ -112,10 +112,10 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
_canvas.width = _canvasWidth;
|
|
|
_canvas.height = _canvasHeight;
|
|
|
|
|
|
- _clipBox2.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
- _clipBox2.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
- _clearBox2.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
- _clearBox2.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
+ _clipBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
+ _clipBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
+ _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
+ _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
|
|
|
_contextGlobalAlpha = 1;
|
|
|
_contextGlobalCompositeOperation = 0;
|
|
@@ -132,8 +132,8 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
_clearColor.copy( color );
|
|
|
_clearOpacity = opacity !== undefined ? opacity : 1;
|
|
|
|
|
|
- _clearBox2.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
- _clearBox2.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
+ _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
+ _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -142,8 +142,8 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
_clearColor.setHex( hex );
|
|
|
_clearOpacity = opacity !== undefined ? opacity : 1;
|
|
|
|
|
|
- _clearBox2.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
- _clearBox2.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
+ _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
|
|
|
+ _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -157,14 +157,14 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
_context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
|
|
|
|
|
|
- if ( _clearBox2.empty() === false ) {
|
|
|
+ if ( _clearBox.empty() === false ) {
|
|
|
|
|
|
- _clearBox2.intersect( _clipBox2 );
|
|
|
- _clearBox2.expandByScalar( 2 );
|
|
|
+ _clearBox.intersect( _clipBox );
|
|
|
+ _clearBox.expandByScalar( 2 );
|
|
|
|
|
|
if ( _clearOpacity < 1 ) {
|
|
|
|
|
|
- _context.clearRect( _clearBox2.min.x | 0, _clearBox2.min.y | 0, ( _clearBox2.max.x - _clearBox2.min.x ) | 0, ( _clearBox2.max.y - _clearBox2.min.y ) | 0 );
|
|
|
+ _context.clearRect( _clearBox.min.x | 0, _clearBox.min.y | 0, ( _clearBox.max.x - _clearBox.min.x ) | 0, ( _clearBox.max.y - _clearBox.min.y ) | 0 );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -175,11 +175,11 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clearOpacity + ')' );
|
|
|
|
|
|
- _context.fillRect( _clearBox2.min.x | 0, _clearBox2.min.y | 0, ( _clearBox2.max.x - _clearBox2.min.x ) | 0, ( _clearBox2.max.y - _clearBox2.min.y ) | 0 );
|
|
|
+ _context.fillRect( _clearBox.min.x | 0, _clearBox.min.y | 0, ( _clearBox.max.x - _clearBox.min.x ) | 0, ( _clearBox.max.y - _clearBox.min.y ) | 0 );
|
|
|
|
|
|
}
|
|
|
|
|
|
- _clearBox2.makeEmpty();
|
|
|
+ _clearBox.makeEmpty();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -210,7 +210,7 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
/* DEBUG
|
|
|
_context.fillStyle = 'rgba( 0, 255, 255, 0.5 )';
|
|
|
- _context.fillRect( _clipBox2.min.x, _clipBox2.min.y, _clipBox2.max.x - _clipBox2.min.x, _clipBox2.max.y - _clipBox2.min.y );
|
|
|
+ _context.fillRect( _clipBox.min.x, _clipBox.min.y, _clipBox.max.x - _clipBox.min.x, _clipBox.max.y - _clipBox.min.y );
|
|
|
*/
|
|
|
|
|
|
_enableLighting = _lights.length > 0;
|
|
@@ -229,7 +229,7 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
if ( material === undefined || material.visible === false ) continue;
|
|
|
|
|
|
- _elemBox2.makeEmpty();
|
|
|
+ _elemBox.makeEmpty();
|
|
|
|
|
|
if ( element instanceof THREE.RenderableParticle ) {
|
|
|
|
|
@@ -245,9 +245,9 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
_v1.positionScreen.x *= _canvasWidthHalf; _v1.positionScreen.y *= _canvasHeightHalf;
|
|
|
_v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf;
|
|
|
|
|
|
- _elemBox2.setFromPoints( [ _v1.positionScreen, _v2.positionScreen ] );
|
|
|
+ _elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen ] );
|
|
|
|
|
|
- if ( _clipBox2.isIntersectionBox( _elemBox2 ) === true ) {
|
|
|
+ if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
|
|
|
|
|
|
renderLine( _v1, _v2, element, material, scene );
|
|
|
|
|
@@ -270,9 +270,9 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _elemBox2.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen ] );
|
|
|
+ _elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen ] );
|
|
|
|
|
|
- if ( _clipBox2.isIntersectionBox( _elemBox2 ) === true ) {
|
|
|
+ if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
|
|
|
|
|
|
renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material, scene );
|
|
|
|
|
@@ -301,9 +301,9 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _elemBox2.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen, _v4.positionScreen ] );
|
|
|
+ _elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, _v3.positionScreen, _v4.positionScreen ] );
|
|
|
|
|
|
- if ( _clipBox2.isIntersectionBox( _elemBox2 ) === true ) {
|
|
|
+ if ( _clipBox.isIntersectionBox( _elemBox ) === true ) {
|
|
|
|
|
|
renderFace4( _v1, _v2, _v3, _v4, _v5, _v6, element, material, scene );
|
|
|
|
|
@@ -315,17 +315,17 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
/* DEBUG
|
|
|
_context.lineWidth = 1;
|
|
|
_context.strokeStyle = 'rgba( 0, 255, 0, 0.5 )';
|
|
|
- _context.strokeRect( _elemBox2.min.x, _elemBox2.min.y, _elemBox2.max.x - _elemBox2.min.x, _elemBox2.max.y - _elemBox2.min.y );
|
|
|
+ _context.strokeRect( _elemBox.min.x, _elemBox.min.y, _elemBox.max.x - _elemBox.min.x, _elemBox.max.y - _elemBox.min.y );
|
|
|
*/
|
|
|
|
|
|
- _clearBox2.union( _elemBox2 );
|
|
|
+ _clearBox.union( _elemBox );
|
|
|
|
|
|
}
|
|
|
|
|
|
/* DEBUG
|
|
|
_context.lineWidth = 1;
|
|
|
_context.strokeStyle = 'rgba( 255, 0, 0, 0.5 )';
|
|
|
- _context.strokeRect( _clearBox2.min.x, _clearBox2.min.y, _clearBox2.max.x - _clearBox2.min.x, _clearBox2.max.y - _clearBox2.min.y );
|
|
|
+ _context.strokeRect( _clearBox.min.x, _clearBox.min.y, _clearBox.max.x - _clearBox.min.x, _clearBox.max.y - _clearBox.min.y );
|
|
|
*/
|
|
|
|
|
|
_context.setTransform( 1, 0, 0, 1, 0, 0 );
|
|
@@ -436,10 +436,10 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
scaleX *= element.scale.x * _canvasWidthHalf;
|
|
|
scaleY *= element.scale.y * _canvasHeightHalf;
|
|
|
|
|
|
- _elemBox2.min.set( v1.x - scaleX, v1.y - scaleY );
|
|
|
- _elemBox2.max.set( v1.x + scaleX, v1.y + scaleY );
|
|
|
+ _elemBox.min.set( v1.x - scaleX, v1.y - scaleY );
|
|
|
+ _elemBox.max.set( v1.x + scaleX, v1.y + scaleY );
|
|
|
|
|
|
- if ( _clipBox2.isIntersectionBox( _elemBox2 ) === false ) {
|
|
|
+ if ( _clipBox.isIntersectionBox( _elemBox ) === false ) {
|
|
|
|
|
|
return;
|
|
|
|
|
@@ -468,10 +468,10 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
// TODO: Rotations break this...
|
|
|
|
|
|
- _elemBox2.min.set( v1.x - width, v1.y - height );
|
|
|
- _elemBox2.max.set( v1.x + width, v1.y + height );
|
|
|
+ _elemBox.min.set( v1.x - width, v1.y - height );
|
|
|
+ _elemBox.max.set( v1.x + width, v1.y + height );
|
|
|
|
|
|
- if ( _clipBox2.isIntersectionBox( _elemBox2 ) === false ) {
|
|
|
+ if ( _clipBox.isIntersectionBox( _elemBox ) === false ) {
|
|
|
|
|
|
return;
|
|
|
|
|
@@ -503,10 +503,10 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
width = element.scale.x * _canvasWidthHalf;
|
|
|
height = element.scale.y * _canvasHeightHalf;
|
|
|
|
|
|
- _elemBox2.min.set( v1.x - width, v1.y - height );
|
|
|
- _elemBox2.max.set( v1.x + width, v1.y + height );
|
|
|
+ _elemBox.min.set( v1.x - width, v1.y - height );
|
|
|
+ _elemBox.max.set( v1.x + width, v1.y + height );
|
|
|
|
|
|
- if ( _clipBox2.isIntersectionBox( _elemBox2 ) === false ) {
|
|
|
+ if ( _clipBox.isIntersectionBox( _elemBox ) === false ) {
|
|
|
|
|
|
return;
|
|
|
|
|
@@ -545,7 +545,7 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
setStrokeStyle( material.color.getStyle() );
|
|
|
|
|
|
_context.stroke();
|
|
|
- _elemBox2.expandByScalar( material.linewidth * 2 );
|
|
|
+ _elemBox.expandByScalar( material.linewidth * 2 );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -922,7 +922,7 @@ THREE.CanvasRenderer = function ( parameters ) {
|
|
|
|
|
|
_context.stroke();
|
|
|
|
|
|
- _elemBox2.expandByScalar( linewidth * 2 );
|
|
|
+ _elemBox.expandByScalar( linewidth * 2 );
|
|
|
|
|
|
}
|
|
|
|