|
|
@@ -1,6 +1,6 @@
|
|
|
/**
|
|
|
* @license
|
|
|
- * Copyright 2010-2025 Three.js Authors
|
|
|
+ * Copyright 2010-2026 Three.js Authors
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
*/
|
|
|
'use strict';
|
|
|
@@ -13671,6 +13671,16 @@ class Object3D extends EventDispatcher {
|
|
|
*/
|
|
|
this.userData = {};
|
|
|
|
|
|
+ /**
|
|
|
+ * The pivot point for rotation and scale transformations.
|
|
|
+ * When set, rotation and scale are applied around this point
|
|
|
+ * instead of the object's origin.
|
|
|
+ *
|
|
|
+ * @type {?Vector3}
|
|
|
+ * @default null
|
|
|
+ */
|
|
|
+ this.pivot = null;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -14418,6 +14428,19 @@ class Object3D extends EventDispatcher {
|
|
|
|
|
|
this.matrix.compose( this.position, this.quaternion, this.scale );
|
|
|
|
|
|
+ const pivot = this.pivot;
|
|
|
+
|
|
|
+ if ( pivot !== null ) {
|
|
|
+
|
|
|
+ const px = pivot.x, py = pivot.y, pz = pivot.z;
|
|
|
+ const te = this.matrix.elements;
|
|
|
+
|
|
|
+ te[ 12 ] += px - te[ 0 ] * px - te[ 4 ] * py - te[ 8 ] * pz;
|
|
|
+ te[ 13 ] += py - te[ 1 ] * px - te[ 5 ] * py - te[ 9 ] * pz;
|
|
|
+ te[ 14 ] += pz - te[ 2 ] * px - te[ 6 ] * py - te[ 10 ] * pz;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
this.matrixWorldNeedsUpdate = true;
|
|
|
|
|
|
}
|
|
|
@@ -14583,6 +14606,8 @@ class Object3D extends EventDispatcher {
|
|
|
object.matrix = this.matrix.toArray();
|
|
|
object.up = this.up.toArray();
|
|
|
|
|
|
+ if ( this.pivot !== null ) object.pivot = this.pivot.toArray();
|
|
|
+
|
|
|
if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
|
|
|
|
|
|
// object specific properties
|
|
|
@@ -14858,6 +14883,12 @@ class Object3D extends EventDispatcher {
|
|
|
this.quaternion.copy( source.quaternion );
|
|
|
this.scale.copy( source.scale );
|
|
|
|
|
|
+ if ( source.pivot !== null ) {
|
|
|
+
|
|
|
+ this.pivot = source.pivot.clone();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
this.matrix.copy( source.matrix );
|
|
|
this.matrixWorld.copy( source.matrixWorld );
|
|
|
|
|
|
@@ -48999,6 +49030,8 @@ class ObjectLoader extends Loader {
|
|
|
|
|
|
if ( data.up !== undefined ) object.up.fromArray( data.up );
|
|
|
|
|
|
+ if ( data.pivot !== undefined ) object.pivot = new Vector3().fromArray( data.pivot );
|
|
|
+
|
|
|
if ( data.castShadow !== undefined ) object.castShadow = data.castShadow;
|
|
|
if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;
|
|
|
|
|
|
@@ -56550,6 +56583,9 @@ const _vector$3 = /*@__PURE__*/ new Vector3();
|
|
|
/**
|
|
|
* This displays a cone shaped helper object for a {@link SpotLight}.
|
|
|
*
|
|
|
+ * When the spot light or its target are transformed or light properties are
|
|
|
+ * changed, it's necessary to call the `update()` method of the respective helper.
|
|
|
+ *
|
|
|
* ```js
|
|
|
* const spotLight = new THREE.SpotLight( 0xffffff );
|
|
|
* spotLight.position.set( 10, 10, 10 );
|
|
|
@@ -57008,6 +57044,9 @@ const _color2 = /*@__PURE__*/ new Color();
|
|
|
* Creates a visual aid consisting of a spherical mesh for a
|
|
|
* given {@link HemisphereLight}.
|
|
|
*
|
|
|
+ * When the hemisphere light is transformed or its light properties are changed,
|
|
|
+ * it's necessary to call the `update()` method of the respective helper.
|
|
|
+ *
|
|
|
* ```js
|
|
|
* const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
|
|
|
* const helper = new THREE.HemisphereLightHelper( light, 5 );
|
|
|
@@ -57315,9 +57354,12 @@ const _v3 = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
/**
|
|
|
* Helper object to assist with visualizing a {@link DirectionalLight}'s
|
|
|
- * effect on the scene. This consists of plane and a line representing the
|
|
|
+ * effect on the scene. This consists of a plane and a line representing the
|
|
|
* light's position and direction.
|
|
|
*
|
|
|
+ * When the directional light or its target are transformed or light properties
|
|
|
+ * are changed, it's necessary to call the `update()` method of the respective helper.
|
|
|
+ *
|
|
|
* ```js
|
|
|
* const light = new THREE.DirectionalLight( 0xFFFFFF );
|
|
|
* scene.add( light );
|
|
|
@@ -57456,6 +57498,9 @@ const _camera = /*@__PURE__*/ new Camera();
|
|
|
*
|
|
|
* `CameraHelper` must be a child of the scene.
|
|
|
*
|
|
|
+ * When the camera is transformed or its projection matrix is changed, it's necessary
|
|
|
+ * to call the `update()` method of the respective helper.
|
|
|
+ *
|
|
|
* ```js
|
|
|
* const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
|
|
|
* const helper = new THREE.CameraHelper( camera );
|
|
|
@@ -62671,24 +62716,20 @@ function _getGGXShader( lodMax, width, height ) {
|
|
|
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
|
float alpha = roughness * roughness;
|
|
|
|
|
|
- // Section 3.2: Transform view direction to hemisphere configuration
|
|
|
- vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
|
-
|
|
|
// Section 4.1: Orthonormal basis
|
|
|
- float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
|
- vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
|
- vec3 T2 = cross(Vh, T1);
|
|
|
+ vec3 T1 = vec3(1.0, 0.0, 0.0);
|
|
|
+ vec3 T2 = cross(V, T1);
|
|
|
|
|
|
// Section 4.2: Parameterization of projected area
|
|
|
float r = sqrt(Xi.x);
|
|
|
float phi = 2.0 * PI * Xi.y;
|
|
|
float t1 = r * cos(phi);
|
|
|
float t2 = r * sin(phi);
|
|
|
- float s = 0.5 * (1.0 + Vh.z);
|
|
|
+ float s = 0.5 * (1.0 + V.z);
|
|
|
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
|
|
|
|
// Section 4.3: Reprojection onto hemisphere
|
|
|
- vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
|
+ vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
|
|
|
|
|
|
// Section 3.4: Transform back to ellipsoid configuration
|
|
|
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|