Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions editor/js/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Editor.prototype = {
const light = object;
const editor = this;

helper.updateMatrixWorld = function () {
helper.ensureMatrices = function () {

light.getWorldPosition( this.position );

Expand All @@ -424,7 +424,7 @@ Editor.prototype = {

for ( let i = 0, l = children.length; i < l; i ++ ) {

children[ i ].updateMatrixWorld();
children[ i ].ensureMatrices();

}

Expand Down
2 changes: 1 addition & 1 deletion editor/js/Menubar.Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class RenderImageDialog {
const camera = await loader.parseAsync( json.camera );
camera.aspect = imageWidth.getValue() / imageHeight.getValue();
camera.updateProjectionMatrix();
camera.updateMatrixWorld();
camera.ensureMatrices();

const scene = await loader.parseAsync( json.scene );

Expand Down
4 changes: 2 additions & 2 deletions editor/js/commands/SetPositionCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class SetPositionCommand extends Command {
execute() {

this.object.position.copy( this.newPosition );
this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );
this.editor.signals.objectChanged.dispatch( this.object );

}

undo() {

this.object.position.copy( this.oldPosition );
this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );
this.editor.signals.objectChanged.dispatch( this.object );

}
Expand Down
4 changes: 2 additions & 2 deletions editor/js/commands/SetRotationCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class SetRotationCommand extends Command {
execute() {

this.object.rotation.copy( this.newRotation );
this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );
this.editor.signals.objectChanged.dispatch( this.object );

}

undo() {

this.object.rotation.copy( this.oldRotation );
this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );
this.editor.signals.objectChanged.dispatch( this.object );

}
Expand Down
4 changes: 2 additions & 2 deletions editor/js/commands/SetScaleCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class SetScaleCommand extends Command {
execute() {

this.object.scale.copy( this.newScale );
this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );
this.editor.signals.objectChanged.dispatch( this.object );

}

undo() {

this.object.scale.copy( this.oldScale );
this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );
this.editor.signals.objectChanged.dispatch( this.object );

}
Expand Down
12 changes: 6 additions & 6 deletions examples/jsm/animation/CCDIKSolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class CCDIKSolver {
const target = bones[ ik.target ];

// don't use getWorldPosition() here for the performance
// because it calls updateMatrixWorld( true ) inside.
// because it calls updateWorldMatrix( true ) inside.
_targetPos.setFromMatrixPosition( target.matrixWorld );

const links = ik.links;
Expand Down Expand Up @@ -148,7 +148,7 @@ class CCDIKSolver {
const rotationMax = links[ j ].rotationMax;

// don't use getWorldPosition/Quaternion() here for the performance
// because they call updateMatrixWorld( true ) inside.
// because they call updateWorldMatrix( true ) inside.
link.matrixWorld.decompose( _linkPos, _invLinkQ, _linkScale );
_invLinkQ.invert();
_effectorPos.setFromMatrixPosition( effector.matrixWorld );
Expand Down Expand Up @@ -224,7 +224,7 @@ class CCDIKSolver {

}

link.updateMatrixWorld( true );
link.ensureMatrices( true );

rotated = true;

Expand All @@ -244,7 +244,7 @@ class CCDIKSolver {
this._workingQuaternion.copy( initialQuaternions[ j ] ).slerp( link.quaternion, chainBlend );

link.quaternion.copy( this._workingQuaternion );
link.updateMatrixWorld( true );
link.ensureMatrices( true );

}

Expand Down Expand Up @@ -413,7 +413,7 @@ class CCDIKHelper extends Object3D {

}

updateMatrixWorld( force ) {
updateMatrixWorld() {

const mesh = this.root;

Expand Down Expand Up @@ -472,7 +472,7 @@ class CCDIKHelper extends Object3D {

this.matrix.copy( mesh.matrixWorld );

super.updateMatrixWorld( force );
super.updateMatrixWorld();

}

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/controls/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class OrbitControls extends Controls {

const radiusDelta = prevRadius - newRadius;
this.object.position.addScaledVector( this._dollyDirection, radiusDelta );
this.object.updateMatrixWorld();
this.object.ensureMatrices();

zoomChanged = !! radiusDelta;

Expand All @@ -805,7 +805,7 @@ class OrbitControls extends Controls {
mouseAfter.unproject( this.object );

this.object.position.sub( mouseAfter ).add( mouseBefore );
this.object.updateMatrixWorld();
this.object.ensureMatrices();

newRadius = _v.length();

Expand Down
20 changes: 10 additions & 10 deletions examples/jsm/controls/TransformControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ class TransformControls extends Controls {

if ( planeIntersect ) {

this.object.updateMatrixWorld();
this.object.parent.updateMatrixWorld();
this.object.ensureMatrices();
this.object.parent.ensureMatrices();

this._positionStart.copy( this.object.position );
this._quaternionStart.copy( this.object.quaternion );
Expand Down Expand Up @@ -1055,13 +1055,13 @@ class TransformControlsRoot extends Object3D {
}

// updateMatrixWorld updates key transformation variables
updateMatrixWorld( force ) {
updateMatrixWorld() {

const controls = this.controls;

if ( controls.object !== undefined ) {

controls.object.updateMatrixWorld();
controls.object.ensureMatrices();

if ( controls.object.parent === null ) {

Expand All @@ -1080,7 +1080,7 @@ class TransformControlsRoot extends Object3D {

}

controls.camera.updateMatrixWorld();
controls.camera.ensureMatrices();
controls.camera.matrixWorld.decompose( controls.cameraPosition, controls.cameraQuaternion, controls._cameraScale );

if ( controls.camera.isOrthographicCamera ) {
Expand All @@ -1093,7 +1093,7 @@ class TransformControlsRoot extends Object3D {

}

super.updateMatrixWorld( force );
super.updateMatrixWorld();

}

Expand Down Expand Up @@ -1504,7 +1504,7 @@ class TransformControlsGizmo extends Object3D {

// updateMatrixWorld will update transformations and appearance of individual handles

updateMatrixWorld( force ) {
updateMatrixWorld() {

const space = ( this.mode === 'scale' ) ? 'local' : this.space; // scale always oriented to local rotation

Expand Down Expand Up @@ -1814,7 +1814,7 @@ class TransformControlsGizmo extends Object3D {

}

super.updateMatrixWorld( force );
super.updateMatrixWorld();

}

Expand All @@ -1837,7 +1837,7 @@ class TransformControlsPlane extends Mesh {

}

updateMatrixWorld( force ) {
updateMatrixWorld() {

let space = this.space;

Expand Down Expand Up @@ -1909,7 +1909,7 @@ class TransformControlsPlane extends Mesh {

}

super.updateMatrixWorld( force );
super.updateMatrixWorld();

}

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/csm/CSMHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class CSMHelper extends Group {
this.position.copy( camera.position );
this.quaternion.copy( camera.quaternion );
this.scale.copy( camera.scale );
this.updateMatrixWorld( true );
this.ensureMatrices( true );

while ( cascadeLines.length > cascades ) {

Expand Down Expand Up @@ -181,7 +181,7 @@ class CSMHelper extends Group {
shadowLineGroup.position.copy( shadowCam.position );
shadowLineGroup.quaternion.copy( shadowCam.quaternion );
shadowLineGroup.scale.copy( shadowCam.scale );
shadowLineGroup.updateMatrixWorld( true );
shadowLineGroup.ensureMatrices( true );
this.attach( shadowLineGroup );

shadowLine.box.min.set( shadowCam.bottom, shadowCam.left, - shadowCam.far );
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/effects/AnaglyphEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ class AnaglyphEffect {

const currentRenderTarget = renderer.getRenderTarget();

if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
if ( scene.matrixWorldAutoUpdate === true ) scene.ensureMatrices();

if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.ensureMatrices();

// Get the camera's local coordinate axes from its world matrix
camera.matrixWorld.extractBasis( _right, _up, _forward );
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/effects/ParallaxBarrierEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class ParallaxBarrierEffect {

const currentRenderTarget = renderer.getRenderTarget();

if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
if ( scene.matrixWorldAutoUpdate === true ) scene.ensureMatrices();

if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.ensureMatrices();

_stereo.update( camera );

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/effects/StereoEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class StereoEffect {
*/
this.render = function ( scene, camera ) {

if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
if ( scene.matrixWorldAutoUpdate === true ) scene.ensureMatrices();

if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.ensureMatrices();

_stereo.update( camera );

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/helpers/VertexNormalsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class VertexNormalsHelper extends LineSegments {
*/
update() {

this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );

_normalMatrix.getNormalMatrix( this.object.matrixWorld );

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/helpers/VertexTangentsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class VertexTangentsHelper extends LineSegments {
*/
update() {

this.object.updateMatrixWorld( true );
this.object.ensureMatrices( true );

const matrixWorld = this.object.matrixWorld;

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/helpers/ViewHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ViewHelper extends Object3D {
this.render = function ( renderer ) {

this.quaternion.copy( camera.quaternion ).invert();
this.updateMatrixWorld();
this.ensureMatrices();

point.set( 0, 0, 1 );
point.applyQuaternion( camera.quaternion );
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/interactive/SelectionBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class SelectionBox {
}

this.camera.updateProjectionMatrix();
this.camera.updateMatrixWorld();
this.camera.ensureMatrices();

if ( this.camera.isPerspectiveCamera ) {

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ class GLTFParser {

for ( const scene of result.scenes ) {

scene.updateMatrixWorld();
scene.ensureMatrices();

}

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/math/ConvexHull.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ConvexHull {

const points = [];

object.updateMatrixWorld( true );
object.ensureMatrices( true );

object.traverse( function ( node ) {

Expand Down
37 changes: 8 additions & 29 deletions examples/jsm/misc/Gyroscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,21 @@ class Gyroscope extends Object3D {

}

updateMatrixWorld( force ) {
updateMatrixWorld() {

this.matrixAutoUpdate && this.updateMatrix();
if ( this.parent !== null ) {

// update matrixWorld
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );

if ( this.matrixWorldNeedsUpdate || force ) {
this.matrixWorld.decompose( _translationWorld, _quaternionWorld, _scaleWorld );
this.matrix.decompose( _translationObject, _quaternionObject, _scaleObject );

if ( this.parent !== null ) {
this.matrixWorld.compose( _translationWorld, _quaternionObject, _scaleWorld );

this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );

this.matrixWorld.decompose( _translationWorld, _quaternionWorld, _scaleWorld );
this.matrix.decompose( _translationObject, _quaternionObject, _scaleObject );
} else {

this.matrixWorld.compose( _translationWorld, _quaternionObject, _scaleWorld );


} else {

this.matrixWorld.copy( this.matrix );

}


this.matrixWorldNeedsUpdate = false;

force = true;

}

// update children

for ( let i = 0, l = this.children.length; i < l; i ++ ) {

this.children[ i ].updateMatrixWorld( force );
this.matrixWorld.copy( this.matrix );

}

Expand Down
Loading