Skip to content

Commit 9a74771

Browse files
committed
Updated examples builds.
1 parent 793dbff commit 9a74771

File tree

5 files changed

+228
-243
lines changed

5 files changed

+228
-243
lines changed

examples/js/animation/MMDPhysics.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,6 @@
12231223

12241224
}
12251225

1226-
12271226
function createCapsuleGeometry( radius, cylinderHeight, segmentsRadius, segmentsHeight ) {
12281227

12291228
var geometry = new THREE.CylinderGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );

examples/js/controls/ArcballControls.js

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
const _raycaster = new THREE.Raycaster();
4545

4646
const _offset = new THREE.Vector3();
47+
48+
const _gizmoMatrixStateTemp = new THREE.Matrix4();
49+
50+
const _cameraMatrixStateTemp = new THREE.Matrix4();
51+
52+
const _scalePointTemp = new THREE.Vector3();
4753
/**
4854
*
4955
* @param {Camera} camera Virtual camera used in the scene
@@ -567,28 +573,6 @@
567573

568574
};
569575

570-
this.onKeyDown = event => {
571-
572-
if ( event.key == 'c' ) {
573-
574-
if ( event.ctrlKey || event.metaKey ) {
575-
576-
this.copyState();
577-
578-
}
579-
580-
} else if ( event.key == 'v' ) {
581-
582-
if ( event.ctrlKey || event.metaKey ) {
583-
584-
this.pasteState();
585-
586-
}
587-
588-
}
589-
590-
};
591-
592576
this.onSinglePanStart = ( event, operation ) => {
593577

594578
if ( this.enabled ) {
@@ -1621,13 +1605,13 @@
16211605

16221606
this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z );
16231607

1624-
const gizmoStateTemp = this._gizmoMatrixState.clone();
1608+
_gizmoMatrixStateTemp.copy( this._gizmoMatrixState );
16251609

16261610
this._gizmoMatrixState.premultiply( this._translationMatrix );
16271611

16281612
this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
16291613

1630-
const cameraStateTemp = this._cameraMatrixState.clone();
1614+
_cameraMatrixStateTemp.copy( this._cameraMatrixState );
16311615

16321616
this._cameraMatrixState.premultiply( this._translationMatrix );
16331617

@@ -1640,9 +1624,9 @@
16401624

16411625
}
16421626

1643-
this._gizmoMatrixState.copy( gizmoStateTemp );
1627+
this._gizmoMatrixState.copy( _gizmoMatrixStateTemp );
16441628

1645-
this._cameraMatrixState.copy( cameraStateTemp );
1629+
this._cameraMatrixState.copy( _cameraMatrixStateTemp );
16461630

16471631
};
16481632

@@ -2163,7 +2147,8 @@
21632147

21642148
this.scale = ( size, point, scaleGizmos = true ) => {
21652149

2166-
const scalePoint = point.clone();
2150+
_scalePointTemp.copy( point );
2151+
21672152
let sizeInverse = 1 / size;
21682153

21692154
if ( this.camera.isOrthographicCamera ) {
@@ -2199,11 +2184,13 @@
21992184
this._m4_2.multiply( this._translationMatrix ); //move camera and gizmos to obtain pinch effect
22002185

22012186

2202-
scalePoint.sub( this._v3_1 );
2203-
const amount = scalePoint.clone().multiplyScalar( sizeInverse );
2204-
scalePoint.sub( amount );
2187+
_scalePointTemp.sub( this._v3_1 );
2188+
2189+
const amount = _scalePointTemp.clone().multiplyScalar( sizeInverse );
2190+
2191+
_scalePointTemp.sub( amount );
22052192

2206-
this._m4_1.makeTranslation( scalePoint.x, scalePoint.y, scalePoint.z );
2193+
this._m4_1.makeTranslation( _scalePointTemp.x, _scalePointTemp.y, _scalePointTemp.z );
22072194

22082195
this._m4_2.premultiply( this._m4_1 );
22092196

@@ -2217,7 +2204,7 @@
22172204
this._v3_2.setFromMatrixPosition( this._gizmoMatrixState ); //move camera
22182205

22192206

2220-
let distance = this._v3_1.distanceTo( scalePoint );
2207+
let distance = this._v3_1.distanceTo( _scalePointTemp );
22212208

22222209
let amount = distance - distance * sizeInverse; //check min and max distance
22232210

@@ -2235,18 +2222,18 @@
22352222

22362223
}
22372224

2238-
_offset.copy( scalePoint ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
2225+
_offset.copy( _scalePointTemp ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
22392226

22402227
this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
22412228

22422229
if ( scaleGizmos ) {
22432230

22442231
//scale gizmos so they appear in the same spot having the same dimension
22452232
const pos = this._v3_2;
2246-
distance = pos.distanceTo( scalePoint );
2233+
distance = pos.distanceTo( _scalePointTemp );
22472234
amount = distance - distance * sizeInverse;
22482235

2249-
_offset.copy( scalePoint ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
2236+
_offset.copy( _scalePointTemp ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
22502237

22512238
this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z );
22522239

@@ -2827,7 +2814,6 @@
28272814
this.domElement.addEventListener( 'wheel', this.onWheel );
28282815
this.domElement.addEventListener( 'pointerdown', this.onPointerDown );
28292816
this.domElement.addEventListener( 'pointercancel', this.onPointerCancel );
2830-
window.addEventListener( 'keydown', this.onKeyDown );
28312817
window.addEventListener( 'resize', this.onWindowResize );
28322818

28332819
} //listeners

0 commit comments

Comments
 (0)