|
@@ -53,8 +53,6 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
Y: new THREE.Vector3( 0, 1, 0 ),
|
|
|
Z: new THREE.Vector3( 0, 0, 1 )
|
|
|
};
|
|
|
- var _identityQuaternion = new THREE.Quaternion();
|
|
|
- var _alignVector = new THREE.Vector3();
|
|
|
|
|
|
var pointStart = new THREE.Vector3();
|
|
|
var pointEnd = new THREE.Vector3();
|
|
@@ -161,13 +159,13 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
Object.defineProperty( scope, propName, {
|
|
|
|
|
|
- get: function() {
|
|
|
+ get: function () {
|
|
|
|
|
|
return propValue !== undefined ? propValue : defaultValue;
|
|
|
|
|
|
},
|
|
|
|
|
|
- set: function( value ) {
|
|
|
+ set: function ( value ) {
|
|
|
|
|
|
if ( propValue !== value ) {
|
|
|
|
|
@@ -182,7 +180,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- });
|
|
|
+ } );
|
|
|
|
|
|
scope[ propName ] = defaultValue;
|
|
|
_plane[ propName ] = defaultValue;
|
|
@@ -221,7 +219,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.pointerHover = function( pointer ) {
|
|
|
+ this.pointerHover = function ( pointer ) {
|
|
|
|
|
|
if ( this.object === undefined || this.dragging === true || ( pointer.button !== undefined && pointer.button !== 0 ) ) return;
|
|
|
|
|
@@ -241,7 +239,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.pointerDown = function( pointer ) {
|
|
|
+ this.pointerDown = function ( pointer ) {
|
|
|
|
|
|
if ( this.object === undefined || this.dragging === true || ( pointer.button !== undefined && pointer.button !== 0 ) ) return;
|
|
|
|
|
@@ -255,11 +253,11 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
var space = this.space;
|
|
|
|
|
|
- if ( this.mode === 'scale') {
|
|
|
+ if ( this.mode === 'scale' ) {
|
|
|
|
|
|
space = 'local';
|
|
|
|
|
|
- } else if ( this.axis === 'E' || this.axis === 'XYZE' || this.axis === 'XYZ' ) {
|
|
|
+ } else if ( this.axis === 'E' || this.axis === 'XYZE' || this.axis === 'XYZ' ) {
|
|
|
|
|
|
space = 'world';
|
|
|
|
|
@@ -296,18 +294,18 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.pointerMove = function( pointer ) {
|
|
|
+ this.pointerMove = function ( pointer ) {
|
|
|
|
|
|
var axis = this.axis;
|
|
|
var mode = this.mode;
|
|
|
var object = this.object;
|
|
|
var space = this.space;
|
|
|
|
|
|
- if ( mode === 'scale') {
|
|
|
+ if ( mode === 'scale' ) {
|
|
|
|
|
|
space = 'local';
|
|
|
|
|
|
- } else if ( axis === 'E' || axis === 'XYZE' || axis === 'XYZ' ) {
|
|
|
+ } else if ( axis === 'E' || axis === 'XYZE' || axis === 'XYZ' ) {
|
|
|
|
|
|
space = 'world';
|
|
|
|
|
@@ -330,17 +328,23 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
offset.copy( pointEnd ).sub( pointStart );
|
|
|
|
|
|
if ( space === 'local' && axis !== 'XYZ' ) {
|
|
|
+
|
|
|
offset.applyQuaternion( worldQuaternionInv );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( axis.indexOf( 'X' ) === -1 ) offset.x = 0;
|
|
|
- if ( axis.indexOf( 'Y' ) === -1 ) offset.y = 0;
|
|
|
- if ( axis.indexOf( 'Z' ) === -1 ) offset.z = 0;
|
|
|
+ if ( axis.indexOf( 'X' ) === - 1 ) offset.x = 0;
|
|
|
+ if ( axis.indexOf( 'Y' ) === - 1 ) offset.y = 0;
|
|
|
+ if ( axis.indexOf( 'Z' ) === - 1 ) offset.z = 0;
|
|
|
+
|
|
|
+ if ( space === 'local' && axis !== 'XYZ' ) {
|
|
|
|
|
|
- if ( space === 'local' && axis !== 'XYZ') {
|
|
|
offset.applyQuaternion( quaternionStart ).divide( parentScale );
|
|
|
+
|
|
|
} else {
|
|
|
+
|
|
|
offset.applyQuaternion( parentQuaternionInv ).divide( parentScale );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
object.position.copy( offset ).add( positionStart );
|
|
@@ -351,18 +355,24 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
if ( space === 'local' ) {
|
|
|
|
|
|
- object.position.applyQuaternion(_tempQuaternion.copy( quaternionStart ).inverse() );
|
|
|
+ object.position.applyQuaternion( _tempQuaternion.copy( quaternionStart ).inverse() );
|
|
|
+
|
|
|
+ if ( axis.search( 'X' ) !== - 1 ) {
|
|
|
|
|
|
- if ( axis.search( 'X' ) !== -1 ) {
|
|
|
object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( axis.search( 'Y' ) !== -1 ) {
|
|
|
+ if ( axis.search( 'Y' ) !== - 1 ) {
|
|
|
+
|
|
|
object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( axis.search( 'Z' ) !== -1 ) {
|
|
|
+ if ( axis.search( 'Z' ) !== - 1 ) {
|
|
|
+
|
|
|
object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
object.position.applyQuaternion( quaternionStart );
|
|
@@ -372,23 +382,33 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
if ( space === 'world' ) {
|
|
|
|
|
|
if ( object.parent ) {
|
|
|
+
|
|
|
object.position.add( _tempVector.setFromMatrixPosition( object.parent.matrixWorld ) );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( axis.search( 'X' ) !== -1 ) {
|
|
|
+ if ( axis.search( 'X' ) !== - 1 ) {
|
|
|
+
|
|
|
object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( axis.search( 'Y' ) !== -1 ) {
|
|
|
+ if ( axis.search( 'Y' ) !== - 1 ) {
|
|
|
+
|
|
|
object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( axis.search( 'Z' ) !== -1 ) {
|
|
|
+ if ( axis.search( 'Z' ) !== - 1 ) {
|
|
|
+
|
|
|
object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if ( object.parent ) {
|
|
|
+
|
|
|
object.position.sub( _tempVector.setFromMatrixPosition( object.parent.matrixWorld ) );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -397,32 +417,38 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
} else if ( mode === 'scale' ) {
|
|
|
|
|
|
- if ( axis.search( 'XYZ' ) !== -1 ) {
|
|
|
+ if ( axis.search( 'XYZ' ) !== - 1 ) {
|
|
|
|
|
|
var d = pointEnd.length() / pointStart.length();
|
|
|
|
|
|
- if ( pointEnd.dot( pointStart ) < 0 ) d *= -1;
|
|
|
+ if ( pointEnd.dot( pointStart ) < 0 ) d *= - 1;
|
|
|
|
|
|
_tempVector2.set( d, d, d );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- _tempVector.copy(pointStart);
|
|
|
- _tempVector2.copy(pointEnd);
|
|
|
+ _tempVector.copy( pointStart );
|
|
|
+ _tempVector2.copy( pointEnd );
|
|
|
|
|
|
_tempVector.applyQuaternion( worldQuaternionInv );
|
|
|
_tempVector2.applyQuaternion( worldQuaternionInv );
|
|
|
|
|
|
_tempVector2.divide( _tempVector );
|
|
|
|
|
|
- if ( axis.search( 'X' ) === -1 ) {
|
|
|
+ if ( axis.search( 'X' ) === - 1 ) {
|
|
|
+
|
|
|
_tempVector2.x = 1;
|
|
|
+
|
|
|
}
|
|
|
- if ( axis.search( 'Y' ) === -1 ) {
|
|
|
+ if ( axis.search( 'Y' ) === - 1 ) {
|
|
|
+
|
|
|
_tempVector2.y = 1;
|
|
|
+
|
|
|
}
|
|
|
- if ( axis.search( 'Z' ) === -1 ) {
|
|
|
+ if ( axis.search( 'Z' ) === - 1 ) {
|
|
|
+
|
|
|
_tempVector2.z = 1;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -445,11 +471,11 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
startNorm.copy( pointStart ).normalize();
|
|
|
endNorm.copy( pointEnd ).normalize();
|
|
|
|
|
|
- rotationAngle *= ( endNorm.cross( startNorm ).dot( eye ) < 0 ? 1 : -1);
|
|
|
+ rotationAngle *= ( endNorm.cross( startNorm ).dot( eye ) < 0 ? 1 : - 1 );
|
|
|
|
|
|
} else if ( axis === 'XYZE' ) {
|
|
|
|
|
|
- rotationAxis.copy( offset ).cross( eye ).normalize( );
|
|
|
+ rotationAxis.copy( offset ).cross( eye ).normalize();
|
|
|
rotationAngle = offset.dot( _tempVector.copy( rotationAxis ).cross( this.eye ) ) * ROTATION_SPEED;
|
|
|
|
|
|
} else if ( axis === 'X' || axis === 'Y' || axis === 'Z' ) {
|
|
@@ -459,7 +485,9 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
_tempVector.copy( _unit[ axis ] );
|
|
|
|
|
|
if ( space === 'local' ) {
|
|
|
+
|
|
|
_tempVector.applyQuaternion( worldQuaternion );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
rotationAngle = offset.dot( _tempVector.cross( eye ).normalize() ) * ROTATION_SPEED;
|
|
@@ -493,7 +521,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.pointerUp = function( pointer ) {
|
|
|
+ this.pointerUp = function ( pointer ) {
|
|
|
|
|
|
if ( pointer.button !== undefined && pointer.button !== 0 ) return;
|
|
|
|
|
@@ -530,7 +558,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
function onPointerHover( event ) {
|
|
|
|
|
|
- if ( !scope.enabled ) return;
|
|
|
+ if ( ! scope.enabled ) return;
|
|
|
|
|
|
scope.pointerHover( getPointer( event ) );
|
|
|
|
|
@@ -538,7 +566,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
function onPointerDown( event ) {
|
|
|
|
|
|
- if ( !scope.enabled ) return;
|
|
|
+ if ( ! scope.enabled ) return;
|
|
|
|
|
|
document.addEventListener( "mousemove", onPointerMove, false );
|
|
|
|
|
@@ -549,7 +577,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
function onPointerMove( event ) {
|
|
|
|
|
|
- if ( !scope.enabled ) return;
|
|
|
+ if ( ! scope.enabled ) return;
|
|
|
|
|
|
scope.pointerMove( getPointer( event ) );
|
|
|
|
|
@@ -557,7 +585,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
function onPointerUp( event ) {
|
|
|
|
|
|
- if ( !scope.enabled ) return;
|
|
|
+ if ( ! scope.enabled ) return;
|
|
|
|
|
|
document.removeEventListener( "mousemove", onPointerMove, false );
|
|
|
|
|
@@ -613,9 +641,9 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
THREE.TransformControls.prototype = Object.assign( Object.create( THREE.Object3D.prototype ), {
|
|
|
|
|
|
- constructor: THREE.TransformControls,
|
|
|
+ constructor: THREE.TransformControls,
|
|
|
|
|
|
- isTransformControls: true
|
|
|
+ isTransformControls: true
|
|
|
|
|
|
} );
|
|
|
|
|
@@ -630,21 +658,21 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
// shared materials
|
|
|
|
|
|
- var gizmoMaterial = new THREE.MeshBasicMaterial({
|
|
|
+ var gizmoMaterial = new THREE.MeshBasicMaterial( {
|
|
|
depthTest: false,
|
|
|
depthWrite: false,
|
|
|
transparent: true,
|
|
|
side: THREE.DoubleSide,
|
|
|
fog: false
|
|
|
- });
|
|
|
+ } );
|
|
|
|
|
|
- var gizmoLineMaterial = new THREE.LineBasicMaterial({
|
|
|
+ var gizmoLineMaterial = new THREE.LineBasicMaterial( {
|
|
|
depthTest: false,
|
|
|
depthWrite: false,
|
|
|
transparent: true,
|
|
|
linewidth: 1,
|
|
|
fog: false
|
|
|
- });
|
|
|
+ } );
|
|
|
|
|
|
// Make unique material for each axis/color
|
|
|
|
|
@@ -697,32 +725,32 @@ THREE.TransformControlsGizmo = function () {
|
|
|
matLineYellow.color.set( 0xffff00 );
|
|
|
|
|
|
var matLineGray = gizmoLineMaterial.clone();
|
|
|
- matLineGray.color.set( 0x787878);
|
|
|
+ matLineGray.color.set( 0x787878 );
|
|
|
|
|
|
var matLineYellowTransparent = matLineYellow.clone();
|
|
|
matLineYellowTransparent.opacity = 0.25;
|
|
|
|
|
|
// reusable geometry
|
|
|
|
|
|
- var arrowGeometry = new THREE.CylinderBufferGeometry( 0, 0.05, 0.2, 12, 1, false);
|
|
|
+ var arrowGeometry = new THREE.CylinderBufferGeometry( 0, 0.05, 0.2, 12, 1, false );
|
|
|
|
|
|
- var scaleHandleGeometry = new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125);
|
|
|
+ var scaleHandleGeometry = new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 );
|
|
|
|
|
|
var lineGeometry = new THREE.BufferGeometry( );
|
|
|
- lineGeometry.addAttribute('position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 0, 0 ], 3 ) );
|
|
|
+ lineGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 0, 0 ], 3 ) );
|
|
|
|
|
|
- var CircleGeometry = function( radius, arc ) {
|
|
|
+ var CircleGeometry = function ( radius, arc ) {
|
|
|
|
|
|
var geometry = new THREE.BufferGeometry( );
|
|
|
var vertices = [];
|
|
|
|
|
|
- for ( var i = 0; i <= 64 * arc; ++i ) {
|
|
|
+ for ( var i = 0; i <= 64 * arc; ++ i ) {
|
|
|
|
|
|
vertices.push( 0, Math.cos( i / 32 * Math.PI ) * radius, Math.sin( i / 32 * Math.PI ) * radius );
|
|
|
|
|
|
}
|
|
|
|
|
|
- geometry.addAttribute('position', new THREE.Float32BufferAttribute( vertices, 3 ) );
|
|
|
+ geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
|
|
|
|
|
|
return geometry;
|
|
|
|
|
@@ -730,11 +758,11 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
// Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
|
|
|
|
|
|
- var TranslateHelperGeometry = function( radius, arc ) {
|
|
|
+ var TranslateHelperGeometry = function () {
|
|
|
|
|
|
- var geometry = new THREE.BufferGeometry()
|
|
|
+ var geometry = new THREE.BufferGeometry();
|
|
|
|
|
|
- geometry.addAttribute('position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
|
|
|
+ geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
|
|
|
|
|
|
return geometry;
|
|
|
|
|
@@ -744,61 +772,61 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
var gizmoTranslate = {
|
|
|
X: [
|
|
|
- [ new THREE.Mesh( arrowGeometry, matRed ), [ 1, 0, 0 ], [ 0, 0, -Math.PI / 2 ], null, 'fwd' ],
|
|
|
+ [ new THREE.Mesh( arrowGeometry, matRed ), [ 1, 0, 0 ], [ 0, 0, - Math.PI / 2 ], null, 'fwd' ],
|
|
|
[ new THREE.Mesh( arrowGeometry, matRed ), [ 1, 0, 0 ], [ 0, 0, Math.PI / 2 ], null, 'bwd' ],
|
|
|
[ new THREE.Line( lineGeometry, matLineRed ) ]
|
|
|
],
|
|
|
Y: [
|
|
|
[ new THREE.Mesh( arrowGeometry, matGreen ), [ 0, 1, 0 ], null, null, 'fwd' ],
|
|
|
[ new THREE.Mesh( arrowGeometry, matGreen ), [ 0, 1, 0 ], [ Math.PI, 0, 0 ], null, 'bwd' ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineGreen ), null, [ 0, 0, Math.PI / 2 ] ]
|
|
|
+ [ new THREE.Line( lineGeometry, matLineGreen ), null, [ 0, 0, Math.PI / 2 ]]
|
|
|
],
|
|
|
Z: [
|
|
|
[ new THREE.Mesh( arrowGeometry, matBlue ), [ 0, 0, 1 ], [ Math.PI / 2, 0, 0 ], null, 'fwd' ],
|
|
|
- [ new THREE.Mesh( arrowGeometry, matBlue ), [ 0, 0, 1 ], [ -Math.PI / 2, 0, 0 ], null, 'bwd' ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineBlue ), null, [ 0, -Math.PI / 2, 0 ] ]
|
|
|
+ [ new THREE.Mesh( arrowGeometry, matBlue ), [ 0, 0, 1 ], [ - Math.PI / 2, 0, 0 ], null, 'bwd' ],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineBlue ), null, [ 0, - Math.PI / 2, 0 ]]
|
|
|
],
|
|
|
XYZ: [
|
|
|
- [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.1, 0 ), matWhiteTransperent ), [ 0, 0, 0 ], [ 0, 0, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.1, 0 ), matWhiteTransperent ), [ 0, 0, 0 ], [ 0, 0, 0 ]]
|
|
|
],
|
|
|
XY: [
|
|
|
- [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matYellowTransparent ), [ 0.15, 0.15, 0 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.18, 0.3, 0 ], null, [ 0.125, 1, 1 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.3, 0.18, 0 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matYellowTransparent ), [ 0.15, 0.15, 0 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.18, 0.3, 0 ], null, [ 0.125, 1, 1 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.3, 0.18, 0 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]]
|
|
|
],
|
|
|
YZ: [
|
|
|
- [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matCyanTransparent ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.18, 0.3 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.3, 0.18 ], [ 0, -Math.PI / 2, 0 ], [ 0.125, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matCyanTransparent ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.18, 0.3 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.3, 0.18 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
|
|
|
],
|
|
|
XZ: [
|
|
|
- [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matMagentaTransparent ), [ 0.15, 0, 0.15 ], [ -Math.PI / 2, 0, 0 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.18, 0, 0.3 ], null, [ 0.125, 1, 1 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.3, 0, 0.18 ], [ 0, -Math.PI / 2, 0 ], [ 0.125, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matMagentaTransparent ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.18, 0, 0.3 ], null, [ 0.125, 1, 1 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.3, 0, 0.18 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
|
|
|
]
|
|
|
};
|
|
|
|
|
|
var pickerTranslate = {
|
|
|
X: [
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0.6, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0.6, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0.6, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0.6, 0 ]]
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ]]
|
|
|
],
|
|
|
XYZ: [
|
|
|
[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.2, 0 ), matInvisible ) ]
|
|
|
],
|
|
|
XY: [
|
|
|
- [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0.2, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0.2, 0 ]]
|
|
|
],
|
|
|
YZ: [
|
|
|
- [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ]]
|
|
|
],
|
|
|
XZ: [
|
|
|
- [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0, 0.2 ], [ -Math.PI / 2, 0, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0, 0.2 ], [ - Math.PI / 2, 0, 0 ]]
|
|
|
]
|
|
|
};
|
|
|
|
|
@@ -813,56 +841,56 @@ THREE.TransformControlsGizmo = function () {
|
|
|
[ new THREE.Line( TranslateHelperGeometry(), matHelper ), null, null, null, 'helper' ]
|
|
|
],
|
|
|
X: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ -1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, -1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, - 1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, 0, -1e3 ], [ 0, -Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, 0, - 1e3 ], [ 0, - Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
]
|
|
|
};
|
|
|
|
|
|
var gizmoRotate = {
|
|
|
X: [
|
|
|
[ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineRed ) ],
|
|
|
- [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matRed ), [ 0, 0, 0.99 ], null, [ 1, 3, 1 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matRed ), [ 0, 0, 0.99 ], null, [ 1, 3, 1 ]],
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineGreen ), null, [ 0, 0, -Math.PI / 2 ] ],
|
|
|
- [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matGreen ), [ 0, 0, 0.99 ], null, [ 3, 1, 1 ] ],
|
|
|
+ [ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineGreen ), null, [ 0, 0, - Math.PI / 2 ]],
|
|
|
+ [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matGreen ), [ 0, 0, 0.99 ], null, [ 3, 1, 1 ]],
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineBlue ), null, [ 0, Math.PI / 2, 0 ] ],
|
|
|
- [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matBlue ), [ 0.99, 0, 0 ], null, [ 1, 3, 1 ] ],
|
|
|
+ [ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineBlue ), null, [ 0, Math.PI / 2, 0 ]],
|
|
|
+ [ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matBlue ), [ 0.99, 0, 0 ], null, [ 1, 3, 1 ]],
|
|
|
],
|
|
|
E: [
|
|
|
- [ new THREE.Line( CircleGeometry( 1.25, 1 ), matLineYellowTransparent ), null, [ 0, Math.PI / 2, 0 ] ],
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 1.17, 0, 0 ], [ 0, 0, -Math.PI / 2 ], [ 1, 1, 0.001 ]],
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ -1.17, 0, 0 ], [ 0, 0, Math.PI / 2 ], [ 1, 1, 0.001 ]],
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, -1.17, 0 ], [ Math.PI, 0, 0 ], [ 1, 1, 0.001 ]],
|
|
|
+ [ new THREE.Line( CircleGeometry( 1.25, 1 ), matLineYellowTransparent ), null, [ 0, Math.PI / 2, 0 ]],
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 1.17, 0, 0 ], [ 0, 0, - Math.PI / 2 ], [ 1, 1, 0.001 ]],
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ - 1.17, 0, 0 ], [ 0, 0, Math.PI / 2 ], [ 1, 1, 0.001 ]],
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, - 1.17, 0 ], [ Math.PI, 0, 0 ], [ 1, 1, 0.001 ]],
|
|
|
[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, 1.17, 0 ], [ 0, 0, 0 ], [ 1, 1, 0.001 ]],
|
|
|
],
|
|
|
XYZE: [
|
|
|
- [ new THREE.Line( CircleGeometry( 1, 1 ), matLineGray ), null, [ 0, Math.PI / 2, 0 ] ]
|
|
|
+ [ new THREE.Line( CircleGeometry( 1, 1 ), matLineGray ), null, [ 0, Math.PI / 2, 0 ]]
|
|
|
]
|
|
|
};
|
|
|
|
|
|
var helperRotate = {
|
|
|
AXIS: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ -1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]
|
|
|
]
|
|
|
};
|
|
|
|
|
|
var pickerRotate = {
|
|
|
X: [
|
|
|
- [ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, -Math.PI / 2, -Math.PI / 2 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]],
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]],
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]],
|
|
|
],
|
|
|
E: [
|
|
|
[ new THREE.Mesh( new THREE.TorusBufferGeometry( 1.25, 0.1, 2, 24 ), matInvisible ) ]
|
|
@@ -874,88 +902,88 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
var gizmoScale = {
|
|
|
X: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matRed ), [ 0.8, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineRed ), null, null, [ 0.8, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matRed ), [ 0.8, 0, 0 ], [ 0, 0, - Math.PI / 2 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineRed ), null, null, [ 0.8, 1, 1 ]]
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matGreen ), [ 0, 0.8, 0 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineGreen ), null, [ 0, 0, Math.PI / 2 ], [ 0.8, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matGreen ), [ 0, 0.8, 0 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineGreen ), null, [ 0, 0, Math.PI / 2 ], [ 0.8, 1, 1 ]]
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matBlue ), [ 0, 0, 0.8 ], [ Math.PI / 2, 0, 0 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineBlue ), null, [ 0, -Math.PI / 2, 0 ], [ 0.8, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matBlue ), [ 0, 0, 0.8 ], [ Math.PI / 2, 0, 0 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineBlue ), null, [ 0, - Math.PI / 2, 0 ], [ 0.8, 1, 1 ]]
|
|
|
],
|
|
|
XY: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matYellowTransparent ), [ 0.85, 0.85, 0 ], null, [ 2, 2, 0.2 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.855, 0.98, 0 ], null, [ 0.125, 1, 1 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.98, 0.855, 0 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matYellowTransparent ), [ 0.85, 0.85, 0 ], null, [ 2, 2, 0.2 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.855, 0.98, 0 ], null, [ 0.125, 1, 1 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineYellow ), [ 0.98, 0.855, 0 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]]
|
|
|
],
|
|
|
YZ: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matCyanTransparent ), [ 0, 0.85, 0.85 ], null, [ 0.2, 2, 2 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.855, 0.98 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.98, 0.855 ], [ 0, -Math.PI / 2, 0 ], [ 0.125, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matCyanTransparent ), [ 0, 0.85, 0.85 ], null, [ 0.2, 2, 2 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.855, 0.98 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.98, 0.855 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
|
|
|
],
|
|
|
XZ: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matMagentaTransparent ), [ 0.85, 0, 0.85 ], null, [ 2, 0.2, 2 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.855, 0, 0.98 ], null, [ 0.125, 1, 1 ] ],
|
|
|
- [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.98, 0, 0.855 ], [ 0, -Math.PI / 2, 0 ], [ 0.125, 1, 1 ] ]
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matMagentaTransparent ), [ 0.85, 0, 0.85 ], null, [ 2, 0.2, 2 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.855, 0, 0.98 ], null, [ 0.125, 1, 1 ]],
|
|
|
+ [ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.98, 0, 0.855 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
|
|
|
],
|
|
|
XYZX: [
|
|
|
- [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransperent ), [ 1.1, 0, 0 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransperent ), [ 1.1, 0, 0 ]],
|
|
|
],
|
|
|
XYZY: [
|
|
|
- [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransperent ), [ 0, 1.1, 0 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransperent ), [ 0, 1.1, 0 ]],
|
|
|
],
|
|
|
XYZZ: [
|
|
|
- [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransperent ), [ 0, 0, 1.1 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransperent ), [ 0, 0, 1.1 ]],
|
|
|
]
|
|
|
};
|
|
|
|
|
|
var pickerScale = {
|
|
|
X: [
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0.5, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0.5, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0.5, 0 ]]
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ] ]
|
|
|
+ [ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]]
|
|
|
],
|
|
|
XY: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0.85, 0 ], null, [ 3, 3, 0.2 ] ],
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0.85, 0 ], null, [ 3, 3, 0.2 ]],
|
|
|
],
|
|
|
YZ: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0, 0.85, 0.85 ], null, [ 0.2, 3, 3 ] ],
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0, 0.85, 0.85 ], null, [ 0.2, 3, 3 ]],
|
|
|
],
|
|
|
XZ: [
|
|
|
- [ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0, 0.85 ], null, [ 3, 0.2, 3 ] ],
|
|
|
+ [ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0, 0.85 ], null, [ 3, 0.2, 3 ]],
|
|
|
],
|
|
|
XYZX: [
|
|
|
- [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 1.1, 0, 0 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 1.1, 0, 0 ]],
|
|
|
],
|
|
|
XYZY: [
|
|
|
- [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 1.1, 0 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 1.1, 0 ]],
|
|
|
],
|
|
|
XYZZ: [
|
|
|
- [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 1.1 ] ],
|
|
|
+ [ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 1.1 ]],
|
|
|
]
|
|
|
};
|
|
|
|
|
|
var helperScale = {
|
|
|
X: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ -1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ]
|
|
|
],
|
|
|
Y: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, -1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, - 1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
],
|
|
|
Z: [
|
|
|
- [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, 0, -1e3 ], [ 0, -Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
+ [ new THREE.Line( lineGeometry, matHelper.clone() ), [ 0, 0, - 1e3 ], [ 0, - Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ]
|
|
|
]
|
|
|
};
|
|
|
|
|
|
// Creates an Object3D with gizmos described in custom hierarchy definition.
|
|
|
|
|
|
- var setupGizmo = function( gizmoMap ) {
|
|
|
+ var setupGizmo = function ( gizmoMap ) {
|
|
|
|
|
|
var gizmo = new THREE.Object3D();
|
|
|
|
|
@@ -973,28 +1001,34 @@ THREE.TransformControlsGizmo = function () {
|
|
|
object.name = name;
|
|
|
object.tag = tag;
|
|
|
|
|
|
- if (position) {
|
|
|
- object.position.set(position[ 0 ], position[ 1 ], position[ 2 ]);
|
|
|
+ if ( position ) {
|
|
|
+
|
|
|
+ object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] );
|
|
|
+
|
|
|
}
|
|
|
- if (rotation) {
|
|
|
- object.rotation.set(rotation[ 0 ], rotation[ 1 ], rotation[ 2 ]);
|
|
|
+ if ( rotation ) {
|
|
|
+
|
|
|
+ object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] );
|
|
|
+
|
|
|
}
|
|
|
- if (scale) {
|
|
|
- object.scale.set(scale[ 0 ], scale[ 1 ], scale[ 2 ]);
|
|
|
+ if ( scale ) {
|
|
|
+
|
|
|
+ object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
object.updateMatrix();
|
|
|
|
|
|
var tempGeometry = object.geometry.clone();
|
|
|
- tempGeometry.applyMatrix(object.matrix);
|
|
|
+ tempGeometry.applyMatrix( object.matrix );
|
|
|
object.geometry = tempGeometry;
|
|
|
object.renderOrder = Infinity;
|
|
|
|
|
|
object.position.set( 0, 0, 0 );
|
|
|
object.rotation.set( 0, 0, 0 );
|
|
|
- object.scale.set(1, 1, 1);
|
|
|
+ object.scale.set( 1, 1, 1 );
|
|
|
|
|
|
- gizmo.add(object);
|
|
|
+ gizmo.add( object );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1067,9 +1101,9 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handles = handles.concat( this.gizmo[ this.mode ].children );
|
|
|
handles = handles.concat( this.helper[ this.mode ].children );
|
|
|
|
|
|
- for ( var i = 0; i < handles.length; i++ ) {
|
|
|
+ for ( var i = 0; i < handles.length; i ++ ) {
|
|
|
|
|
|
- var handle = handles[i];
|
|
|
+ var handle = handles[ i ];
|
|
|
|
|
|
// hide aligned to camera
|
|
|
|
|
@@ -1077,7 +1111,7 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handle.rotation.set( 0, 0, 0 );
|
|
|
handle.position.copy( this.worldPosition );
|
|
|
|
|
|
- var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition);
|
|
|
+ var eyeDistance = this.worldPosition.distanceTo( this.cameraPosition );
|
|
|
handle.scale.set( 1, 1, 1 ).multiplyScalar( eyeDistance * this.size / 7 );
|
|
|
|
|
|
// TODO: simplify helpers and consider decoupling from gizmo
|
|
@@ -1089,7 +1123,7 @@ THREE.TransformControlsGizmo = function () {
|
|
|
if ( handle.name === 'AXIS' ) {
|
|
|
|
|
|
handle.position.copy( this.worldPositionStart );
|
|
|
- handle.visible = !!this.axis;
|
|
|
+ handle.visible = !! this.axis;
|
|
|
|
|
|
if ( this.axis === 'X' ) {
|
|
|
|
|
@@ -1097,7 +1131,9 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handle.quaternion.copy( quaternion ).multiply( tempQuaternion );
|
|
|
|
|
|
if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1108,7 +1144,9 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handle.quaternion.copy( quaternion ).multiply( tempQuaternion );
|
|
|
|
|
|
if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1119,7 +1157,9 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handle.quaternion.copy( quaternion ).multiply( tempQuaternion );
|
|
|
|
|
|
if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1155,7 +1195,7 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
handle.position.copy( this.worldPositionStart );
|
|
|
handle.quaternion.copy( this.worldQuaternionStart );
|
|
|
- tempVector.set( 1e-10, 1e-10, 1e-10 ).add( this.worldPositionStart ).sub( this.worldPosition ).multiplyScalar( -1 );
|
|
|
+ tempVector.set( 1e-10, 1e-10, 1e-10 ).add( this.worldPositionStart ).sub( this.worldPosition ).multiplyScalar( - 1 );
|
|
|
tempVector.applyQuaternion( this.worldQuaternionStart.clone().inverse() );
|
|
|
handle.scale.copy( tempVector );
|
|
|
handle.visible = this.dragging;
|
|
@@ -1176,7 +1216,7 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
if ( this.axis ) {
|
|
|
|
|
|
- handle.visible = this.axis.search( handle.name ) !== -1;
|
|
|
+ handle.visible = this.axis.search( handle.name ) !== - 1;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1201,78 +1241,132 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
|
|
|
if ( handle.name === 'X' || handle.name === 'XYZX' ) {
|
|
|
+
|
|
|
if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
|
|
|
+
|
|
|
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
if ( handle.name === 'Y' || handle.name === 'XYZY' ) {
|
|
|
+
|
|
|
if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
|
|
|
+
|
|
|
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
if ( handle.name === 'Z' || handle.name === 'XYZZ' ) {
|
|
|
+
|
|
|
if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
|
|
|
+
|
|
|
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
if ( handle.name === 'XY' ) {
|
|
|
+
|
|
|
if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
|
|
|
+
|
|
|
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
if ( handle.name === 'YZ' ) {
|
|
|
+
|
|
|
if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
|
|
|
+
|
|
|
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
if ( handle.name === 'XZ' ) {
|
|
|
+
|
|
|
if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
|
|
|
+
|
|
|
handle.scale.set( 1e-10, 1e-10, 1e-10 );
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// Flip translate and scale axis ocluded behind another axis
|
|
|
|
|
|
- if ( handle.name.search( 'X' ) !== -1 ) {
|
|
|
+ if ( handle.name.search( 'X' ) !== - 1 ) {
|
|
|
+
|
|
|
if ( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) < AXIS_FLIP_TRESHOLD ) {
|
|
|
+
|
|
|
if ( handle.tag === 'fwd' ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
} else {
|
|
|
- handle.scale.x *= -1;
|
|
|
+
|
|
|
+ handle.scale.x *= - 1;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
} else if ( handle.tag === 'bwd' ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( handle.name.search( 'Y' ) !== -1 ) {
|
|
|
+ if ( handle.name.search( 'Y' ) !== - 1 ) {
|
|
|
+
|
|
|
if ( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) < AXIS_FLIP_TRESHOLD ) {
|
|
|
+
|
|
|
if ( handle.tag === 'fwd' ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
} else {
|
|
|
- handle.scale.y *= -1;
|
|
|
+
|
|
|
+ handle.scale.y *= - 1;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
} else if ( handle.tag === 'bwd' ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if ( handle.name.search( 'Z' ) !== -1 ) {
|
|
|
+ if ( handle.name.search( 'Z' ) !== - 1 ) {
|
|
|
+
|
|
|
if ( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) < AXIS_FLIP_TRESHOLD ) {
|
|
|
+
|
|
|
if ( handle.tag === 'fwd' ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
} else {
|
|
|
- handle.scale.z *= -1;
|
|
|
+
|
|
|
+ handle.scale.z *= - 1;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
} else if ( handle.tag === 'bwd' ) {
|
|
|
+
|
|
|
handle.visible = false;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
} else if ( this.mode === 'rotate' ) {
|
|
@@ -1290,7 +1384,7 @@ THREE.TransformControlsGizmo = function () {
|
|
|
|
|
|
if ( handle.name === 'X' ) {
|
|
|
|
|
|
- tempQuaternion.setFromAxisAngle( unitX, Math.atan2( -alignVector.y, alignVector.z ) );
|
|
|
+ tempQuaternion.setFromAxisAngle( unitX, Math.atan2( - alignVector.y, alignVector.z ) );
|
|
|
tempQuaternion.multiplyQuaternions( tempQuaternion2, tempQuaternion );
|
|
|
handle.quaternion.copy( tempQuaternion );
|
|
|
|
|
@@ -1315,10 +1409,10 @@ THREE.TransformControlsGizmo = function () {
|
|
|
}
|
|
|
|
|
|
// Hide disabled axes
|
|
|
- handle.visible = handle.visible && ( handle.name.indexOf( "X" ) === -1 || this.showX );
|
|
|
- handle.visible = handle.visible && ( handle.name.indexOf( "Y" ) === -1 || this.showY );
|
|
|
- handle.visible = handle.visible && ( handle.name.indexOf( "Z" ) === -1 || this.showZ );
|
|
|
- handle.visible = handle.visible && ( handle.name.indexOf( "E" ) === -1 || ( this.showX && this.showY && this.showZ ) );
|
|
|
+ handle.visible = handle.visible && ( handle.name.indexOf( "X" ) === - 1 || this.showX );
|
|
|
+ handle.visible = handle.visible && ( handle.name.indexOf( "Y" ) === - 1 || this.showY );
|
|
|
+ handle.visible = handle.visible && ( handle.name.indexOf( "Z" ) === - 1 || this.showZ );
|
|
|
+ handle.visible = handle.visible && ( handle.name.indexOf( "E" ) === - 1 || ( this.showX && this.showY && this.showZ ) );
|
|
|
|
|
|
// highlight selected axis
|
|
|
|
|
@@ -1328,7 +1422,7 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handle.material.color.copy( handle.material._color );
|
|
|
handle.material.opacity = handle.material._opacity;
|
|
|
|
|
|
- if ( !this.enabled ) {
|
|
|
+ if ( ! this.enabled ) {
|
|
|
|
|
|
handle.material.opacity *= 0.5;
|
|
|
handle.material.color.lerp( new THREE.Color( 1, 1, 1 ), 0.5 );
|
|
@@ -1340,7 +1434,11 @@ THREE.TransformControlsGizmo = function () {
|
|
|
handle.material.opacity = 1.0;
|
|
|
handle.material.color.lerp( new THREE.Color( 1, 1, 1 ), 0.5 );
|
|
|
|
|
|
- } else if ( this.axis.split('').some( function( a ) { return handle.name === a; } ) ) {
|
|
|
+ } else if ( this.axis.split( '' ).some( function ( a ) {
|
|
|
+
|
|
|
+ return handle.name === a;
|
|
|
+
|
|
|
+ } ) ) {
|
|
|
|
|
|
handle.material.opacity = 1.0;
|
|
|
handle.material.color.lerp( new THREE.Color( 1, 1, 1 ), 0.5 );
|
|
@@ -1392,7 +1490,7 @@ THREE.TransformControlsPlane = function () {
|
|
|
var tempMatrix = new THREE.Matrix4();
|
|
|
var identityQuaternion = new THREE.Quaternion();
|
|
|
|
|
|
- this.updateMatrixWorld = function() {
|
|
|
+ this.updateMatrixWorld = function () {
|
|
|
|
|
|
var space = this.space;
|
|
|
|
|
@@ -1409,9 +1507,11 @@ THREE.TransformControlsPlane = function () {
|
|
|
alignVector.copy( unitY );
|
|
|
|
|
|
switch ( this.mode ) {
|
|
|
+
|
|
|
case 'translate':
|
|
|
case 'scale':
|
|
|
switch ( this.axis ) {
|
|
|
+
|
|
|
case 'X':
|
|
|
alignVector.copy( this.eye ).cross( unitX );
|
|
|
dirVector.copy( unitX ).cross( alignVector );
|
|
@@ -1438,12 +1538,14 @@ THREE.TransformControlsPlane = function () {
|
|
|
case 'E':
|
|
|
dirVector.set( 0, 0, 0 );
|
|
|
break;
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case 'rotate':
|
|
|
default:
|
|
|
// special case for rotate
|
|
|
dirVector.set( 0, 0, 0 );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if ( dirVector.length() === 0 ) {
|