Browse Source

Object3D: Updated static class properties to ALL_CAPS (#25188)

* Updated static class properties to ALL_CAPS
WestLangley 2 years ago
parent
commit
b1c7e14e12

+ 5 - 5
docs/api/en/core/Object3D.html

@@ -75,7 +75,7 @@
 		<h3>[property:Boolean matrixAutoUpdate]</h3>
 		<p>
 		When this is set, it calculates the matrix of position, (rotation or quaternion) and
-		scale every frame and also recalculates the matrixWorld property. Default is [page:Object3D.DefaultMatrixAutoUpdate] (true).
+		scale every frame and also recalculates the matrixWorld property. Default is [page:Object3D.DEFAULT_MATRIX_AUTO_UPDATE] (true).
 		</p>
 
 		<h3>[property:Matrix4 matrixWorld]</h3>
@@ -169,7 +169,7 @@
 		<h3>[property:Vector3 up]</h3>
 		<p>
 		This is used by the [page:.lookAt lookAt] method, for example, to determine the orientation of the result.<br />
-		Default is [page:Object3D.DefaultUp] - that is, `( 0, 1, 0 )`.
+		Default is [page:Object3D.DEFAULT_UP] - that is, `( 0, 1, 0 )`.
 		</p>
 
 		<h3>[property:Object userData]</h3>
@@ -193,20 +193,20 @@
 		<h2>Static Properties</h2>
 		<p>
 			Static properties and methods are defined per class rather than per instance of that class.
-			This means that changing [page:Object3D.DefaultUp] or [page:Object3D.DefaultMatrixAutoUpdate]
+			This means that changing [page:Object3D.DEFAULT_UP] or [page:Object3D.DEFAULT_MATRIX_AUTO_UPDATE]
 			will change the values of [page:.up up] and [page:.matrixAutoUpdate matrixAutoUpdate] for
 			`every`	instance of Object3D (or derived classes)	created after the change has
 			been made (already created Object3Ds will not be affected).
 		</p>
 
-		<h3>[property:Vector3 DefaultUp]</h3>
+		<h3>[property:Vector3 DEFAULT_UP]</h3>
 		<p>
 			The default [page:.up up] direction for objects, also used as the default position for [page:DirectionalLight],
 			[page:HemisphereLight] and [page:Spotlight] (which creates lights shining from the top down).<br />
 			Set to ( 0, 1, 0 ) by default.
 		</p>
 
-		<h3>[property:Boolean DefaultMatrixAutoUpdate]</h3>
+		<h3>[property:Boolean DEFAULT_MATRIX_AUTO_UPDATE]</h3>
 		<p>
 			The default setting for [page:.matrixAutoUpdate matrixAutoUpdate] for newly created Object3Ds.<br />
 

+ 1 - 1
docs/api/en/lights/DirectionalLight.html

@@ -81,7 +81,7 @@
 
 		<h3>[property:Vector3 position]</h3>
 		<p>
-			This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
+			This is set equal to [page:Object3D.DEFAULT_UP] (0, 1, 0), so that the light shines from the top down.
 		</p>
 
 		<h3>[property:DirectionalLightShadow shadow]</h3>

+ 1 - 1
docs/api/en/lights/HemisphereLight.html

@@ -69,7 +69,7 @@
 
 		<h3>[property:Vector3 position]</h3>
 		<p>
-			This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
+			This is set equal to [page:Object3D.DEFAULT_UP] (0, 1, 0), so that the light shines from the top down.
 		</p>
 
 

+ 1 - 1
docs/api/en/lights/SpotLight.html

@@ -126,7 +126,7 @@
 
 		<h3>[property:Vector3 position]</h3>
 		<p>
-			This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
+			This is set equal to [page:Object3D.DEFAULT_UP] (0, 1, 0), so that the light shines from the top down.
 		</p>
 
 		<h3>[property:Float power]</h3>

+ 1 - 1
examples/webgl_loader_3dm.html

@@ -62,7 +62,7 @@
 
 			function init() {
 
-				THREE.Object3D.DefaultUp = new THREE.Vector3( 0, 0, 1 );
+				THREE.Object3D.DEFAULT_UP.set( 0, 0, 1 );
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );

+ 6 - 6
src/core/Object3D.js

@@ -43,7 +43,7 @@ class Object3D extends EventDispatcher {
 		this.parent = null;
 		this.children = [];
 
-		this.up = Object3D.DefaultUp.clone();
+		this.up = Object3D.DEFAULT_UP.clone();
 
 		const position = new Vector3();
 		const rotation = new Euler();
@@ -97,10 +97,10 @@ class Object3D extends EventDispatcher {
 		this.matrix = new Matrix4();
 		this.matrixWorld = new Matrix4();
 
-		this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;
+		this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
 		this.matrixWorldNeedsUpdate = false;
 
-		this.matrixWorldAutoUpdate = Object3D.DefaultMatrixWorldAutoUpdate; // checked by the renderer
+		this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer
 
 		this.layers = new Layers();
 		this.visible = true;
@@ -963,8 +963,8 @@ class Object3D extends EventDispatcher {
 
 }
 
-Object3D.DefaultUp = /*@__PURE__*/ new Vector3( 0, 1, 0 );
-Object3D.DefaultMatrixAutoUpdate = true;
-Object3D.DefaultMatrixWorldAutoUpdate = true;
+Object3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );
+Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
+Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;
 
 export { Object3D };

+ 1 - 1
src/lights/DirectionalLight.js

@@ -12,7 +12,7 @@ class DirectionalLight extends Light {
 
 		this.type = 'DirectionalLight';
 
-		this.position.copy( Object3D.DefaultUp );
+		this.position.copy( Object3D.DEFAULT_UP );
 		this.updateMatrix();
 
 		this.target = new Object3D();

+ 1 - 1
src/lights/HemisphereLight.js

@@ -12,7 +12,7 @@ class HemisphereLight extends Light {
 
 		this.type = 'HemisphereLight';
 
-		this.position.copy( Object3D.DefaultUp );
+		this.position.copy( Object3D.DEFAULT_UP );
 		this.updateMatrix();
 
 		this.groundColor = new Color( groundColor );

+ 1 - 1
src/lights/SpotLight.js

@@ -12,7 +12,7 @@ class SpotLight extends Light {
 
 		this.type = 'SpotLight';
 
-		this.position.copy( Object3D.DefaultUp );
+		this.position.copy( Object3D.DEFAULT_UP );
 		this.updateMatrix();
 
 		this.target = new Object3D();

+ 14 - 14
test/unit/src/core/Object3D.tests.js

@@ -71,54 +71,54 @@ export default QUnit.module( 'Core', () => {
 		} );
 
 		// STATIC STUFF
-		QUnit.test( 'DefaultUp', ( assert ) => {
+		QUnit.test( 'DEFAULT_UP', ( assert ) => {
 
-			const currentDefaultUp = new Vector3().copy( Object3D.DefaultUp );
+			const currentDefaultUp = new Vector3().copy( Object3D.DEFAULT_UP );
 			const v = new Vector3();
 
 			try {
 
-				assert.deepEqual( Object3D.DefaultUp, v.set( 0, 1, 0 ), 'default DefaultUp is Y-up' );
+				assert.deepEqual( Object3D.DEFAULT_UP, v.set( 0, 1, 0 ), 'default DEFAULT_UP is Y-up' );
 
 				const object = new Object3D();
 
-				assert.deepEqual( object.up, v.set( 0, 1, 0 ), '.up of a new object inherits Object3D.DefaultUp = Y-up' );
+				assert.deepEqual( object.up, v.set( 0, 1, 0 ), '.up of a new object inherits Object3D.DEFAULT_UP = Y-up' );
 
-				Object3D.DefaultUp.set( 0, 0, 1 );
+				Object3D.DEFAULT_UP.set( 0, 0, 1 );
 
 				const object2 = new Object3D();
 
-				assert.deepEqual( object2.up, v.set( 0, 0, 1 ), '.up of a new object inherits Object3D.DefaultUp = Z-up' );
+				assert.deepEqual( object2.up, v.set( 0, 0, 1 ), '.up of a new object inherits Object3D.DEFAULT_UP = Z-up' );
 
 			} finally {
 
-				Object3D.DefaultUp.copy( currentDefaultUp );
+				Object3D.DEFAULT_UP.copy( currentDefaultUp );
 
 			}
 
 		} );
 
-		QUnit.test( 'DefaultMatrixAutoUpdate', ( assert ) => {
+		QUnit.test( 'DEFAULT_MATRIX_AUTO_UPDATE', ( assert ) => {
 
-			const currentDefaultMatrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;
+			const currentDefaultMatrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
 
 			try {
 
-				assert.equal( currentDefaultMatrixAutoUpdate, true, 'default DefaultMatrixAutoUpdate is true' );
+				assert.equal( currentDefaultMatrixAutoUpdate, true, 'default DEFAULT_MATRIX_AUTO_UPDATE is true' );
 
 				const object = new Object3D();
 
-				assert.equal( object.matrixAutoUpdate, true, '.matrixAutoUpdate of a new object inherits Object3D.DefaultMatrixAutoUpdate = true' );
+				assert.equal( object.matrixAutoUpdate, true, '.matrixAutoUpdate of a new object inherits Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true' );
 
-				Object3D.DefaultMatrixAutoUpdate = false;
+				Object3D.DEFAULT_MATRIX_AUTO_UPDATE = false;
 
 				const object2 = new Object3D();
 
-				assert.equal( object2.matrixAutoUpdate, false, '.matrixAutoUpdate of a new object inherits Object3D.DefaultMatrixAutoUpdate = false' );
+				assert.equal( object2.matrixAutoUpdate, false, '.matrixAutoUpdate of a new object inherits Object3D.DEFAULT_MATRIX_AUTO_UPDATE = false' );
 
 			} finally {
 
-				Object3D.DefaultMatrixAutoUpdate = currentDefaultMatrixAutoUpdate;
+				Object3D.DEFAULT_MATRIX_AUTO_UPDATE = currentDefaultMatrixAutoUpdate;
 
 			}