function scaleOneAxisOnMove() { point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix)); if (scope.axis === 'X') { scope.object.scale.x = oldScale.x * (1 + point.x / oldScale.x); } if (scope.axis === 'Y') { scope.object.scale.y = oldScale.y * (1 + point.y / oldScale.y); } if (scope.axis === 'Z') { scope.object.scale.z = oldScale.z * (1 + point.z / oldScale.z); } }
function scaleOnMove() { scale = endTouchData.distance / startTouchData.distance; scope.object.scale.x = oldScale.x * scale; scope.object.scale.y = oldScale.y * scale; scope.object.scale.z = oldScale.z * scale; }
function handleVertex(v) { n.fromArray(normals, v * 3); n2.copy(n); t = tan1[v]; // Gram-Schmidt orthogonalize tmp.copy(t); tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness tmp2.crossVectors(n2, t); test = tmp2.dot(tan2[v]); w = test < 0.0 ? -1.0 : 1.0; tangents[v * 4] = tmp.x; tangents[v * 4 + 1] = tmp.y; tangents[v * 4 + 2] = tmp.z; tangents[v * 4 + 3] = w; }
function rotateEAxis() { point.applyMatrix4(tempMatrix.getInverse(lookAtMatrix)); tempVector.applyMatrix4(tempMatrix.getInverse(lookAtMatrix)); rotation.set( Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x) ); offsetRotation.set( Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x) ); tempQuaternion.setFromRotationMatrix( tempMatrix.getInverse(parentRotationMatrix) ); quaternionE.setFromAxisAngle(eye, offsetRotation.z - rotation.z); quaternionXYZ.setFromRotationMatrix(worldRotationMatrix); tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionE); tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ); scope.object.quaternion.copy(tempQuaternion); }
function rotateWorldSpace() { rotation.set( Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x) ); offsetRotation.set( Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x) ); unitZ, Math.round( (rotation.z - offsetRotation.z) / scope.rotationSnap ) * scope.rotationSnap ); quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x); quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y); quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);
Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x) ); offsetRotation.set( Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x) ); unitZ, Math.round( (rotation.z - offsetRotation.z) / scope.rotationSnap ) * scope.rotationSnap ); quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x); quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y); quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);