@needle-tools/three 0.146.4 → 0.146.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +31 -12
- package/build/three.js +31 -12
- package/build/three.min.js +1 -1
- package/build/three.module.js +44 -14
- package/examples/jsm/controls/OrbitControls.js +6 -2
- package/examples/jsm/exporters/USDZExporter.js +16 -7
- package/package.json +1 -1
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +5 -1
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +4 -0
- package/src/renderers/webxr/WebXRManager.js +43 -12
package/build/three.cjs
CHANGED
|
@@ -8548,9 +8548,9 @@ var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_
|
|
|
8548
8548
|
|
|
8549
8549
|
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
|
|
8550
8550
|
|
|
8551
|
-
var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
8551
|
+
var map_fragment = "#ifdef USE_MAP\n#ifdef USE_MIPMAP_BIAS\n vec4 sampledDiffuseColor = texture2D( map, vUv, mipmapBias );\n#else\n\t\tvec4 sampledDiffuseColor = texture2D( map, vUv, -0.5 );\n#endif\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
8552
8552
|
|
|
8553
|
-
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
|
|
8553
|
+
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n \n#ifdef USE_MIPMAP_BIAS\n uniform float mipmapBias;\n#endif\n#endif";
|
|
8554
8554
|
|
|
8555
8555
|
var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";
|
|
8556
8556
|
|
|
@@ -16610,6 +16610,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
16610
16610
|
const top2 = topFov * far / far2 * near2;
|
|
16611
16611
|
const bottom2 = bottomFov * far / far2 * near2;
|
|
16612
16612
|
camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);
|
|
16613
|
+
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
|
|
16613
16614
|
}
|
|
16614
16615
|
function updateCamera(camera, parent) {
|
|
16615
16616
|
if (parent === null) {
|
|
@@ -16639,16 +16640,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
16639
16640
|
for (let i = 0; i < cameras.length; i++) {
|
|
16640
16641
|
updateCamera(cameras[i], parent);
|
|
16641
16642
|
}
|
|
16642
|
-
cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
|
|
16643
|
-
|
|
16644
|
-
// update user camera and its children
|
|
16645
|
-
|
|
16646
|
-
camera.matrix.copy(cameraVR.matrix);
|
|
16647
|
-
camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
|
|
16648
|
-
const children = camera.children;
|
|
16649
|
-
for (let i = 0, l = children.length; i < l; i++) {
|
|
16650
|
-
children[i].updateMatrixWorld(true);
|
|
16651
|
-
}
|
|
16652
16643
|
|
|
16653
16644
|
// update projection matrix for proper view frustum culling
|
|
16654
16645
|
|
|
@@ -16659,7 +16650,32 @@ class WebXRManager extends EventDispatcher {
|
|
|
16659
16650
|
|
|
16660
16651
|
cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);
|
|
16661
16652
|
}
|
|
16653
|
+
|
|
16654
|
+
// update user camera and its children
|
|
16655
|
+
|
|
16656
|
+
updateUserCamera(camera, cameraVR, parent);
|
|
16662
16657
|
};
|
|
16658
|
+
function updateUserCamera(camera, cameraVR, parent) {
|
|
16659
|
+
if (parent === null) {
|
|
16660
|
+
camera.matrix.copy(cameraVR.matrixWorld);
|
|
16661
|
+
} else {
|
|
16662
|
+
camera.matrix.copy(parent.matrixWorld);
|
|
16663
|
+
camera.matrix.invert();
|
|
16664
|
+
camera.matrix.multiply(cameraVR.matrixWorld);
|
|
16665
|
+
}
|
|
16666
|
+
camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
|
|
16667
|
+
camera.updateMatrixWorld(true);
|
|
16668
|
+
const children = camera.children;
|
|
16669
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
16670
|
+
children[i].updateMatrixWorld(true);
|
|
16671
|
+
}
|
|
16672
|
+
camera.projectionMatrix.copy(cameraVR.projectionMatrix);
|
|
16673
|
+
camera.projectionMatrixInverse.copy(cameraVR.projectionMatrixInverse);
|
|
16674
|
+
if (camera.isPerspectiveCamera) {
|
|
16675
|
+
camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);
|
|
16676
|
+
camera.zoom = 1;
|
|
16677
|
+
}
|
|
16678
|
+
}
|
|
16663
16679
|
this.getCamera = function () {
|
|
16664
16680
|
return cameraVR;
|
|
16665
16681
|
};
|
|
@@ -16730,10 +16746,13 @@ class WebXRManager extends EventDispatcher {
|
|
|
16730
16746
|
cameras[i] = camera;
|
|
16731
16747
|
}
|
|
16732
16748
|
camera.matrix.fromArray(view.transform.matrix);
|
|
16749
|
+
camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
|
|
16733
16750
|
camera.projectionMatrix.fromArray(view.projectionMatrix);
|
|
16751
|
+
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
|
|
16734
16752
|
camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);
|
|
16735
16753
|
if (i === 0) {
|
|
16736
16754
|
cameraVR.matrix.copy(camera.matrix);
|
|
16755
|
+
cameraVR.matrix.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
|
|
16737
16756
|
}
|
|
16738
16757
|
if (cameraVRNeedsUpdate === true) {
|
|
16739
16758
|
cameraVR.cameras.push(camera);
|
package/build/three.js
CHANGED
|
@@ -8550,9 +8550,9 @@
|
|
|
8550
8550
|
|
|
8551
8551
|
var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
|
|
8552
8552
|
|
|
8553
|
-
var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
8553
|
+
var map_fragment = "#ifdef USE_MAP\n#ifdef USE_MIPMAP_BIAS\n vec4 sampledDiffuseColor = texture2D( map, vUv, mipmapBias );\n#else\n\t\tvec4 sampledDiffuseColor = texture2D( map, vUv, -0.5 );\n#endif\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
8554
8554
|
|
|
8555
|
-
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
|
|
8555
|
+
var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n \n#ifdef USE_MIPMAP_BIAS\n uniform float mipmapBias;\n#endif\n#endif";
|
|
8556
8556
|
|
|
8557
8557
|
var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";
|
|
8558
8558
|
|
|
@@ -16612,6 +16612,7 @@
|
|
|
16612
16612
|
const top2 = topFov * far / far2 * near2;
|
|
16613
16613
|
const bottom2 = bottomFov * far / far2 * near2;
|
|
16614
16614
|
camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);
|
|
16615
|
+
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
|
|
16615
16616
|
}
|
|
16616
16617
|
function updateCamera(camera, parent) {
|
|
16617
16618
|
if (parent === null) {
|
|
@@ -16641,16 +16642,6 @@
|
|
|
16641
16642
|
for (let i = 0; i < cameras.length; i++) {
|
|
16642
16643
|
updateCamera(cameras[i], parent);
|
|
16643
16644
|
}
|
|
16644
|
-
cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
|
|
16645
|
-
|
|
16646
|
-
// update user camera and its children
|
|
16647
|
-
|
|
16648
|
-
camera.matrix.copy(cameraVR.matrix);
|
|
16649
|
-
camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
|
|
16650
|
-
const children = camera.children;
|
|
16651
|
-
for (let i = 0, l = children.length; i < l; i++) {
|
|
16652
|
-
children[i].updateMatrixWorld(true);
|
|
16653
|
-
}
|
|
16654
16645
|
|
|
16655
16646
|
// update projection matrix for proper view frustum culling
|
|
16656
16647
|
|
|
@@ -16661,7 +16652,32 @@
|
|
|
16661
16652
|
|
|
16662
16653
|
cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);
|
|
16663
16654
|
}
|
|
16655
|
+
|
|
16656
|
+
// update user camera and its children
|
|
16657
|
+
|
|
16658
|
+
updateUserCamera(camera, cameraVR, parent);
|
|
16664
16659
|
};
|
|
16660
|
+
function updateUserCamera(camera, cameraVR, parent) {
|
|
16661
|
+
if (parent === null) {
|
|
16662
|
+
camera.matrix.copy(cameraVR.matrixWorld);
|
|
16663
|
+
} else {
|
|
16664
|
+
camera.matrix.copy(parent.matrixWorld);
|
|
16665
|
+
camera.matrix.invert();
|
|
16666
|
+
camera.matrix.multiply(cameraVR.matrixWorld);
|
|
16667
|
+
}
|
|
16668
|
+
camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
|
|
16669
|
+
camera.updateMatrixWorld(true);
|
|
16670
|
+
const children = camera.children;
|
|
16671
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
16672
|
+
children[i].updateMatrixWorld(true);
|
|
16673
|
+
}
|
|
16674
|
+
camera.projectionMatrix.copy(cameraVR.projectionMatrix);
|
|
16675
|
+
camera.projectionMatrixInverse.copy(cameraVR.projectionMatrixInverse);
|
|
16676
|
+
if (camera.isPerspectiveCamera) {
|
|
16677
|
+
camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);
|
|
16678
|
+
camera.zoom = 1;
|
|
16679
|
+
}
|
|
16680
|
+
}
|
|
16665
16681
|
this.getCamera = function () {
|
|
16666
16682
|
return cameraVR;
|
|
16667
16683
|
};
|
|
@@ -16732,10 +16748,13 @@
|
|
|
16732
16748
|
cameras[i] = camera;
|
|
16733
16749
|
}
|
|
16734
16750
|
camera.matrix.fromArray(view.transform.matrix);
|
|
16751
|
+
camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);
|
|
16735
16752
|
camera.projectionMatrix.fromArray(view.projectionMatrix);
|
|
16753
|
+
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
|
|
16736
16754
|
camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);
|
|
16737
16755
|
if (i === 0) {
|
|
16738
16756
|
cameraVR.matrix.copy(camera.matrix);
|
|
16757
|
+
cameraVR.matrix.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);
|
|
16739
16758
|
}
|
|
16740
16759
|
if (cameraVRNeedsUpdate === true) {
|
|
16741
16760
|
cameraVR.cameras.push(camera);
|