super-three 0.177.0 → 0.179.0
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/README.md +1 -1
- package/build/three.cjs +959 -231
- package/build/three.core.js +751 -170
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +210 -64
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +78 -29
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3269 -1545
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3093 -1545
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -2
- package/examples/jsm/capabilities/WebGL.js +0 -27
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +61 -14
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/USDZExporter.js +676 -299
- package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
- package/examples/jsm/interactive/HTMLMesh.js +5 -3
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/loaders/ColladaLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +212 -30
- package/examples/jsm/loaders/TTFLoader.js +13 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -892
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/SkyMesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +95 -16
- package/examples/jsm/postprocessing/GTAOPass.js +10 -9
- package/examples/jsm/postprocessing/OutlinePass.js +17 -17
- package/examples/jsm/postprocessing/SSAOPass.js +10 -9
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/transpiler/AST.js +381 -30
- package/examples/jsm/transpiler/GLSLDecoder.js +226 -86
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/TSLEncoder.js +197 -92
- package/examples/jsm/transpiler/Transpiler.js +17 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +788 -0
- package/examples/jsm/tsl/display/BloomNode.js +8 -7
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +206 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +8 -10
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
- package/examples/jsm/tsl/display/hashBlur.js +3 -3
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +77 -28
- package/src/Three.WebGPU.js +2 -0
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +3 -3
- package/src/core/BufferAttribute.js +3 -3
- package/src/core/Clock.js +2 -8
- package/src/core/GLBufferAttribute.js +13 -1
- package/src/core/Object3D.js +1 -1
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/core/Path.js +22 -22
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +35 -6
- package/src/lights/LightShadow.js +21 -8
- package/src/lights/PointLightShadow.js +1 -1
- package/src/loaders/FileLoader.js +27 -4
- package/src/loaders/ImageBitmapLoader.js +27 -4
- package/src/loaders/ImageLoader.js +55 -8
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/MeshBasicNodeMaterial.js +4 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -1
- package/src/materials/nodes/MeshSSSNodeMaterial.js +2 -2
- package/src/materials/nodes/NodeMaterial.js +28 -5
- package/src/materials/nodes/PointsNodeMaterial.js +5 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
- package/src/math/Frustum.js +25 -9
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Quaternion.js +1 -1
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +2 -3
- package/src/nodes/TSL.js +5 -3
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +31 -25
- package/src/nodes/accessors/Camera.js +12 -12
- package/src/nodes/accessors/Normal.js +95 -29
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/Position.js +7 -7
- package/src/nodes/accessors/ReferenceNode.js +18 -3
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +1 -1
- package/src/nodes/accessors/Tangent.js +25 -17
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/TextureBicubic.js +21 -3
- package/src/nodes/accessors/TextureNode.js +12 -0
- package/src/nodes/accessors/UniformArrayNode.js +0 -16
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +3 -0
- package/src/nodes/core/CacheNode.js +0 -14
- package/src/nodes/core/ContextNode.js +20 -1
- package/src/nodes/core/Node.js +15 -3
- package/src/nodes/core/NodeBuilder.js +228 -92
- package/src/nodes/core/NodeUtils.js +4 -1
- package/src/nodes/core/StackNode.js +49 -29
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/UniformNode.js +63 -5
- package/src/nodes/core/VarNode.js +91 -2
- package/src/nodes/core/VaryingNode.js +6 -4
- package/src/nodes/display/BlendModes.js +2 -2
- package/src/nodes/display/FrontFacingNode.js +34 -2
- package/src/nodes/display/NormalMapNode.js +19 -50
- package/src/nodes/display/PassNode.js +157 -9
- package/src/nodes/display/ScreenNode.js +0 -26
- package/src/nodes/display/ViewportTextureNode.js +67 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +16 -16
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +67 -23
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/EnvironmentNode.js +5 -5
- package/src/nodes/lighting/LightsNode.js +4 -4
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +1 -1
- package/src/nodes/lighting/ShadowNode.js +2 -2
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/ConditionalNode.js +1 -20
- package/src/nodes/math/MathNode.js +90 -55
- package/src/nodes/math/OperatorNode.js +22 -39
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +114 -55
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/LoopNode.js +0 -17
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/RTTNode.js +22 -5
- package/src/nodes/utils/ReflectorNode.js +11 -4
- package/src/nodes/utils/SampleNode.js +81 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/objects/BatchedMesh.js +4 -2
- package/src/renderers/WebGLRenderer.js +26 -24
- package/src/renderers/common/Background.js +2 -2
- package/src/renderers/common/Bindings.js +19 -18
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderObject.js +68 -3
- package/src/renderers/common/Renderer.js +19 -16
- package/src/renderers/common/SampledTexture.js +3 -71
- package/src/renderers/common/Sampler.js +79 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +19 -3
- package/src/renderers/common/XRManager.js +31 -12
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +1 -1
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +12 -6
- package/src/renderers/webgl/WebGLPrograms.js +6 -4
- package/src/renderers/webgl/WebGLShadowMap.js +11 -1
- package/src/renderers/webgl/WebGLState.js +4 -4
- package/src/renderers/webgl/WebGLTextures.js +19 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +103 -72
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +3 -5
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +4 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +2 -0
- package/src/renderers/webgpu/WebGPUBackend.js +63 -16
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +64 -79
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +7 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +5 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +12 -65
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +68 -6
- package/src/textures/ExternalTexture.js +45 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +11 -1
- package/src/textures/VideoTexture.js +30 -2
- package/src/nodes/utils/EquirectUVNode.js +0 -65
- package/src/nodes/utils/MatcapUVNode.js +0 -49
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -148
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '179';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents mouse buttons and interaction types in context of controls.
|
|
@@ -1619,8 +1619,8 @@ const InterpolationSamplingMode = {
|
|
|
1619
1619
|
NORMAL: 'normal',
|
|
1620
1620
|
CENTROID: 'centroid',
|
|
1621
1621
|
SAMPLE: 'sample',
|
|
1622
|
-
|
|
1623
|
-
|
|
1622
|
+
FIRST: 'first',
|
|
1623
|
+
EITHER: 'either'
|
|
1624
1624
|
};
|
|
1625
1625
|
|
|
1626
1626
|
/**
|
|
@@ -3869,7 +3869,7 @@ class Quaternion {
|
|
|
3869
3869
|
|
|
3870
3870
|
let r = vFrom.dot( vTo ) + 1;
|
|
3871
3871
|
|
|
3872
|
-
if ( r <
|
|
3872
|
+
if ( r < 1e-8 ) { // the epsilon value has been discussed in #31286
|
|
3873
3873
|
|
|
3874
3874
|
// vFrom and vTo point in opposite directions
|
|
3875
3875
|
|
|
@@ -6282,38 +6282,6 @@ function probeAsync( gl, sync, interval ) {
|
|
|
6282
6282
|
|
|
6283
6283
|
}
|
|
6284
6284
|
|
|
6285
|
-
function toNormalizedProjectionMatrix( projectionMatrix ) {
|
|
6286
|
-
|
|
6287
|
-
const m = projectionMatrix.elements;
|
|
6288
|
-
|
|
6289
|
-
// Convert [-1, 1] to [0, 1] projection matrix
|
|
6290
|
-
m[ 2 ] = 0.5 * m[ 2 ] + 0.5 * m[ 3 ];
|
|
6291
|
-
m[ 6 ] = 0.5 * m[ 6 ] + 0.5 * m[ 7 ];
|
|
6292
|
-
m[ 10 ] = 0.5 * m[ 10 ] + 0.5 * m[ 11 ];
|
|
6293
|
-
m[ 14 ] = 0.5 * m[ 14 ] + 0.5 * m[ 15 ];
|
|
6294
|
-
|
|
6295
|
-
}
|
|
6296
|
-
|
|
6297
|
-
function toReversedProjectionMatrix( projectionMatrix ) {
|
|
6298
|
-
|
|
6299
|
-
const m = projectionMatrix.elements;
|
|
6300
|
-
const isPerspectiveMatrix = m[ 11 ] === -1;
|
|
6301
|
-
|
|
6302
|
-
// Reverse [0, 1] projection matrix
|
|
6303
|
-
if ( isPerspectiveMatrix ) {
|
|
6304
|
-
|
|
6305
|
-
m[ 10 ] = - m[ 10 ] - 1;
|
|
6306
|
-
m[ 14 ] = - m[ 14 ];
|
|
6307
|
-
|
|
6308
|
-
} else {
|
|
6309
|
-
|
|
6310
|
-
m[ 10 ] = - m[ 10 ];
|
|
6311
|
-
m[ 14 ] = - m[ 14 ] + 1;
|
|
6312
|
-
|
|
6313
|
-
}
|
|
6314
|
-
|
|
6315
|
-
}
|
|
6316
|
-
|
|
6317
6285
|
const LINEAR_REC709_TO_XYZ = /*@__PURE__*/ new Matrix3().set(
|
|
6318
6286
|
0.4123908, 0.3575843, 0.1804808,
|
|
6319
6287
|
0.2126390, 0.7151687, 0.0721923,
|
|
@@ -6725,13 +6693,23 @@ class Source {
|
|
|
6725
6693
|
|
|
6726
6694
|
}
|
|
6727
6695
|
|
|
6696
|
+
/**
|
|
6697
|
+
* Returns the dimensions of the source into the given target vector.
|
|
6698
|
+
*
|
|
6699
|
+
* @param {(Vector2|Vector3)} target - The target object the result is written into.
|
|
6700
|
+
* @return {(Vector2|Vector3)} The dimensions of the source.
|
|
6701
|
+
*/
|
|
6728
6702
|
getSize( target ) {
|
|
6729
6703
|
|
|
6730
6704
|
const data = this.data;
|
|
6731
6705
|
|
|
6732
6706
|
if ( data instanceof HTMLVideoElement ) {
|
|
6733
6707
|
|
|
6734
|
-
target.set( data.videoWidth, data.videoHeight );
|
|
6708
|
+
target.set( data.videoWidth, data.videoHeight, 0 );
|
|
6709
|
+
|
|
6710
|
+
} else if ( data instanceof VideoFrame ) {
|
|
6711
|
+
|
|
6712
|
+
target.set( data.displayHeight, data.displayWidth, 0 );
|
|
6735
6713
|
|
|
6736
6714
|
} else if ( data !== null ) {
|
|
6737
6715
|
|
|
@@ -12414,11 +12392,13 @@ class Matrix4 {
|
|
|
12414
12392
|
* @param {number} near - The distance from the camera to the near plane.
|
|
12415
12393
|
* @param {number} far - The distance from the camera to the far plane.
|
|
12416
12394
|
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
|
|
12395
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
12417
12396
|
* @return {Matrix4} A reference to this matrix.
|
|
12418
12397
|
*/
|
|
12419
|
-
makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
12398
|
+
makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
12420
12399
|
|
|
12421
12400
|
const te = this.elements;
|
|
12401
|
+
|
|
12422
12402
|
const x = 2 * near / ( right - left );
|
|
12423
12403
|
const y = 2 * near / ( top - bottom );
|
|
12424
12404
|
|
|
@@ -12427,19 +12407,28 @@ class Matrix4 {
|
|
|
12427
12407
|
|
|
12428
12408
|
let c, d;
|
|
12429
12409
|
|
|
12430
|
-
if (
|
|
12410
|
+
if ( reversedDepth ) {
|
|
12431
12411
|
|
|
12432
|
-
c =
|
|
12433
|
-
d = (
|
|
12412
|
+
c = near / ( far - near );
|
|
12413
|
+
d = ( far * near ) / ( far - near );
|
|
12434
12414
|
|
|
12435
|
-
} else
|
|
12415
|
+
} else {
|
|
12436
12416
|
|
|
12437
|
-
|
|
12438
|
-
d = ( - far * near ) / ( far - near );
|
|
12417
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
12439
12418
|
|
|
12440
|
-
|
|
12419
|
+
c = - ( far + near ) / ( far - near );
|
|
12420
|
+
d = ( -2 * far * near ) / ( far - near );
|
|
12441
12421
|
|
|
12442
|
-
|
|
12422
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
12423
|
+
|
|
12424
|
+
c = - far / ( far - near );
|
|
12425
|
+
d = ( - far * near ) / ( far - near );
|
|
12426
|
+
|
|
12427
|
+
} else {
|
|
12428
|
+
|
|
12429
|
+
throw new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );
|
|
12430
|
+
|
|
12431
|
+
}
|
|
12443
12432
|
|
|
12444
12433
|
}
|
|
12445
12434
|
|
|
@@ -12463,39 +12452,49 @@ class Matrix4 {
|
|
|
12463
12452
|
* @param {number} near - The distance from the camera to the near plane.
|
|
12464
12453
|
* @param {number} far - The distance from the camera to the far plane.
|
|
12465
12454
|
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
|
|
12455
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
12466
12456
|
* @return {Matrix4} A reference to this matrix.
|
|
12467
12457
|
*/
|
|
12468
|
-
makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
12458
|
+
makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
12469
12459
|
|
|
12470
12460
|
const te = this.elements;
|
|
12471
|
-
const w = 1.0 / ( right - left );
|
|
12472
|
-
const h = 1.0 / ( top - bottom );
|
|
12473
|
-
const p = 1.0 / ( far - near );
|
|
12474
12461
|
|
|
12475
|
-
const x = ( right
|
|
12476
|
-
const y = ( top
|
|
12462
|
+
const x = 2 / ( right - left );
|
|
12463
|
+
const y = 2 / ( top - bottom );
|
|
12477
12464
|
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
12465
|
+
const a = - ( right + left ) / ( right - left );
|
|
12466
|
+
const b = - ( top + bottom ) / ( top - bottom );
|
|
12481
12467
|
|
|
12482
|
-
|
|
12483
|
-
zInv = -2 * p;
|
|
12468
|
+
let c, d;
|
|
12484
12469
|
|
|
12485
|
-
|
|
12470
|
+
if ( reversedDepth ) {
|
|
12486
12471
|
|
|
12487
|
-
|
|
12488
|
-
|
|
12472
|
+
c = 1 / ( far - near );
|
|
12473
|
+
d = far / ( far - near );
|
|
12489
12474
|
|
|
12490
12475
|
} else {
|
|
12491
12476
|
|
|
12492
|
-
|
|
12477
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
12478
|
+
|
|
12479
|
+
c = -2 / ( far - near );
|
|
12480
|
+
d = - ( far + near ) / ( far - near );
|
|
12481
|
+
|
|
12482
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
12483
|
+
|
|
12484
|
+
c = -1 / ( far - near );
|
|
12485
|
+
d = - near / ( far - near );
|
|
12486
|
+
|
|
12487
|
+
} else {
|
|
12488
|
+
|
|
12489
|
+
throw new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );
|
|
12490
|
+
|
|
12491
|
+
}
|
|
12493
12492
|
|
|
12494
12493
|
}
|
|
12495
12494
|
|
|
12496
|
-
te[ 0 ] =
|
|
12497
|
-
te[ 1 ] = 0; te[ 5 ] =
|
|
12498
|
-
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] =
|
|
12495
|
+
te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = a;
|
|
12496
|
+
te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = 0; te[ 13 ] = b;
|
|
12497
|
+
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
12499
12498
|
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
|
|
12500
12499
|
|
|
12501
12500
|
return this;
|
|
@@ -13190,7 +13189,7 @@ const _removedEvent = { type: 'removed' };
|
|
|
13190
13189
|
const _childaddedEvent = { type: 'childadded', child: null };
|
|
13191
13190
|
|
|
13192
13191
|
/**
|
|
13193
|
-
* Fires when a
|
|
13192
|
+
* Fires when a child object has been removed.
|
|
13194
13193
|
*
|
|
13195
13194
|
* @event Object3D#childremoved
|
|
13196
13195
|
* @type {Object}
|
|
@@ -17289,7 +17288,7 @@ class MeshBasicMaterial extends Material {
|
|
|
17289
17288
|
* @type {Color}
|
|
17290
17289
|
* @default (1,1,1)
|
|
17291
17290
|
*/
|
|
17292
|
-
this.color = new Color( 0xffffff ); //
|
|
17291
|
+
this.color = new Color( 0xffffff ); // diffuse
|
|
17293
17292
|
|
|
17294
17293
|
/**
|
|
17295
17294
|
* The color map. May optionally include an alpha channel, typically combined
|
|
@@ -17786,7 +17785,7 @@ class BufferAttribute {
|
|
|
17786
17785
|
/**
|
|
17787
17786
|
* Applies to integer data only. Indicates how the underlying data in the buffer maps to
|
|
17788
17787
|
* the values in the GLSL code. For instance, if `array` is an instance of `UInt16Array`,
|
|
17789
|
-
* and `normalized` is `true`, the values `0
|
|
17788
|
+
* and `normalized` is `true`, the values `0 - +65535` in the array data will be mapped to
|
|
17790
17789
|
* `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted
|
|
17791
17790
|
* to floats unmodified, i.e. `65535` becomes `65535.0f`.
|
|
17792
17791
|
*
|
|
@@ -18539,8 +18538,8 @@ class Uint32BufferAttribute extends BufferAttribute {
|
|
|
18539
18538
|
* Convenient class that can be used when creating a `Float16` buffer attribute with
|
|
18540
18539
|
* a plain `Array` instance.
|
|
18541
18540
|
*
|
|
18542
|
-
* This class automatically converts to and from FP16 since `Float16Array`
|
|
18543
|
-
*
|
|
18541
|
+
* This class automatically converts to and from FP16 via `Uint16Array` since `Float16Array`
|
|
18542
|
+
* browser support is still problematic.
|
|
18544
18543
|
*
|
|
18545
18544
|
* @augments BufferAttribute
|
|
18546
18545
|
*/
|
|
@@ -21399,6 +21398,20 @@ class Camera extends Object3D {
|
|
|
21399
21398
|
*/
|
|
21400
21399
|
this.coordinateSystem = WebGLCoordinateSystem;
|
|
21401
21400
|
|
|
21401
|
+
this._reversedDepth = false;
|
|
21402
|
+
|
|
21403
|
+
}
|
|
21404
|
+
|
|
21405
|
+
/**
|
|
21406
|
+
* The flag that indicates whether the camera uses a reversed depth buffer.
|
|
21407
|
+
*
|
|
21408
|
+
* @type {boolean}
|
|
21409
|
+
* @default false
|
|
21410
|
+
*/
|
|
21411
|
+
get reversedDepth() {
|
|
21412
|
+
|
|
21413
|
+
return this._reversedDepth;
|
|
21414
|
+
|
|
21402
21415
|
}
|
|
21403
21416
|
|
|
21404
21417
|
copy( source, recursive ) {
|
|
@@ -21826,7 +21839,7 @@ class PerspectiveCamera extends Camera {
|
|
|
21826
21839
|
const skew = this.filmOffset;
|
|
21827
21840
|
if ( skew !== 0 ) left += near * skew / this.getFilmWidth();
|
|
21828
21841
|
|
|
21829
|
-
this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );
|
|
21842
|
+
this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem, this.reversedDepth );
|
|
21830
21843
|
|
|
21831
21844
|
this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
|
|
21832
21845
|
|
|
@@ -26306,6 +26319,7 @@ class Plane {
|
|
|
26306
26319
|
}
|
|
26307
26320
|
|
|
26308
26321
|
const _sphere$3 = /*@__PURE__*/ new Sphere();
|
|
26322
|
+
const _defaultSpriteCenter = /*@__PURE__*/ new Vector2( 0.5, 0.5 );
|
|
26309
26323
|
const _vector$6 = /*@__PURE__*/ new Vector3();
|
|
26310
26324
|
|
|
26311
26325
|
/**
|
|
@@ -26389,9 +26403,10 @@ class Frustum {
|
|
|
26389
26403
|
*
|
|
26390
26404
|
* @param {Matrix4} m - The projection matrix.
|
|
26391
26405
|
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} coordinateSystem - The coordinate system.
|
|
26406
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
26392
26407
|
* @return {Frustum} A reference to this frustum.
|
|
26393
26408
|
*/
|
|
26394
|
-
setFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {
|
|
26409
|
+
setFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
26395
26410
|
|
|
26396
26411
|
const planes = this.planes;
|
|
26397
26412
|
const me = m.elements;
|
|
@@ -26404,19 +26419,29 @@ class Frustum {
|
|
|
26404
26419
|
planes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();
|
|
26405
26420
|
planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();
|
|
26406
26421
|
planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();
|
|
26407
|
-
planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();
|
|
26408
26422
|
|
|
26409
|
-
if (
|
|
26423
|
+
if ( reversedDepth ) {
|
|
26410
26424
|
|
|
26411
|
-
planes[
|
|
26425
|
+
planes[ 4 ].setComponents( me2, me6, me10, me14 ).normalize(); // far
|
|
26426
|
+
planes[ 5 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); // near
|
|
26412
26427
|
|
|
26413
|
-
} else
|
|
26428
|
+
} else {
|
|
26414
26429
|
|
|
26415
|
-
planes[
|
|
26430
|
+
planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize(); // far
|
|
26416
26431
|
|
|
26417
|
-
|
|
26432
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
26418
26433
|
|
|
26419
|
-
|
|
26434
|
+
planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize(); // near
|
|
26435
|
+
|
|
26436
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
26437
|
+
|
|
26438
|
+
planes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize(); // near
|
|
26439
|
+
|
|
26440
|
+
} else {
|
|
26441
|
+
|
|
26442
|
+
throw new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );
|
|
26443
|
+
|
|
26444
|
+
}
|
|
26420
26445
|
|
|
26421
26446
|
}
|
|
26422
26447
|
|
|
@@ -26463,7 +26488,10 @@ class Frustum {
|
|
|
26463
26488
|
intersectsSprite( sprite ) {
|
|
26464
26489
|
|
|
26465
26490
|
_sphere$3.center.set( 0, 0, 0 );
|
|
26466
|
-
|
|
26491
|
+
|
|
26492
|
+
const offset = _defaultSpriteCenter.distanceTo( sprite.center );
|
|
26493
|
+
|
|
26494
|
+
_sphere$3.radius = 0.7071067811865476 + offset;
|
|
26467
26495
|
_sphere$3.applyMatrix4( sprite.matrixWorld );
|
|
26468
26496
|
|
|
26469
26497
|
return this.intersectsSphere( _sphere$3 );
|
|
@@ -26619,7 +26647,8 @@ class FrustumArray {
|
|
|
26619
26647
|
|
|
26620
26648
|
_frustum$1.setFromProjectionMatrix(
|
|
26621
26649
|
_projScreenMatrix$2,
|
|
26622
|
-
|
|
26650
|
+
camera.coordinateSystem,
|
|
26651
|
+
camera.reversedDepth
|
|
26623
26652
|
);
|
|
26624
26653
|
|
|
26625
26654
|
if ( _frustum$1.intersectsObject( object ) ) {
|
|
@@ -26661,7 +26690,8 @@ class FrustumArray {
|
|
|
26661
26690
|
|
|
26662
26691
|
_frustum$1.setFromProjectionMatrix(
|
|
26663
26692
|
_projScreenMatrix$2,
|
|
26664
|
-
|
|
26693
|
+
camera.coordinateSystem,
|
|
26694
|
+
camera.reversedDepth
|
|
26665
26695
|
);
|
|
26666
26696
|
|
|
26667
26697
|
if ( _frustum$1.intersectsSprite( sprite ) ) {
|
|
@@ -26703,7 +26733,8 @@ class FrustumArray {
|
|
|
26703
26733
|
|
|
26704
26734
|
_frustum$1.setFromProjectionMatrix(
|
|
26705
26735
|
_projScreenMatrix$2,
|
|
26706
|
-
|
|
26736
|
+
camera.coordinateSystem,
|
|
26737
|
+
camera.reversedDepth
|
|
26707
26738
|
);
|
|
26708
26739
|
|
|
26709
26740
|
if ( _frustum$1.intersectsSphere( sphere ) ) {
|
|
@@ -26745,7 +26776,8 @@ class FrustumArray {
|
|
|
26745
26776
|
|
|
26746
26777
|
_frustum$1.setFromProjectionMatrix(
|
|
26747
26778
|
_projScreenMatrix$2,
|
|
26748
|
-
|
|
26779
|
+
camera.coordinateSystem,
|
|
26780
|
+
camera.reversedDepth
|
|
26749
26781
|
);
|
|
26750
26782
|
|
|
26751
26783
|
if ( _frustum$1.intersectsBox( box ) ) {
|
|
@@ -26787,7 +26819,8 @@ class FrustumArray {
|
|
|
26787
26819
|
|
|
26788
26820
|
_frustum$1.setFromProjectionMatrix(
|
|
26789
26821
|
_projScreenMatrix$2,
|
|
26790
|
-
|
|
26822
|
+
camera.coordinateSystem,
|
|
26823
|
+
camera.reversedDepth
|
|
26791
26824
|
);
|
|
26792
26825
|
|
|
26793
26826
|
if ( _frustum$1.containsPoint( point ) ) {
|
|
@@ -28054,7 +28087,7 @@ class BatchedMesh extends Mesh {
|
|
|
28054
28087
|
const availableInstanceIds = this._availableInstanceIds;
|
|
28055
28088
|
const instanceInfo = this._instanceInfo;
|
|
28056
28089
|
availableInstanceIds.sort( ascIdSort );
|
|
28057
|
-
while ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length ) {
|
|
28090
|
+
while ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length - 1 ) {
|
|
28058
28091
|
|
|
28059
28092
|
instanceInfo.pop();
|
|
28060
28093
|
availableInstanceIds.pop();
|
|
@@ -28332,9 +28365,11 @@ class BatchedMesh extends Mesh {
|
|
|
28332
28365
|
_matrix$1
|
|
28333
28366
|
.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
|
|
28334
28367
|
.multiply( this.matrixWorld );
|
|
28368
|
+
|
|
28335
28369
|
_frustum.setFromProjectionMatrix(
|
|
28336
28370
|
_matrix$1,
|
|
28337
|
-
|
|
28371
|
+
camera.coordinateSystem,
|
|
28372
|
+
camera.reversedDepth
|
|
28338
28373
|
);
|
|
28339
28374
|
|
|
28340
28375
|
}
|
|
@@ -29353,6 +29388,9 @@ function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, inte
|
|
|
29353
29388
|
* const texture = new THREE.VideoTexture( video );
|
|
29354
29389
|
* ```
|
|
29355
29390
|
*
|
|
29391
|
+
* Note: When using video textures with {@link WebGPURenderer}, {@link Texture#colorSpace} must be
|
|
29392
|
+
* set to THREE.SRGBColorSpace.
|
|
29393
|
+
*
|
|
29356
29394
|
* Note: After the initial use of a texture, its dimensions, format, and type
|
|
29357
29395
|
* cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one.
|
|
29358
29396
|
*
|
|
@@ -29396,18 +29434,28 @@ class VideoTexture extends Texture {
|
|
|
29396
29434
|
*/
|
|
29397
29435
|
this.generateMipmaps = false;
|
|
29398
29436
|
|
|
29437
|
+
/**
|
|
29438
|
+
* The video frame request callback identifier, which is a positive integer.
|
|
29439
|
+
*
|
|
29440
|
+
* Value of 0 represents no scheduled rVFC.
|
|
29441
|
+
*
|
|
29442
|
+
* @private
|
|
29443
|
+
* @type {number}
|
|
29444
|
+
*/
|
|
29445
|
+
this._requestVideoFrameCallbackId = 0;
|
|
29446
|
+
|
|
29399
29447
|
const scope = this;
|
|
29400
29448
|
|
|
29401
29449
|
function updateVideo() {
|
|
29402
29450
|
|
|
29403
29451
|
scope.needsUpdate = true;
|
|
29404
|
-
video.requestVideoFrameCallback( updateVideo );
|
|
29452
|
+
scope._requestVideoFrameCallbackId = video.requestVideoFrameCallback( updateVideo );
|
|
29405
29453
|
|
|
29406
29454
|
}
|
|
29407
29455
|
|
|
29408
29456
|
if ( 'requestVideoFrameCallback' in video ) {
|
|
29409
29457
|
|
|
29410
|
-
video.requestVideoFrameCallback( updateVideo );
|
|
29458
|
+
this._requestVideoFrameCallbackId = video.requestVideoFrameCallback( updateVideo );
|
|
29411
29459
|
|
|
29412
29460
|
}
|
|
29413
29461
|
|
|
@@ -29438,6 +29486,21 @@ class VideoTexture extends Texture {
|
|
|
29438
29486
|
|
|
29439
29487
|
}
|
|
29440
29488
|
|
|
29489
|
+
/**
|
|
29490
|
+
* @override
|
|
29491
|
+
*/
|
|
29492
|
+
dispose() {
|
|
29493
|
+
|
|
29494
|
+
if ( this._requestVideoFrameCallbackId !== 0 ) {
|
|
29495
|
+
|
|
29496
|
+
this.source.data.cancelVideoFrameCallback( this._requestVideoFrameCallbackId );
|
|
29497
|
+
|
|
29498
|
+
}
|
|
29499
|
+
|
|
29500
|
+
super.dispose();
|
|
29501
|
+
|
|
29502
|
+
}
|
|
29503
|
+
|
|
29441
29504
|
}
|
|
29442
29505
|
|
|
29443
29506
|
/**
|
|
@@ -29538,8 +29601,8 @@ class FramebufferTexture extends Texture {
|
|
|
29538
29601
|
/**
|
|
29539
29602
|
* Constructs a new framebuffer texture.
|
|
29540
29603
|
*
|
|
29541
|
-
* @param {number} width - The width of the texture.
|
|
29542
|
-
* @param {number} height - The height of the texture.
|
|
29604
|
+
* @param {number} [width] - The width of the texture.
|
|
29605
|
+
* @param {number} [height] - The height of the texture.
|
|
29543
29606
|
*/
|
|
29544
29607
|
constructor( width, height ) {
|
|
29545
29608
|
|
|
@@ -33896,11 +33959,11 @@ class Path extends CurvePath {
|
|
|
33896
33959
|
* Adds an arc as an instance of {@link EllipseCurve} to the path, positioned relative
|
|
33897
33960
|
* to the current point.
|
|
33898
33961
|
*
|
|
33899
|
-
* @param {number} aX - The x coordinate of the center of the arc offsetted from the previous curve.
|
|
33900
|
-
* @param {number} aY - The y coordinate of the center of the arc offsetted from the previous curve.
|
|
33901
|
-
* @param {number} aRadius - The radius of the arc.
|
|
33902
|
-
* @param {number} aStartAngle - The start angle in radians.
|
|
33903
|
-
* @param {number} aEndAngle - The end angle in radians.
|
|
33962
|
+
* @param {number} [aX=0] - The x coordinate of the center of the arc offsetted from the previous curve.
|
|
33963
|
+
* @param {number} [aY=0] - The y coordinate of the center of the arc offsetted from the previous curve.
|
|
33964
|
+
* @param {number} [aRadius=1] - The radius of the arc.
|
|
33965
|
+
* @param {number} [aStartAngle=0] - The start angle in radians.
|
|
33966
|
+
* @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
|
|
33904
33967
|
* @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not.
|
|
33905
33968
|
* @return {Path} A reference to this path.
|
|
33906
33969
|
*/
|
|
@@ -33919,11 +33982,11 @@ class Path extends CurvePath {
|
|
|
33919
33982
|
/**
|
|
33920
33983
|
* Adds an absolutely positioned arc as an instance of {@link EllipseCurve} to the path.
|
|
33921
33984
|
*
|
|
33922
|
-
* @param {number} aX - The x coordinate of the center of the arc.
|
|
33923
|
-
* @param {number} aY - The y coordinate of the center of the arc.
|
|
33924
|
-
* @param {number} aRadius - The radius of the arc.
|
|
33925
|
-
* @param {number} aStartAngle - The start angle in radians.
|
|
33926
|
-
* @param {number} aEndAngle - The end angle in radians.
|
|
33985
|
+
* @param {number} [aX=0] - The x coordinate of the center of the arc.
|
|
33986
|
+
* @param {number} [aY=0] - The y coordinate of the center of the arc.
|
|
33987
|
+
* @param {number} [aRadius=1] - The radius of the arc.
|
|
33988
|
+
* @param {number} [aStartAngle=0] - The start angle in radians.
|
|
33989
|
+
* @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
|
|
33927
33990
|
* @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not.
|
|
33928
33991
|
* @return {Path} A reference to this path.
|
|
33929
33992
|
*/
|
|
@@ -33939,12 +34002,12 @@ class Path extends CurvePath {
|
|
|
33939
34002
|
* Adds an ellipse as an instance of {@link EllipseCurve} to the path, positioned relative
|
|
33940
34003
|
* to the current point
|
|
33941
34004
|
*
|
|
33942
|
-
* @param {number} aX - The x coordinate of the center of the ellipse offsetted from the previous curve.
|
|
33943
|
-
* @param {number} aY - The y coordinate of the center of the ellipse offsetted from the previous curve.
|
|
33944
|
-
* @param {number} xRadius - The radius of the ellipse in the x axis.
|
|
33945
|
-
* @param {number} yRadius - The radius of the ellipse in the y axis.
|
|
33946
|
-
* @param {number} aStartAngle - The start angle in radians.
|
|
33947
|
-
* @param {number} aEndAngle - The end angle in radians.
|
|
34005
|
+
* @param {number} [aX=0] - The x coordinate of the center of the ellipse offsetted from the previous curve.
|
|
34006
|
+
* @param {number} [aY=0] - The y coordinate of the center of the ellipse offsetted from the previous curve.
|
|
34007
|
+
* @param {number} [xRadius=1] - The radius of the ellipse in the x axis.
|
|
34008
|
+
* @param {number} [yRadius=1] - The radius of the ellipse in the y axis.
|
|
34009
|
+
* @param {number} [aStartAngle=0] - The start angle in radians.
|
|
34010
|
+
* @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
|
|
33948
34011
|
* @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not.
|
|
33949
34012
|
* @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.
|
|
33950
34013
|
* @return {Path} A reference to this path.
|
|
@@ -33963,12 +34026,12 @@ class Path extends CurvePath {
|
|
|
33963
34026
|
/**
|
|
33964
34027
|
* Adds an absolutely positioned ellipse as an instance of {@link EllipseCurve} to the path.
|
|
33965
34028
|
*
|
|
33966
|
-
* @param {number} aX - The x coordinate of the absolute center of the ellipse.
|
|
33967
|
-
* @param {number} aY - The y coordinate of the absolute center of the ellipse.
|
|
33968
|
-
* @param {number} xRadius - The radius of the ellipse in the x axis.
|
|
33969
|
-
* @param {number} yRadius - The radius of the ellipse in the y axis.
|
|
33970
|
-
* @param {number} aStartAngle - The start angle in radians.
|
|
33971
|
-
* @param {number} aEndAngle - The end angle in radians.
|
|
34029
|
+
* @param {number} [aX=0] - The x coordinate of the absolute center of the ellipse.
|
|
34030
|
+
* @param {number} [aY=0] - The y coordinate of the absolute center of the ellipse.
|
|
34031
|
+
* @param {number} [xRadius=1] - The radius of the ellipse in the x axis.
|
|
34032
|
+
* @param {number} [yRadius=1] - The radius of the ellipse in the y axis.
|
|
34033
|
+
* @param {number} [aStartAngle=0] - The start angle in radians.
|
|
34034
|
+
* @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
|
|
33972
34035
|
* @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not.
|
|
33973
34036
|
* @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.
|
|
33974
34037
|
* @return {Path} A reference to this path.
|
|
@@ -41690,7 +41753,7 @@ class KeyframeTrack {
|
|
|
41690
41753
|
*
|
|
41691
41754
|
* @param {string} name - The keyframe track's name.
|
|
41692
41755
|
* @param {Array<number>} times - A list of keyframe times.
|
|
41693
|
-
* @param {Array<number>} values - A list of keyframe values.
|
|
41756
|
+
* @param {Array<number|string|boolean>} values - A list of keyframe values.
|
|
41694
41757
|
* @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
|
|
41695
41758
|
*/
|
|
41696
41759
|
constructor( name, times, values, interpolation ) {
|
|
@@ -42278,7 +42341,7 @@ class BooleanKeyframeTrack extends KeyframeTrack {
|
|
|
42278
42341
|
*
|
|
42279
42342
|
* @param {string} name - The keyframe track's name.
|
|
42280
42343
|
* @param {Array<number>} times - A list of keyframe times.
|
|
42281
|
-
* @param {Array<
|
|
42344
|
+
* @param {Array<boolean>} values - A list of keyframe values.
|
|
42282
42345
|
*/
|
|
42283
42346
|
constructor( name, times, values ) {
|
|
42284
42347
|
|
|
@@ -42481,7 +42544,7 @@ class StringKeyframeTrack extends KeyframeTrack {
|
|
|
42481
42544
|
*
|
|
42482
42545
|
* @param {string} name - The keyframe track's name.
|
|
42483
42546
|
* @param {Array<number>} times - A list of keyframe times.
|
|
42484
|
-
* @param {Array<
|
|
42547
|
+
* @param {Array<string>} values - A list of keyframe values.
|
|
42485
42548
|
*/
|
|
42486
42549
|
constructor( name, times, values ) {
|
|
42487
42550
|
|
|
@@ -43304,6 +43367,13 @@ class LoadingManager {
|
|
|
43304
43367
|
*/
|
|
43305
43368
|
this.onError = onError;
|
|
43306
43369
|
|
|
43370
|
+
/**
|
|
43371
|
+
* Used for aborting ongoing requests in loaders using this manager.
|
|
43372
|
+
*
|
|
43373
|
+
* @type {AbortController}
|
|
43374
|
+
*/
|
|
43375
|
+
this.abortController = new AbortController();
|
|
43376
|
+
|
|
43307
43377
|
/**
|
|
43308
43378
|
* This should be called by any loader using the manager when the loader
|
|
43309
43379
|
* starts loading an item.
|
|
@@ -43504,6 +43574,22 @@ class LoadingManager {
|
|
|
43504
43574
|
|
|
43505
43575
|
};
|
|
43506
43576
|
|
|
43577
|
+
/**
|
|
43578
|
+
* Can be used to abort ongoing loading requests in loaders using this manager.
|
|
43579
|
+
* The abort only works if the loaders implement {@link Loader#abort} and `AbortSignal.any()`
|
|
43580
|
+
* is supported in the browser.
|
|
43581
|
+
*
|
|
43582
|
+
* @return {LoadingManager} A reference to this loading manager.
|
|
43583
|
+
*/
|
|
43584
|
+
this.abort = function () {
|
|
43585
|
+
|
|
43586
|
+
this.abortController.abort();
|
|
43587
|
+
this.abortController = new AbortController();
|
|
43588
|
+
|
|
43589
|
+
return this;
|
|
43590
|
+
|
|
43591
|
+
};
|
|
43592
|
+
|
|
43507
43593
|
}
|
|
43508
43594
|
|
|
43509
43595
|
}
|
|
@@ -43583,6 +43669,7 @@ class Loader {
|
|
|
43583
43669
|
* This method needs to be implemented by all concrete loaders. It holds the
|
|
43584
43670
|
* logic for loading assets from the backend.
|
|
43585
43671
|
*
|
|
43672
|
+
* @abstract
|
|
43586
43673
|
* @param {string} url - The path/URL of the file to be loaded.
|
|
43587
43674
|
* @param {Function} onLoad - Executed when the loading process has been finished.
|
|
43588
43675
|
* @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
|
|
@@ -43613,6 +43700,7 @@ class Loader {
|
|
|
43613
43700
|
* This method needs to be implemented by all concrete loaders. It holds the
|
|
43614
43701
|
* logic for parsing the asset into three.js entities.
|
|
43615
43702
|
*
|
|
43703
|
+
* @abstract
|
|
43616
43704
|
* @param {any} data - The data to parse.
|
|
43617
43705
|
*/
|
|
43618
43706
|
parse( /* data */ ) {}
|
|
@@ -43687,6 +43775,18 @@ class Loader {
|
|
|
43687
43775
|
|
|
43688
43776
|
}
|
|
43689
43777
|
|
|
43778
|
+
/**
|
|
43779
|
+
* This method can be implemented in loaders for aborting ongoing requests.
|
|
43780
|
+
*
|
|
43781
|
+
* @abstract
|
|
43782
|
+
* @return {Loader} A reference to this instance.
|
|
43783
|
+
*/
|
|
43784
|
+
abort() {
|
|
43785
|
+
|
|
43786
|
+
return this;
|
|
43787
|
+
|
|
43788
|
+
}
|
|
43789
|
+
|
|
43690
43790
|
}
|
|
43691
43791
|
|
|
43692
43792
|
/**
|
|
@@ -43755,7 +43855,8 @@ class FileLoader extends Loader {
|
|
|
43755
43855
|
super( manager );
|
|
43756
43856
|
|
|
43757
43857
|
/**
|
|
43758
|
-
* The expected mime type.
|
|
43858
|
+
* The expected mime type. Valid values can be found
|
|
43859
|
+
* [here]{@link hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype}
|
|
43759
43860
|
*
|
|
43760
43861
|
* @type {string}
|
|
43761
43862
|
*/
|
|
@@ -43769,6 +43870,14 @@ class FileLoader extends Loader {
|
|
|
43769
43870
|
*/
|
|
43770
43871
|
this.responseType = '';
|
|
43771
43872
|
|
|
43873
|
+
/**
|
|
43874
|
+
* Used for aborting requests.
|
|
43875
|
+
*
|
|
43876
|
+
* @private
|
|
43877
|
+
* @type {AbortController}
|
|
43878
|
+
*/
|
|
43879
|
+
this._abortController = new AbortController();
|
|
43880
|
+
|
|
43772
43881
|
}
|
|
43773
43882
|
|
|
43774
43883
|
/**
|
|
@@ -43788,7 +43897,7 @@ class FileLoader extends Loader {
|
|
|
43788
43897
|
|
|
43789
43898
|
url = this.manager.resolveURL( url );
|
|
43790
43899
|
|
|
43791
|
-
const cached = Cache.get( url );
|
|
43900
|
+
const cached = Cache.get( `file:${url}` );
|
|
43792
43901
|
|
|
43793
43902
|
if ( cached !== undefined ) {
|
|
43794
43903
|
|
|
@@ -43835,7 +43944,7 @@ class FileLoader extends Loader {
|
|
|
43835
43944
|
const req = new Request( url, {
|
|
43836
43945
|
headers: new Headers( this.requestHeader ),
|
|
43837
43946
|
credentials: this.withCredentials ? 'include' : 'same-origin',
|
|
43838
|
-
|
|
43947
|
+
signal: ( typeof AbortSignal.any === 'function' ) ? AbortSignal.any( [ this._abortController.signal, this.manager.abortController.signal ] ) : this._abortController.signal
|
|
43839
43948
|
} );
|
|
43840
43949
|
|
|
43841
43950
|
// record states ( avoid data race )
|
|
@@ -43977,7 +44086,7 @@ class FileLoader extends Loader {
|
|
|
43977
44086
|
|
|
43978
44087
|
// Add to cache only on HTTP success, so that we do not cache
|
|
43979
44088
|
// error response bodies as proper responses to requests.
|
|
43980
|
-
Cache.add( url
|
|
44089
|
+
Cache.add( `file:${url}`, data );
|
|
43981
44090
|
|
|
43982
44091
|
const callbacks = loading[ url ];
|
|
43983
44092
|
delete loading[ url ];
|
|
@@ -44052,6 +44161,20 @@ class FileLoader extends Loader {
|
|
|
44052
44161
|
|
|
44053
44162
|
}
|
|
44054
44163
|
|
|
44164
|
+
/**
|
|
44165
|
+
* Aborts ongoing fetch requests.
|
|
44166
|
+
*
|
|
44167
|
+
* @return {FileLoader} A reference to this instance.
|
|
44168
|
+
*/
|
|
44169
|
+
abort() {
|
|
44170
|
+
|
|
44171
|
+
this._abortController.abort();
|
|
44172
|
+
this._abortController = new AbortController();
|
|
44173
|
+
|
|
44174
|
+
return this;
|
|
44175
|
+
|
|
44176
|
+
}
|
|
44177
|
+
|
|
44055
44178
|
}
|
|
44056
44179
|
|
|
44057
44180
|
/**
|
|
@@ -44293,6 +44416,8 @@ class CompressedTextureLoader extends Loader {
|
|
|
44293
44416
|
|
|
44294
44417
|
}
|
|
44295
44418
|
|
|
44419
|
+
const _loading = new WeakMap();
|
|
44420
|
+
|
|
44296
44421
|
/**
|
|
44297
44422
|
* A loader for loading images. The class loads images with the HTML `Image` API.
|
|
44298
44423
|
*
|
|
@@ -44339,19 +44464,36 @@ class ImageLoader extends Loader {
|
|
|
44339
44464
|
|
|
44340
44465
|
const scope = this;
|
|
44341
44466
|
|
|
44342
|
-
const cached = Cache.get( url );
|
|
44467
|
+
const cached = Cache.get( `image:${url}` );
|
|
44343
44468
|
|
|
44344
44469
|
if ( cached !== undefined ) {
|
|
44345
44470
|
|
|
44346
|
-
|
|
44471
|
+
if ( cached.complete === true ) {
|
|
44347
44472
|
|
|
44348
|
-
|
|
44473
|
+
scope.manager.itemStart( url );
|
|
44349
44474
|
|
|
44350
|
-
|
|
44475
|
+
setTimeout( function () {
|
|
44351
44476
|
|
|
44352
|
-
|
|
44477
|
+
if ( onLoad ) onLoad( cached );
|
|
44353
44478
|
|
|
44354
|
-
|
|
44479
|
+
scope.manager.itemEnd( url );
|
|
44480
|
+
|
|
44481
|
+
}, 0 );
|
|
44482
|
+
|
|
44483
|
+
} else {
|
|
44484
|
+
|
|
44485
|
+
let arr = _loading.get( cached );
|
|
44486
|
+
|
|
44487
|
+
if ( arr === undefined ) {
|
|
44488
|
+
|
|
44489
|
+
arr = [];
|
|
44490
|
+
_loading.set( cached, arr );
|
|
44491
|
+
|
|
44492
|
+
}
|
|
44493
|
+
|
|
44494
|
+
arr.push( { onLoad, onError } );
|
|
44495
|
+
|
|
44496
|
+
}
|
|
44355
44497
|
|
|
44356
44498
|
return cached;
|
|
44357
44499
|
|
|
@@ -44363,10 +44505,21 @@ class ImageLoader extends Loader {
|
|
|
44363
44505
|
|
|
44364
44506
|
removeEventListeners();
|
|
44365
44507
|
|
|
44366
|
-
Cache.add( url, this );
|
|
44367
|
-
|
|
44368
44508
|
if ( onLoad ) onLoad( this );
|
|
44369
44509
|
|
|
44510
|
+
//
|
|
44511
|
+
|
|
44512
|
+
const callbacks = _loading.get( this ) || [];
|
|
44513
|
+
|
|
44514
|
+
for ( let i = 0; i < callbacks.length; i ++ ) {
|
|
44515
|
+
|
|
44516
|
+
const callback = callbacks[ i ];
|
|
44517
|
+
if ( callback.onLoad ) callback.onLoad( this );
|
|
44518
|
+
|
|
44519
|
+
}
|
|
44520
|
+
|
|
44521
|
+
_loading.delete( this );
|
|
44522
|
+
|
|
44370
44523
|
scope.manager.itemEnd( url );
|
|
44371
44524
|
|
|
44372
44525
|
}
|
|
@@ -44377,6 +44530,22 @@ class ImageLoader extends Loader {
|
|
|
44377
44530
|
|
|
44378
44531
|
if ( onError ) onError( event );
|
|
44379
44532
|
|
|
44533
|
+
Cache.remove( `image:${url}` );
|
|
44534
|
+
|
|
44535
|
+
//
|
|
44536
|
+
|
|
44537
|
+
const callbacks = _loading.get( this ) || [];
|
|
44538
|
+
|
|
44539
|
+
for ( let i = 0; i < callbacks.length; i ++ ) {
|
|
44540
|
+
|
|
44541
|
+
const callback = callbacks[ i ];
|
|
44542
|
+
if ( callback.onError ) callback.onError( event );
|
|
44543
|
+
|
|
44544
|
+
}
|
|
44545
|
+
|
|
44546
|
+
_loading.delete( this );
|
|
44547
|
+
|
|
44548
|
+
|
|
44380
44549
|
scope.manager.itemError( url );
|
|
44381
44550
|
scope.manager.itemEnd( url );
|
|
44382
44551
|
|
|
@@ -44398,6 +44567,7 @@ class ImageLoader extends Loader {
|
|
|
44398
44567
|
|
|
44399
44568
|
}
|
|
44400
44569
|
|
|
44570
|
+
Cache.add( `image:${url}`, image );
|
|
44401
44571
|
scope.manager.itemStart( url );
|
|
44402
44572
|
|
|
44403
44573
|
image.src = url;
|
|
@@ -45068,14 +45238,27 @@ class LightShadow {
|
|
|
45068
45238
|
shadowCamera.updateMatrixWorld();
|
|
45069
45239
|
|
|
45070
45240
|
_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
|
|
45071
|
-
this._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );
|
|
45241
|
+
this._frustum.setFromProjectionMatrix( _projScreenMatrix$1, shadowCamera.coordinateSystem, shadowCamera.reversedDepth );
|
|
45072
45242
|
|
|
45073
|
-
|
|
45074
|
-
|
|
45075
|
-
|
|
45076
|
-
|
|
45077
|
-
|
|
45078
|
-
|
|
45243
|
+
if ( shadowCamera.reversedDepth ) {
|
|
45244
|
+
|
|
45245
|
+
shadowMatrix.set(
|
|
45246
|
+
0.5, 0.0, 0.0, 0.5,
|
|
45247
|
+
0.0, 0.5, 0.0, 0.5,
|
|
45248
|
+
0.0, 0.0, 1.0, 0.0,
|
|
45249
|
+
0.0, 0.0, 0.0, 1.0
|
|
45250
|
+
);
|
|
45251
|
+
|
|
45252
|
+
} else {
|
|
45253
|
+
|
|
45254
|
+
shadowMatrix.set(
|
|
45255
|
+
0.5, 0.0, 0.0, 0.5,
|
|
45256
|
+
0.0, 0.5, 0.0, 0.5,
|
|
45257
|
+
0.0, 0.0, 0.5, 0.5,
|
|
45258
|
+
0.0, 0.0, 0.0, 1.0
|
|
45259
|
+
);
|
|
45260
|
+
|
|
45261
|
+
}
|
|
45079
45262
|
|
|
45080
45263
|
shadowMatrix.multiply( _projScreenMatrix$1 );
|
|
45081
45264
|
|
|
@@ -45532,7 +45715,7 @@ class PointLightShadow extends LightShadow {
|
|
|
45532
45715
|
shadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );
|
|
45533
45716
|
|
|
45534
45717
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
45535
|
-
this._frustum.setFromProjectionMatrix( _projScreenMatrix );
|
|
45718
|
+
this._frustum.setFromProjectionMatrix( _projScreenMatrix, camera.coordinateSystem, camera.reversedDepth );
|
|
45536
45719
|
|
|
45537
45720
|
}
|
|
45538
45721
|
|
|
@@ -45866,7 +46049,7 @@ class OrthographicCamera extends Camera {
|
|
|
45866
46049
|
|
|
45867
46050
|
}
|
|
45868
46051
|
|
|
45869
|
-
this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );
|
|
46052
|
+
this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem, this.reversedDepth );
|
|
45870
46053
|
|
|
45871
46054
|
this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
|
|
45872
46055
|
|
|
@@ -48619,6 +48802,14 @@ class ImageBitmapLoader extends Loader {
|
|
|
48619
48802
|
*/
|
|
48620
48803
|
this.options = { premultiplyAlpha: 'none' };
|
|
48621
48804
|
|
|
48805
|
+
/**
|
|
48806
|
+
* Used for aborting requests.
|
|
48807
|
+
*
|
|
48808
|
+
* @private
|
|
48809
|
+
* @type {AbortController}
|
|
48810
|
+
*/
|
|
48811
|
+
this._abortController = new AbortController();
|
|
48812
|
+
|
|
48622
48813
|
}
|
|
48623
48814
|
|
|
48624
48815
|
/**
|
|
@@ -48655,7 +48846,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
48655
48846
|
|
|
48656
48847
|
const scope = this;
|
|
48657
48848
|
|
|
48658
|
-
const cached = Cache.get( url );
|
|
48849
|
+
const cached = Cache.get( `image-bitmap:${url}` );
|
|
48659
48850
|
|
|
48660
48851
|
if ( cached !== undefined ) {
|
|
48661
48852
|
|
|
@@ -48707,6 +48898,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
48707
48898
|
const fetchOptions = {};
|
|
48708
48899
|
fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';
|
|
48709
48900
|
fetchOptions.headers = this.requestHeader;
|
|
48901
|
+
fetchOptions.signal = ( typeof AbortSignal.any === 'function' ) ? AbortSignal.any( [ this._abortController.signal, this.manager.abortController.signal ] ) : this._abortController.signal;
|
|
48710
48902
|
|
|
48711
48903
|
const promise = fetch( url, fetchOptions ).then( function ( res ) {
|
|
48712
48904
|
|
|
@@ -48718,7 +48910,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
48718
48910
|
|
|
48719
48911
|
} ).then( function ( imageBitmap ) {
|
|
48720
48912
|
|
|
48721
|
-
Cache.add( url
|
|
48913
|
+
Cache.add( `image-bitmap:${url}`, imageBitmap );
|
|
48722
48914
|
|
|
48723
48915
|
if ( onLoad ) onLoad( imageBitmap );
|
|
48724
48916
|
|
|
@@ -48732,18 +48924,32 @@ class ImageBitmapLoader extends Loader {
|
|
|
48732
48924
|
|
|
48733
48925
|
_errorMap.set( promise, e );
|
|
48734
48926
|
|
|
48735
|
-
Cache.remove( url );
|
|
48927
|
+
Cache.remove( `image-bitmap:${url}` );
|
|
48736
48928
|
|
|
48737
48929
|
scope.manager.itemError( url );
|
|
48738
48930
|
scope.manager.itemEnd( url );
|
|
48739
48931
|
|
|
48740
48932
|
} );
|
|
48741
48933
|
|
|
48742
|
-
Cache.add( url
|
|
48934
|
+
Cache.add( `image-bitmap:${url}`, promise );
|
|
48743
48935
|
scope.manager.itemStart( url );
|
|
48744
48936
|
|
|
48745
48937
|
}
|
|
48746
48938
|
|
|
48939
|
+
/**
|
|
48940
|
+
* Aborts ongoing fetch requests.
|
|
48941
|
+
*
|
|
48942
|
+
* @return {ImageBitmapLoader} A reference to this instance.
|
|
48943
|
+
*/
|
|
48944
|
+
abort() {
|
|
48945
|
+
|
|
48946
|
+
this._abortController.abort();
|
|
48947
|
+
this._abortController = new AbortController();
|
|
48948
|
+
|
|
48949
|
+
return this;
|
|
48950
|
+
|
|
48951
|
+
}
|
|
48952
|
+
|
|
48747
48953
|
}
|
|
48748
48954
|
|
|
48749
48955
|
let _context;
|
|
@@ -49131,7 +49337,7 @@ class Clock {
|
|
|
49131
49337
|
*/
|
|
49132
49338
|
start() {
|
|
49133
49339
|
|
|
49134
|
-
this.startTime = now();
|
|
49340
|
+
this.startTime = performance.now();
|
|
49135
49341
|
|
|
49136
49342
|
this.oldTime = this.startTime;
|
|
49137
49343
|
this.elapsedTime = 0;
|
|
@@ -49180,7 +49386,7 @@ class Clock {
|
|
|
49180
49386
|
|
|
49181
49387
|
if ( this.running ) {
|
|
49182
49388
|
|
|
49183
|
-
const newTime = now();
|
|
49389
|
+
const newTime = performance.now();
|
|
49184
49390
|
|
|
49185
49391
|
diff = ( newTime - this.oldTime ) / 1000;
|
|
49186
49392
|
this.oldTime = newTime;
|
|
@@ -49195,12 +49401,6 @@ class Clock {
|
|
|
49195
49401
|
|
|
49196
49402
|
}
|
|
49197
49403
|
|
|
49198
|
-
function now() {
|
|
49199
|
-
|
|
49200
|
-
return performance.now();
|
|
49201
|
-
|
|
49202
|
-
}
|
|
49203
|
-
|
|
49204
49404
|
const _position$1 = /*@__PURE__*/ new Vector3();
|
|
49205
49405
|
const _quaternion$1 = /*@__PURE__*/ new Quaternion();
|
|
49206
49406
|
const _scale$1 = /*@__PURE__*/ new Vector3();
|
|
@@ -54236,8 +54436,9 @@ class GLBufferAttribute {
|
|
|
54236
54436
|
* @param {number} itemSize - The item size.
|
|
54237
54437
|
* @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter.
|
|
54238
54438
|
* @param {number} count - The expected number of vertices in VBO.
|
|
54439
|
+
* @param {boolean} [normalized=false] - Whether the data are normalized or not.
|
|
54239
54440
|
*/
|
|
54240
|
-
constructor( buffer, type, itemSize, elementSize, count ) {
|
|
54441
|
+
constructor( buffer, type, itemSize, elementSize, count, normalized = false ) {
|
|
54241
54442
|
|
|
54242
54443
|
/**
|
|
54243
54444
|
* This flag can be used for type testing.
|
|
@@ -54290,6 +54491,17 @@ class GLBufferAttribute {
|
|
|
54290
54491
|
*/
|
|
54291
54492
|
this.count = count;
|
|
54292
54493
|
|
|
54494
|
+
/**
|
|
54495
|
+
* Applies to integer data only. Indicates how the underlying data in the buffer maps to
|
|
54496
|
+
* the values in the GLSL code. For instance, if `buffer` contains data of `gl.UNSIGNED_SHORT`,
|
|
54497
|
+
* and `normalized` is `true`, the values `0 - +65535` in the buffer data will be mapped to
|
|
54498
|
+
* `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted
|
|
54499
|
+
* to floats unmodified, i.e. `65535` becomes `65535.0f`.
|
|
54500
|
+
*
|
|
54501
|
+
* @type {boolean}
|
|
54502
|
+
*/
|
|
54503
|
+
this.normalized = normalized;
|
|
54504
|
+
|
|
54293
54505
|
/**
|
|
54294
54506
|
* A version number, incremented every time the `needsUpdate` is set to `true`.
|
|
54295
54507
|
*
|
|
@@ -54629,6 +54841,189 @@ function intersect( object, raycaster, intersects, recursive ) {
|
|
|
54629
54841
|
|
|
54630
54842
|
}
|
|
54631
54843
|
|
|
54844
|
+
/**
|
|
54845
|
+
* This class is an alternative to {@link Clock} with a different API design and behavior.
|
|
54846
|
+
* The goal is to avoid the conceptual flaws that became apparent in `Clock` over time.
|
|
54847
|
+
*
|
|
54848
|
+
* - `Timer` has an `update()` method that updates its internal state. That makes it possible to
|
|
54849
|
+
* call `getDelta()` and `getElapsed()` multiple times per simulation step without getting different values.
|
|
54850
|
+
* - The class can make use of the Page Visibility API to avoid large time delta values when the app
|
|
54851
|
+
* is inactive (e.g. tab switched or browser hidden).
|
|
54852
|
+
*
|
|
54853
|
+
* ```js
|
|
54854
|
+
* const timer = new Timer();
|
|
54855
|
+
* timer.connect( document ); // use Page Visibility API
|
|
54856
|
+
* ```
|
|
54857
|
+
*/
|
|
54858
|
+
class Timer {
|
|
54859
|
+
|
|
54860
|
+
/**
|
|
54861
|
+
* Constructs a new timer.
|
|
54862
|
+
*/
|
|
54863
|
+
constructor() {
|
|
54864
|
+
|
|
54865
|
+
this._previousTime = 0;
|
|
54866
|
+
this._currentTime = 0;
|
|
54867
|
+
this._startTime = performance.now();
|
|
54868
|
+
|
|
54869
|
+
this._delta = 0;
|
|
54870
|
+
this._elapsed = 0;
|
|
54871
|
+
|
|
54872
|
+
this._timescale = 1;
|
|
54873
|
+
|
|
54874
|
+
this._document = null;
|
|
54875
|
+
this._pageVisibilityHandler = null;
|
|
54876
|
+
|
|
54877
|
+
}
|
|
54878
|
+
|
|
54879
|
+
/**
|
|
54880
|
+
* Connect the timer to the given document.Calling this method is not mandatory to
|
|
54881
|
+
* use the timer but enables the usage of the Page Visibility API to avoid large time
|
|
54882
|
+
* delta values.
|
|
54883
|
+
*
|
|
54884
|
+
* @param {Document} document - The document.
|
|
54885
|
+
*/
|
|
54886
|
+
connect( document ) {
|
|
54887
|
+
|
|
54888
|
+
this._document = document;
|
|
54889
|
+
|
|
54890
|
+
// use Page Visibility API to avoid large time delta values
|
|
54891
|
+
|
|
54892
|
+
if ( document.hidden !== undefined ) {
|
|
54893
|
+
|
|
54894
|
+
this._pageVisibilityHandler = handleVisibilityChange.bind( this );
|
|
54895
|
+
|
|
54896
|
+
document.addEventListener( 'visibilitychange', this._pageVisibilityHandler, false );
|
|
54897
|
+
|
|
54898
|
+
}
|
|
54899
|
+
|
|
54900
|
+
}
|
|
54901
|
+
|
|
54902
|
+
/**
|
|
54903
|
+
* Disconnects the timer from the DOM and also disables the usage of the Page Visibility API.
|
|
54904
|
+
*/
|
|
54905
|
+
disconnect() {
|
|
54906
|
+
|
|
54907
|
+
if ( this._pageVisibilityHandler !== null ) {
|
|
54908
|
+
|
|
54909
|
+
this._document.removeEventListener( 'visibilitychange', this._pageVisibilityHandler );
|
|
54910
|
+
this._pageVisibilityHandler = null;
|
|
54911
|
+
|
|
54912
|
+
}
|
|
54913
|
+
|
|
54914
|
+
this._document = null;
|
|
54915
|
+
|
|
54916
|
+
}
|
|
54917
|
+
|
|
54918
|
+
/**
|
|
54919
|
+
* Returns the time delta in seconds.
|
|
54920
|
+
*
|
|
54921
|
+
* @return {number} The time delta in second.
|
|
54922
|
+
*/
|
|
54923
|
+
getDelta() {
|
|
54924
|
+
|
|
54925
|
+
return this._delta / 1000;
|
|
54926
|
+
|
|
54927
|
+
}
|
|
54928
|
+
|
|
54929
|
+
/**
|
|
54930
|
+
* Returns the elapsed time in seconds.
|
|
54931
|
+
*
|
|
54932
|
+
* @return {number} The elapsed time in second.
|
|
54933
|
+
*/
|
|
54934
|
+
getElapsed() {
|
|
54935
|
+
|
|
54936
|
+
return this._elapsed / 1000;
|
|
54937
|
+
|
|
54938
|
+
}
|
|
54939
|
+
|
|
54940
|
+
/**
|
|
54941
|
+
* Returns the timescale.
|
|
54942
|
+
*
|
|
54943
|
+
* @return {number} The timescale.
|
|
54944
|
+
*/
|
|
54945
|
+
getTimescale() {
|
|
54946
|
+
|
|
54947
|
+
return this._timescale;
|
|
54948
|
+
|
|
54949
|
+
}
|
|
54950
|
+
|
|
54951
|
+
/**
|
|
54952
|
+
* Sets the given timescale which scale the time delta computation
|
|
54953
|
+
* in `update()`.
|
|
54954
|
+
*
|
|
54955
|
+
* @param {number} timescale - The timescale to set.
|
|
54956
|
+
* @return {Timer} A reference to this timer.
|
|
54957
|
+
*/
|
|
54958
|
+
setTimescale( timescale ) {
|
|
54959
|
+
|
|
54960
|
+
this._timescale = timescale;
|
|
54961
|
+
|
|
54962
|
+
return this;
|
|
54963
|
+
|
|
54964
|
+
}
|
|
54965
|
+
|
|
54966
|
+
/**
|
|
54967
|
+
* Resets the time computation for the current simulation step.
|
|
54968
|
+
*
|
|
54969
|
+
* @return {Timer} A reference to this timer.
|
|
54970
|
+
*/
|
|
54971
|
+
reset() {
|
|
54972
|
+
|
|
54973
|
+
this._currentTime = performance.now() - this._startTime;
|
|
54974
|
+
|
|
54975
|
+
return this;
|
|
54976
|
+
|
|
54977
|
+
}
|
|
54978
|
+
|
|
54979
|
+
/**
|
|
54980
|
+
* Can be used to free all internal resources. Usually called when
|
|
54981
|
+
* the timer instance isn't required anymore.
|
|
54982
|
+
*/
|
|
54983
|
+
dispose() {
|
|
54984
|
+
|
|
54985
|
+
this.disconnect();
|
|
54986
|
+
|
|
54987
|
+
}
|
|
54988
|
+
|
|
54989
|
+
/**
|
|
54990
|
+
* Updates the internal state of the timer. This method should be called
|
|
54991
|
+
* once per simulation step and before you perform queries against the timer
|
|
54992
|
+
* (e.g. via `getDelta()`).
|
|
54993
|
+
*
|
|
54994
|
+
* @param {number} timestamp - The current time in milliseconds. Can be obtained
|
|
54995
|
+
* from the `requestAnimationFrame` callback argument. If not provided, the current
|
|
54996
|
+
* time will be determined with `performance.now`.
|
|
54997
|
+
* @return {Timer} A reference to this timer.
|
|
54998
|
+
*/
|
|
54999
|
+
update( timestamp ) {
|
|
55000
|
+
|
|
55001
|
+
if ( this._pageVisibilityHandler !== null && this._document.hidden === true ) {
|
|
55002
|
+
|
|
55003
|
+
this._delta = 0;
|
|
55004
|
+
|
|
55005
|
+
} else {
|
|
55006
|
+
|
|
55007
|
+
this._previousTime = this._currentTime;
|
|
55008
|
+
this._currentTime = ( timestamp !== undefined ? timestamp : performance.now() ) - this._startTime;
|
|
55009
|
+
|
|
55010
|
+
this._delta = ( this._currentTime - this._previousTime ) * this._timescale;
|
|
55011
|
+
this._elapsed += this._delta; // _elapsed is the accumulation of all previous deltas
|
|
55012
|
+
|
|
55013
|
+
}
|
|
55014
|
+
|
|
55015
|
+
return this;
|
|
55016
|
+
|
|
55017
|
+
}
|
|
55018
|
+
|
|
55019
|
+
}
|
|
55020
|
+
|
|
55021
|
+
function handleVisibilityChange() {
|
|
55022
|
+
|
|
55023
|
+
if ( this._document.hidden === false ) this.reset();
|
|
55024
|
+
|
|
55025
|
+
}
|
|
55026
|
+
|
|
54632
55027
|
/**
|
|
54633
55028
|
* This class can be used to represent points in 3D space as
|
|
54634
55029
|
* [Spherical coordinates]{@link https://en.wikipedia.org/wiki/Spherical_coordinate_system}.
|
|
@@ -54736,8 +55131,8 @@ class Spherical {
|
|
|
54736
55131
|
* Sets the spherical components from the given Cartesian coordinates.
|
|
54737
55132
|
*
|
|
54738
55133
|
* @param {number} x - The x value.
|
|
54739
|
-
* @param {number} y - The
|
|
54740
|
-
* @param {number} z - The
|
|
55134
|
+
* @param {number} y - The y value.
|
|
55135
|
+
* @param {number} z - The z value.
|
|
54741
55136
|
* @return {Spherical} A reference to this spherical.
|
|
54742
55137
|
*/
|
|
54743
55138
|
setFromCartesianCoords( x, y, z ) {
|
|
@@ -55398,6 +55793,12 @@ class Box2 {
|
|
|
55398
55793
|
const _startP = /*@__PURE__*/ new Vector3();
|
|
55399
55794
|
const _startEnd = /*@__PURE__*/ new Vector3();
|
|
55400
55795
|
|
|
55796
|
+
const _d1 = /*@__PURE__*/ new Vector3();
|
|
55797
|
+
const _d2 = /*@__PURE__*/ new Vector3();
|
|
55798
|
+
const _r = /*@__PURE__*/ new Vector3();
|
|
55799
|
+
const _c1 = /*@__PURE__*/ new Vector3();
|
|
55800
|
+
const _c2 = /*@__PURE__*/ new Vector3();
|
|
55801
|
+
|
|
55401
55802
|
/**
|
|
55402
55803
|
* An analytical line segment in 3D space represented by a start and end point.
|
|
55403
55804
|
*/
|
|
@@ -55545,11 +55946,11 @@ class Line3 {
|
|
|
55545
55946
|
}
|
|
55546
55947
|
|
|
55547
55948
|
/**
|
|
55548
|
-
* Returns the
|
|
55949
|
+
* Returns the closest point on the line for a given point.
|
|
55549
55950
|
*
|
|
55550
55951
|
* @param {Vector3} point - The point to compute the closest point on the line for.
|
|
55551
55952
|
* @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not.
|
|
55552
|
-
* @param {Vector3} target -
|
|
55953
|
+
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
55553
55954
|
* @return {Vector3} The closest point on the line.
|
|
55554
55955
|
*/
|
|
55555
55956
|
closestPointToPoint( point, clampToLine, target ) {
|
|
@@ -55560,6 +55961,127 @@ class Line3 {
|
|
|
55560
55961
|
|
|
55561
55962
|
}
|
|
55562
55963
|
|
|
55964
|
+
/**
|
|
55965
|
+
* Returns the closest squared distance between this line segment and the given one.
|
|
55966
|
+
*
|
|
55967
|
+
* @param {Line3} line - The line segment to compute the closest squared distance to.
|
|
55968
|
+
* @param {Vector3} [c1] - The closest point on this line segment.
|
|
55969
|
+
* @param {Vector3} [c2] - The closest point on the given line segment.
|
|
55970
|
+
* @return {number} The squared distance between this line segment and the given one.
|
|
55971
|
+
*/
|
|
55972
|
+
distanceSqToLine3( line, c1 = _c1, c2 = _c2 ) {
|
|
55973
|
+
|
|
55974
|
+
// from Real-Time Collision Detection by Christer Ericson, chapter 5.1.9
|
|
55975
|
+
|
|
55976
|
+
// Computes closest points C1 and C2 of S1(s)=P1+s*(Q1-P1) and
|
|
55977
|
+
// S2(t)=P2+t*(Q2-P2), returning s and t. Function result is squared
|
|
55978
|
+
// distance between between S1(s) and S2(t)
|
|
55979
|
+
|
|
55980
|
+
const EPSILON = 1e-8 * 1e-8; // must be squared since we compare squared length
|
|
55981
|
+
let s, t;
|
|
55982
|
+
|
|
55983
|
+
const p1 = this.start;
|
|
55984
|
+
const p2 = line.start;
|
|
55985
|
+
const q1 = this.end;
|
|
55986
|
+
const q2 = line.end;
|
|
55987
|
+
|
|
55988
|
+
_d1.subVectors( q1, p1 ); // Direction vector of segment S1
|
|
55989
|
+
_d2.subVectors( q2, p2 ); // Direction vector of segment S2
|
|
55990
|
+
_r.subVectors( p1, p2 );
|
|
55991
|
+
|
|
55992
|
+
const a = _d1.dot( _d1 ); // Squared length of segment S1, always nonnegative
|
|
55993
|
+
const e = _d2.dot( _d2 ); // Squared length of segment S2, always nonnegative
|
|
55994
|
+
const f = _d2.dot( _r );
|
|
55995
|
+
|
|
55996
|
+
// Check if either or both segments degenerate into points
|
|
55997
|
+
|
|
55998
|
+
if ( a <= EPSILON && e <= EPSILON ) {
|
|
55999
|
+
|
|
56000
|
+
// Both segments degenerate into points
|
|
56001
|
+
|
|
56002
|
+
c1.copy( p1 );
|
|
56003
|
+
c2.copy( p2 );
|
|
56004
|
+
|
|
56005
|
+
c1.sub( c2 );
|
|
56006
|
+
|
|
56007
|
+
return c1.dot( c1 );
|
|
56008
|
+
|
|
56009
|
+
}
|
|
56010
|
+
|
|
56011
|
+
if ( a <= EPSILON ) {
|
|
56012
|
+
|
|
56013
|
+
// First segment degenerates into a point
|
|
56014
|
+
|
|
56015
|
+
s = 0;
|
|
56016
|
+
t = f / e; // s = 0 => t = (b*s + f) / e = f / e
|
|
56017
|
+
t = clamp( t, 0, 1 );
|
|
56018
|
+
|
|
56019
|
+
|
|
56020
|
+
} else {
|
|
56021
|
+
|
|
56022
|
+
const c = _d1.dot( _r );
|
|
56023
|
+
|
|
56024
|
+
if ( e <= EPSILON ) {
|
|
56025
|
+
|
|
56026
|
+
// Second segment degenerates into a point
|
|
56027
|
+
|
|
56028
|
+
t = 0;
|
|
56029
|
+
s = clamp( - c / a, 0, 1 ); // t = 0 => s = (b*t - c) / a = -c / a
|
|
56030
|
+
|
|
56031
|
+
} else {
|
|
56032
|
+
|
|
56033
|
+
// The general nondegenerate case starts here
|
|
56034
|
+
|
|
56035
|
+
const b = _d1.dot( _d2 );
|
|
56036
|
+
const denom = a * e - b * b; // Always nonnegative
|
|
56037
|
+
|
|
56038
|
+
// If segments not parallel, compute closest point on L1 to L2 and
|
|
56039
|
+
// clamp to segment S1. Else pick arbitrary s (here 0)
|
|
56040
|
+
|
|
56041
|
+
if ( denom !== 0 ) {
|
|
56042
|
+
|
|
56043
|
+
s = clamp( ( b * f - c * e ) / denom, 0, 1 );
|
|
56044
|
+
|
|
56045
|
+
} else {
|
|
56046
|
+
|
|
56047
|
+
s = 0;
|
|
56048
|
+
|
|
56049
|
+
}
|
|
56050
|
+
|
|
56051
|
+
// Compute point on L2 closest to S1(s) using
|
|
56052
|
+
// t = Dot((P1 + D1*s) - P2,D2) / Dot(D2,D2) = (b*s + f) / e
|
|
56053
|
+
|
|
56054
|
+
t = ( b * s + f ) / e;
|
|
56055
|
+
|
|
56056
|
+
// If t in [0,1] done. Else clamp t, recompute s for the new value
|
|
56057
|
+
// of t using s = Dot((P2 + D2*t) - P1,D1) / Dot(D1,D1)= (t*b - c) / a
|
|
56058
|
+
// and clamp s to [0, 1]
|
|
56059
|
+
|
|
56060
|
+
if ( t < 0 ) {
|
|
56061
|
+
|
|
56062
|
+
t = 0.;
|
|
56063
|
+
s = clamp( - c / a, 0, 1 );
|
|
56064
|
+
|
|
56065
|
+
} else if ( t > 1 ) {
|
|
56066
|
+
|
|
56067
|
+
t = 1;
|
|
56068
|
+
s = clamp( ( b - c ) / a, 0, 1 );
|
|
56069
|
+
|
|
56070
|
+
}
|
|
56071
|
+
|
|
56072
|
+
}
|
|
56073
|
+
|
|
56074
|
+
}
|
|
56075
|
+
|
|
56076
|
+
c1.copy( p1 ).add( _d1.multiplyScalar( s ) );
|
|
56077
|
+
c2.copy( p2 ).add( _d2.multiplyScalar( t ) );
|
|
56078
|
+
|
|
56079
|
+
c1.sub( c2 );
|
|
56080
|
+
|
|
56081
|
+
return c1.dot( c1 );
|
|
56082
|
+
|
|
56083
|
+
}
|
|
56084
|
+
|
|
55563
56085
|
/**
|
|
55564
56086
|
* Applies a 4x4 transformation matrix to this line segment.
|
|
55565
56087
|
*
|
|
@@ -55759,7 +56281,7 @@ const _matrixWorldInv = /*@__PURE__*/ new Matrix4();
|
|
|
55759
56281
|
class SkeletonHelper extends LineSegments {
|
|
55760
56282
|
|
|
55761
56283
|
/**
|
|
55762
|
-
* Constructs a new
|
|
56284
|
+
* Constructs a new skeleton helper.
|
|
55763
56285
|
*
|
|
55764
56286
|
* @param {Object3D} object - Usually an instance of {@link SkinnedMesh}. However, any 3D object
|
|
55765
56287
|
* can be used if it represents a hierarchy of bones (see {@link Bone}).
|
|
@@ -55773,9 +56295,6 @@ class SkeletonHelper extends LineSegments {
|
|
|
55773
56295
|
const vertices = [];
|
|
55774
56296
|
const colors = [];
|
|
55775
56297
|
|
|
55776
|
-
const color1 = new Color( 0, 0, 1 );
|
|
55777
|
-
const color2 = new Color( 0, 1, 0 );
|
|
55778
|
-
|
|
55779
56298
|
for ( let i = 0; i < bones.length; i ++ ) {
|
|
55780
56299
|
|
|
55781
56300
|
const bone = bones[ i ];
|
|
@@ -55784,8 +56303,8 @@ class SkeletonHelper extends LineSegments {
|
|
|
55784
56303
|
|
|
55785
56304
|
vertices.push( 0, 0, 0 );
|
|
55786
56305
|
vertices.push( 0, 0, 0 );
|
|
55787
|
-
colors.push(
|
|
55788
|
-
colors.push(
|
|
56306
|
+
colors.push( 0, 0, 0 );
|
|
56307
|
+
colors.push( 0, 0, 0 );
|
|
55789
56308
|
|
|
55790
56309
|
}
|
|
55791
56310
|
|
|
@@ -55826,6 +56345,13 @@ class SkeletonHelper extends LineSegments {
|
|
|
55826
56345
|
this.matrix = object.matrixWorld;
|
|
55827
56346
|
this.matrixAutoUpdate = false;
|
|
55828
56347
|
|
|
56348
|
+
// colors
|
|
56349
|
+
|
|
56350
|
+
const color1 = new Color( 0x0000ff );
|
|
56351
|
+
const color2 = new Color( 0x00ff00 );
|
|
56352
|
+
|
|
56353
|
+
this.setColors( color1, color2 );
|
|
56354
|
+
|
|
55829
56355
|
}
|
|
55830
56356
|
|
|
55831
56357
|
updateMatrixWorld( force ) {
|
|
@@ -55863,6 +56389,31 @@ class SkeletonHelper extends LineSegments {
|
|
|
55863
56389
|
|
|
55864
56390
|
}
|
|
55865
56391
|
|
|
56392
|
+
/**
|
|
56393
|
+
* Defines the colors of the helper.
|
|
56394
|
+
*
|
|
56395
|
+
* @param {Color} color1 - The first line color for each bone.
|
|
56396
|
+
* @param {Color} color2 - The second line color for each bone.
|
|
56397
|
+
* @return {SkeletonHelper} A reference to this helper.
|
|
56398
|
+
*/
|
|
56399
|
+
setColors( color1, color2 ) {
|
|
56400
|
+
|
|
56401
|
+
const geometry = this.geometry;
|
|
56402
|
+
const colorAttribute = geometry.getAttribute( 'color' );
|
|
56403
|
+
|
|
56404
|
+
for ( let i = 0; i < colorAttribute.count; i += 2 ) {
|
|
56405
|
+
|
|
56406
|
+
colorAttribute.setXYZ( i, color1.r, color1.g, color1.b );
|
|
56407
|
+
colorAttribute.setXYZ( i + 1, color2.r, color2.g, color2.b );
|
|
56408
|
+
|
|
56409
|
+
}
|
|
56410
|
+
|
|
56411
|
+
colorAttribute.needsUpdate = true;
|
|
56412
|
+
|
|
56413
|
+
return this;
|
|
56414
|
+
|
|
56415
|
+
}
|
|
56416
|
+
|
|
55866
56417
|
/**
|
|
55867
56418
|
* Frees the GPU-related resources allocated by this instance. Call this
|
|
55868
56419
|
* method whenever this instance is no longer used in your app.
|
|
@@ -56623,6 +57174,7 @@ class CameraHelper extends LineSegments {
|
|
|
56623
57174
|
* @param {Color} up - The up line color.
|
|
56624
57175
|
* @param {Color} target - The target line color.
|
|
56625
57176
|
* @param {Color} cross - The cross line color.
|
|
57177
|
+
* @return {CameraHelper} A reference to this helper.
|
|
56626
57178
|
*/
|
|
56627
57179
|
setColors( frustum, cone, up, target, cross ) {
|
|
56628
57180
|
|
|
@@ -56679,6 +57231,8 @@ class CameraHelper extends LineSegments {
|
|
|
56679
57231
|
|
|
56680
57232
|
colorAttribute.needsUpdate = true;
|
|
56681
57233
|
|
|
57234
|
+
return this;
|
|
57235
|
+
|
|
56682
57236
|
}
|
|
56683
57237
|
|
|
56684
57238
|
/**
|
|
@@ -56691,17 +57245,44 @@ class CameraHelper extends LineSegments {
|
|
|
56691
57245
|
|
|
56692
57246
|
const w = 1, h = 1;
|
|
56693
57247
|
|
|
57248
|
+
let nearZ, farZ;
|
|
57249
|
+
|
|
56694
57250
|
// we need just camera projection matrix inverse
|
|
56695
57251
|
// world matrix must be identity
|
|
56696
57252
|
|
|
56697
57253
|
_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
|
|
56698
57254
|
|
|
56699
57255
|
// Adjust z values based on coordinate system
|
|
56700
|
-
|
|
57256
|
+
|
|
57257
|
+
if ( this.camera.reversedDepth === true ) {
|
|
57258
|
+
|
|
57259
|
+
nearZ = 1;
|
|
57260
|
+
farZ = 0;
|
|
57261
|
+
|
|
57262
|
+
} else {
|
|
57263
|
+
|
|
57264
|
+
if ( this.camera.coordinateSystem === WebGLCoordinateSystem ) {
|
|
57265
|
+
|
|
57266
|
+
nearZ = -1;
|
|
57267
|
+
farZ = 1;
|
|
57268
|
+
|
|
57269
|
+
} else if ( this.camera.coordinateSystem === WebGPUCoordinateSystem ) {
|
|
57270
|
+
|
|
57271
|
+
nearZ = 0;
|
|
57272
|
+
farZ = 1;
|
|
57273
|
+
|
|
57274
|
+
} else {
|
|
57275
|
+
|
|
57276
|
+
throw new Error( 'THREE.CameraHelper.update(): Invalid coordinate system: ' + this.camera.coordinateSystem );
|
|
57277
|
+
|
|
57278
|
+
}
|
|
57279
|
+
|
|
57280
|
+
}
|
|
57281
|
+
|
|
56701
57282
|
|
|
56702
57283
|
// center / target
|
|
56703
57284
|
setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
|
|
56704
|
-
setPoint( 't', pointMap, geometry, _camera, 0, 0,
|
|
57285
|
+
setPoint( 't', pointMap, geometry, _camera, 0, 0, farZ );
|
|
56705
57286
|
|
|
56706
57287
|
// near
|
|
56707
57288
|
|
|
@@ -56712,10 +57293,10 @@ class CameraHelper extends LineSegments {
|
|
|
56712
57293
|
|
|
56713
57294
|
// far
|
|
56714
57295
|
|
|
56715
|
-
setPoint( 'f1', pointMap, geometry, _camera, -1, -1,
|
|
56716
|
-
setPoint( 'f2', pointMap, geometry, _camera, w, -1,
|
|
56717
|
-
setPoint( 'f3', pointMap, geometry, _camera, -1, h,
|
|
56718
|
-
setPoint( 'f4', pointMap, geometry, _camera, w, h,
|
|
57296
|
+
setPoint( 'f1', pointMap, geometry, _camera, -1, -1, farZ );
|
|
57297
|
+
setPoint( 'f2', pointMap, geometry, _camera, w, -1, farZ );
|
|
57298
|
+
setPoint( 'f3', pointMap, geometry, _camera, -1, h, farZ );
|
|
57299
|
+
setPoint( 'f4', pointMap, geometry, _camera, w, h, farZ );
|
|
56719
57300
|
|
|
56720
57301
|
// up
|
|
56721
57302
|
|
|
@@ -56725,10 +57306,10 @@ class CameraHelper extends LineSegments {
|
|
|
56725
57306
|
|
|
56726
57307
|
// cross
|
|
56727
57308
|
|
|
56728
|
-
setPoint( 'cf1', pointMap, geometry, _camera, -1, 0,
|
|
56729
|
-
setPoint( 'cf2', pointMap, geometry, _camera, w, 0,
|
|
56730
|
-
setPoint( 'cf3', pointMap, geometry, _camera, 0, -1,
|
|
56731
|
-
setPoint( 'cf4', pointMap, geometry, _camera, 0, h,
|
|
57309
|
+
setPoint( 'cf1', pointMap, geometry, _camera, -1, 0, farZ );
|
|
57310
|
+
setPoint( 'cf2', pointMap, geometry, _camera, w, 0, farZ );
|
|
57311
|
+
setPoint( 'cf3', pointMap, geometry, _camera, 0, -1, farZ );
|
|
57312
|
+
setPoint( 'cf4', pointMap, geometry, _camera, 0, h, farZ );
|
|
56732
57313
|
|
|
56733
57314
|
setPoint( 'cn1', pointMap, geometry, _camera, -1, 0, nearZ );
|
|
56734
57315
|
setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
|
|
@@ -58189,6 +58770,10 @@ function WebGLAttributes( gl ) {
|
|
|
58189
58770
|
|
|
58190
58771
|
type = gl.FLOAT;
|
|
58191
58772
|
|
|
58773
|
+
} else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
|
|
58774
|
+
|
|
58775
|
+
type = gl.HALF_FLOAT;
|
|
58776
|
+
|
|
58192
58777
|
} else if ( array instanceof Uint16Array ) {
|
|
58193
58778
|
|
|
58194
58779
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -58575,7 +59160,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
58575
59160
|
|
|
58576
59161
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
58577
59162
|
|
|
58578
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\
|
|
59163
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSEDEPTHBUF\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSEDEPTHBUF\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\t#endif\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";
|
|
58579
59164
|
|
|
58580
59165
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
58581
59166
|
|
|
@@ -58625,7 +59210,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
58625
59210
|
|
|
58626
59211
|
const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
58627
59212
|
|
|
58628
|
-
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
59213
|
+
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSEDEPTHBUF\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
58629
59214
|
|
|
58630
59215
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
58631
59216
|
|
|
@@ -60459,7 +61044,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
60459
61044
|
}
|
|
60460
61045
|
|
|
60461
61046
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
60462
|
-
const
|
|
61047
|
+
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
60463
61048
|
|
|
60464
61049
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
60465
61050
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -60487,7 +61072,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
60487
61072
|
|
|
60488
61073
|
precision: precision,
|
|
60489
61074
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
60490
|
-
|
|
61075
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
60491
61076
|
|
|
60492
61077
|
maxTextures: maxTextures,
|
|
60493
61078
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -61092,6 +61677,17 @@ class PMREMGenerator {
|
|
|
61092
61677
|
renderer.toneMapping = NoToneMapping;
|
|
61093
61678
|
renderer.autoClear = false;
|
|
61094
61679
|
|
|
61680
|
+
// https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812
|
|
61681
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
61682
|
+
|
|
61683
|
+
if ( reversedDepthBuffer ) {
|
|
61684
|
+
|
|
61685
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
61686
|
+
renderer.clearDepth();
|
|
61687
|
+
renderer.setRenderTarget( null );
|
|
61688
|
+
|
|
61689
|
+
}
|
|
61690
|
+
|
|
61095
61691
|
const backgroundMaterial = new MeshBasicMaterial( {
|
|
61096
61692
|
name: 'PMREM.Background',
|
|
61097
61693
|
side: BackSide,
|
|
@@ -63820,7 +64416,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
63820
64416
|
function getShaderErrors( gl, shader, type ) {
|
|
63821
64417
|
|
|
63822
64418
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
63823
|
-
|
|
64419
|
+
|
|
64420
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
64421
|
+
const errors = shaderInfoLog.trim();
|
|
63824
64422
|
|
|
63825
64423
|
if ( status && errors === '' ) return '';
|
|
63826
64424
|
|
|
@@ -64417,7 +65015,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
64417
65015
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
64418
65016
|
|
|
64419
65017
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
64420
|
-
parameters.
|
|
65018
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
64421
65019
|
|
|
64422
65020
|
'uniform mat4 modelMatrix;',
|
|
64423
65021
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -64584,7 +65182,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
64584
65182
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
64585
65183
|
|
|
64586
65184
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
64587
|
-
parameters.
|
|
65185
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
64588
65186
|
|
|
64589
65187
|
'uniform mat4 viewMatrix;',
|
|
64590
65188
|
'uniform vec3 cameraPosition;',
|
|
@@ -64730,9 +65328,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
64730
65328
|
// check for link errors
|
|
64731
65329
|
if ( renderer.debug.checkShaderErrors ) {
|
|
64732
65330
|
|
|
64733
|
-
const
|
|
64734
|
-
const
|
|
64735
|
-
const
|
|
65331
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
65332
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
65333
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
65334
|
+
|
|
65335
|
+
const programLog = programInfoLog.trim();
|
|
65336
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
65337
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
64736
65338
|
|
|
64737
65339
|
let runnable = true;
|
|
64738
65340
|
let haveDiagnostics = true;
|
|
@@ -65119,7 +65721,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65119
65721
|
}
|
|
65120
65722
|
|
|
65121
65723
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
65122
|
-
const
|
|
65724
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
65123
65725
|
|
|
65124
65726
|
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
65125
65727
|
|
|
@@ -65316,11 +65918,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65316
65918
|
useFog: material.fog === true,
|
|
65317
65919
|
fogExp2: ( !! fog && fog.isFogExp2 ),
|
|
65318
65920
|
|
|
65319
|
-
flatShading: material.flatShading === true,
|
|
65921
|
+
flatShading: ( material.flatShading === true && material.wireframe === false ),
|
|
65320
65922
|
|
|
65321
65923
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
65322
65924
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
65323
|
-
|
|
65925
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
65324
65926
|
|
|
65325
65927
|
skinning: object.isSkinnedMesh === true,
|
|
65326
65928
|
|
|
@@ -65529,6 +66131,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65529
66131
|
_programLayers.enable( 20 );
|
|
65530
66132
|
if ( parameters.batchingColor )
|
|
65531
66133
|
_programLayers.enable( 21 );
|
|
66134
|
+
if ( parameters.gradientMap )
|
|
66135
|
+
_programLayers.enable( 22 );
|
|
65532
66136
|
|
|
65533
66137
|
array.push( _programLayers.mask );
|
|
65534
66138
|
_programLayers.disableAll();
|
|
@@ -65541,7 +66145,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
65541
66145
|
_programLayers.enable( 2 );
|
|
65542
66146
|
if ( parameters.logarithmicDepthBuffer )
|
|
65543
66147
|
_programLayers.enable( 3 );
|
|
65544
|
-
if ( parameters.
|
|
66148
|
+
if ( parameters.reversedDepthBuffer )
|
|
65545
66149
|
_programLayers.enable( 4 );
|
|
65546
66150
|
if ( parameters.skinning )
|
|
65547
66151
|
_programLayers.enable( 5 );
|
|
@@ -66710,7 +67314,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
66710
67314
|
|
|
66711
67315
|
// Set GL state for depth map.
|
|
66712
67316
|
_state.setBlending( NoBlending );
|
|
66713
|
-
|
|
67317
|
+
|
|
67318
|
+
if ( _state.buffers.depth.getReversed() ) {
|
|
67319
|
+
|
|
67320
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
67321
|
+
|
|
67322
|
+
} else {
|
|
67323
|
+
|
|
67324
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
67325
|
+
|
|
67326
|
+
}
|
|
67327
|
+
|
|
66714
67328
|
_state.buffers.depth.setTest( true );
|
|
66715
67329
|
_state.setScissorTest( false );
|
|
66716
67330
|
|
|
@@ -67712,7 +68326,7 @@ function WebGLState( gl, extensions ) {
|
|
|
67712
68326
|
break;
|
|
67713
68327
|
|
|
67714
68328
|
case MultiplyBlending:
|
|
67715
|
-
gl.blendFuncSeparate( gl.
|
|
68329
|
+
gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
|
|
67716
68330
|
break;
|
|
67717
68331
|
|
|
67718
68332
|
default:
|
|
@@ -67730,15 +68344,15 @@ function WebGLState( gl, extensions ) {
|
|
|
67730
68344
|
break;
|
|
67731
68345
|
|
|
67732
68346
|
case AdditiveBlending:
|
|
67733
|
-
gl.
|
|
68347
|
+
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
|
|
67734
68348
|
break;
|
|
67735
68349
|
|
|
67736
68350
|
case SubtractiveBlending:
|
|
67737
|
-
|
|
68351
|
+
console.error( 'THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
67738
68352
|
break;
|
|
67739
68353
|
|
|
67740
68354
|
case MultiplyBlending:
|
|
67741
|
-
|
|
68355
|
+
console.error( 'THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
67742
68356
|
break;
|
|
67743
68357
|
|
|
67744
68358
|
default:
|
|
@@ -68888,7 +69502,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68888
69502
|
|
|
68889
69503
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
68890
69504
|
|
|
68891
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
69505
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
68892
69506
|
|
|
68893
69507
|
const image = texture.image;
|
|
68894
69508
|
|
|
@@ -68910,6 +69524,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68910
69524
|
|
|
68911
69525
|
}
|
|
68912
69526
|
|
|
69527
|
+
} else if ( texture.isExternalTexture ) {
|
|
69528
|
+
|
|
69529
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
69530
|
+
|
|
68913
69531
|
}
|
|
68914
69532
|
|
|
68915
69533
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -68920,7 +69538,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68920
69538
|
|
|
68921
69539
|
const textureProperties = properties.get( texture );
|
|
68922
69540
|
|
|
68923
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
69541
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
68924
69542
|
|
|
68925
69543
|
uploadTexture( textureProperties, texture, slot );
|
|
68926
69544
|
return;
|
|
@@ -68935,7 +69553,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
68935
69553
|
|
|
68936
69554
|
const textureProperties = properties.get( texture );
|
|
68937
69555
|
|
|
68938
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
69556
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
68939
69557
|
|
|
68940
69558
|
uploadTexture( textureProperties, texture, slot );
|
|
68941
69559
|
return;
|
|
@@ -70536,13 +71154,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
70536
71154
|
const attachment = textures[ i ];
|
|
70537
71155
|
const attachmentProperties = properties.get( attachment );
|
|
70538
71156
|
|
|
70539
|
-
|
|
70540
|
-
|
|
70541
|
-
|
|
71157
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
71158
|
+
|
|
71159
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
71160
|
+
|
|
71161
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
71162
|
+
|
|
71163
|
+
}
|
|
71164
|
+
|
|
71165
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
71166
|
+
setTextureParameters( glTextureType, attachment );
|
|
71167
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
70542
71168
|
|
|
70543
71169
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
70544
71170
|
|
|
70545
|
-
generateMipmap(
|
|
71171
|
+
generateMipmap( glTextureType );
|
|
70546
71172
|
|
|
70547
71173
|
}
|
|
70548
71174
|
|
|
@@ -71106,6 +71732,48 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
|
71106
71732
|
|
|
71107
71733
|
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
71108
71734
|
|
|
71735
|
+
/**
|
|
71736
|
+
* Represents a texture created externally from the renderer context.
|
|
71737
|
+
*
|
|
71738
|
+
* This may be a texture from a protected media stream, device camera feed,
|
|
71739
|
+
* or other data feeds like a depth sensor.
|
|
71740
|
+
*
|
|
71741
|
+
* Note that this class is only supported in {@link WebGLRenderer} right now.
|
|
71742
|
+
*
|
|
71743
|
+
* @augments Texture
|
|
71744
|
+
*/
|
|
71745
|
+
class ExternalTexture extends Texture {
|
|
71746
|
+
|
|
71747
|
+
/**
|
|
71748
|
+
* Creates a new raw texture.
|
|
71749
|
+
*
|
|
71750
|
+
* @param {?WebGLTexture} [sourceTexture=null] - The external texture.
|
|
71751
|
+
*/
|
|
71752
|
+
constructor( sourceTexture = null ) {
|
|
71753
|
+
|
|
71754
|
+
super();
|
|
71755
|
+
|
|
71756
|
+
/**
|
|
71757
|
+
* The external source texture.
|
|
71758
|
+
*
|
|
71759
|
+
* @type {?WebGLTexture}
|
|
71760
|
+
* @default null
|
|
71761
|
+
*/
|
|
71762
|
+
this.sourceTexture = sourceTexture;
|
|
71763
|
+
|
|
71764
|
+
/**
|
|
71765
|
+
* This flag can be used for type testing.
|
|
71766
|
+
*
|
|
71767
|
+
* @type {boolean}
|
|
71768
|
+
* @readonly
|
|
71769
|
+
* @default true
|
|
71770
|
+
*/
|
|
71771
|
+
this.isExternalTexture = true;
|
|
71772
|
+
|
|
71773
|
+
}
|
|
71774
|
+
|
|
71775
|
+
}
|
|
71776
|
+
|
|
71109
71777
|
const _occlusion_vertex = `
|
|
71110
71778
|
void main() {
|
|
71111
71779
|
|
|
@@ -71145,9 +71813,9 @@ class WebXRDepthSensing {
|
|
|
71145
71813
|
constructor() {
|
|
71146
71814
|
|
|
71147
71815
|
/**
|
|
71148
|
-
*
|
|
71816
|
+
* An opaque texture representing the depth of the user's environment.
|
|
71149
71817
|
*
|
|
71150
|
-
* @type {?
|
|
71818
|
+
* @type {?ExternalTexture}
|
|
71151
71819
|
*/
|
|
71152
71820
|
this.texture = null;
|
|
71153
71821
|
|
|
@@ -71177,18 +71845,14 @@ class WebXRDepthSensing {
|
|
|
71177
71845
|
/**
|
|
71178
71846
|
* Inits the depth sensing module
|
|
71179
71847
|
*
|
|
71180
|
-
* @param {WebGLRenderer} renderer - The renderer.
|
|
71181
71848
|
* @param {XRWebGLDepthInformation} depthData - The XR depth data.
|
|
71182
71849
|
* @param {XRRenderState} renderState - The XR render state.
|
|
71183
71850
|
*/
|
|
71184
|
-
init(
|
|
71851
|
+
init( depthData, renderState ) {
|
|
71185
71852
|
|
|
71186
71853
|
if ( this.texture === null ) {
|
|
71187
71854
|
|
|
71188
|
-
const texture = new
|
|
71189
|
-
|
|
71190
|
-
const texProps = renderer.properties.get( texture );
|
|
71191
|
-
texProps.__webglTexture = depthData.texture;
|
|
71855
|
+
const texture = new ExternalTexture( depthData.texture );
|
|
71192
71856
|
|
|
71193
71857
|
if ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {
|
|
71194
71858
|
|
|
@@ -71249,7 +71913,7 @@ class WebXRDepthSensing {
|
|
|
71249
71913
|
/**
|
|
71250
71914
|
* Returns a texture representing the depth of the user's environment.
|
|
71251
71915
|
*
|
|
71252
|
-
* @return {?
|
|
71916
|
+
* @return {?ExternalTexture} The depth texture.
|
|
71253
71917
|
*/
|
|
71254
71918
|
getDepthTexture() {
|
|
71255
71919
|
|
|
@@ -71302,6 +71966,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
71302
71966
|
let xrFrame = null;
|
|
71303
71967
|
|
|
71304
71968
|
const depthSensing = new WebXRDepthSensing();
|
|
71969
|
+
const cameraAccessTextures = {};
|
|
71305
71970
|
const attributes = gl.getContextAttributes();
|
|
71306
71971
|
|
|
71307
71972
|
let initialRenderTarget = null;
|
|
@@ -71489,6 +72154,11 @@ class WebXRManager extends EventDispatcher {
|
|
|
71489
72154
|
_currentDepthFar = null;
|
|
71490
72155
|
|
|
71491
72156
|
depthSensing.reset();
|
|
72157
|
+
for ( const key in cameraAccessTextures ) {
|
|
72158
|
+
|
|
72159
|
+
delete cameraAccessTextures[ key ];
|
|
72160
|
+
|
|
72161
|
+
}
|
|
71492
72162
|
|
|
71493
72163
|
// restore framebuffer/rendering state
|
|
71494
72164
|
|
|
@@ -71661,9 +72331,15 @@ class WebXRManager extends EventDispatcher {
|
|
|
71661
72331
|
currentPixelRatio = renderer.getPixelRatio();
|
|
71662
72332
|
renderer.getSize( currentSize );
|
|
71663
72333
|
|
|
72334
|
+
if ( typeof XRWebGLBinding !== 'undefined' ) {
|
|
72335
|
+
|
|
72336
|
+
glBinding = new XRWebGLBinding( session, gl );
|
|
72337
|
+
|
|
72338
|
+
}
|
|
72339
|
+
|
|
71664
72340
|
// Check that the browser implements the necessary APIs to use an
|
|
71665
72341
|
// XRProjectionLayer rather than an XRWebGLLayer
|
|
71666
|
-
const useLayers =
|
|
72342
|
+
const useLayers = glBinding !== null && 'createProjectionLayer' in XRWebGLBinding.prototype;
|
|
71667
72343
|
|
|
71668
72344
|
if ( ! useLayers ) {
|
|
71669
72345
|
|
|
@@ -72034,9 +72710,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
72034
72710
|
|
|
72035
72711
|
}
|
|
72036
72712
|
|
|
72037
|
-
|
|
72038
|
-
|
|
72039
|
-
|
|
72713
|
+
// inherit camera layers and enable eye layers (1 = left, 2 = right)
|
|
72714
|
+
cameraXR.layers.mask = camera.layers.mask | 0b110;
|
|
72715
|
+
cameraL.layers.mask = cameraXR.layers.mask & 0b011;
|
|
72716
|
+
cameraR.layers.mask = cameraXR.layers.mask & 0b101;
|
|
72040
72717
|
|
|
72041
72718
|
const cameras = cameraXR.cameras;
|
|
72042
72719
|
var object = poseTarget || camera;
|
|
@@ -72118,7 +72795,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
72118
72795
|
/**
|
|
72119
72796
|
* Returns the amount of foveation used by the XR compositor for the projection layer.
|
|
72120
72797
|
*
|
|
72121
|
-
* @return {number} The amount of foveation.
|
|
72798
|
+
* @return {number|undefined} The amount of foveation.
|
|
72122
72799
|
*/
|
|
72123
72800
|
this.getFoveation = function () {
|
|
72124
72801
|
|
|
@@ -72181,6 +72858,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
72181
72858
|
|
|
72182
72859
|
};
|
|
72183
72860
|
|
|
72861
|
+
/**
|
|
72862
|
+
* Retrieves an opaque texture from the view-aligned {@link XRCamera}.
|
|
72863
|
+
* Only available during the current animation loop.
|
|
72864
|
+
*
|
|
72865
|
+
* @param {XRCamera} xrCamera - The camera to query.
|
|
72866
|
+
* @return {?Texture} An opaque texture representing the current raw camera frame.
|
|
72867
|
+
*/
|
|
72868
|
+
this.getCameraTexture = function ( xrCamera ) {
|
|
72869
|
+
|
|
72870
|
+
return cameraAccessTextures[ xrCamera ];
|
|
72871
|
+
|
|
72872
|
+
};
|
|
72873
|
+
|
|
72184
72874
|
// Animation Loop
|
|
72185
72875
|
|
|
72186
72876
|
let onAnimationFrameCallback = null;
|
|
@@ -72286,7 +72976,42 @@ class WebXRManager extends EventDispatcher {
|
|
|
72286
72976
|
|
|
72287
72977
|
if ( depthData && depthData.isValid && depthData.texture ) {
|
|
72288
72978
|
|
|
72289
|
-
depthSensing.init(
|
|
72979
|
+
depthSensing.init( depthData, session.renderState );
|
|
72980
|
+
|
|
72981
|
+
}
|
|
72982
|
+
|
|
72983
|
+
}
|
|
72984
|
+
|
|
72985
|
+
const cameraAccessEnabled = enabledFeatures &&
|
|
72986
|
+
enabledFeatures.includes( 'camera-access' );
|
|
72987
|
+
|
|
72988
|
+
if ( cameraAccessEnabled ) {
|
|
72989
|
+
|
|
72990
|
+
renderer.state.unbindTexture();
|
|
72991
|
+
|
|
72992
|
+
if ( glBinding ) {
|
|
72993
|
+
|
|
72994
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
72995
|
+
|
|
72996
|
+
const camera = views[ i ].camera;
|
|
72997
|
+
|
|
72998
|
+
if ( camera ) {
|
|
72999
|
+
|
|
73000
|
+
let cameraTex = cameraAccessTextures[ camera ];
|
|
73001
|
+
|
|
73002
|
+
if ( ! cameraTex ) {
|
|
73003
|
+
|
|
73004
|
+
cameraTex = new ExternalTexture();
|
|
73005
|
+
cameraAccessTextures[ camera ] = cameraTex;
|
|
73006
|
+
|
|
73007
|
+
}
|
|
73008
|
+
|
|
73009
|
+
const glTexture = glBinding.getCameraImage( camera );
|
|
73010
|
+
cameraTex.sourceTexture = glTexture;
|
|
73011
|
+
|
|
73012
|
+
}
|
|
73013
|
+
|
|
73014
|
+
}
|
|
72290
73015
|
|
|
72291
73016
|
}
|
|
72292
73017
|
|
|
@@ -73337,7 +74062,7 @@ class WebGLRenderer {
|
|
|
73337
74062
|
preserveDrawingBuffer = false,
|
|
73338
74063
|
powerPreference = 'default',
|
|
73339
74064
|
failIfMajorPerformanceCaveat = false,
|
|
73340
|
-
|
|
74065
|
+
reversedDepthBuffer = false,
|
|
73341
74066
|
multiviewStereo = false,
|
|
73342
74067
|
} = parameters;
|
|
73343
74068
|
|
|
@@ -73571,7 +74296,6 @@ class WebGLRenderer {
|
|
|
73571
74296
|
|
|
73572
74297
|
// camera matrices cache
|
|
73573
74298
|
|
|
73574
|
-
const _currentProjectionMatrix = new Matrix4();
|
|
73575
74299
|
const _projScreenMatrix = new Matrix4();
|
|
73576
74300
|
|
|
73577
74301
|
const _vector3 = new Vector3();
|
|
@@ -73668,7 +74392,7 @@ class WebGLRenderer {
|
|
|
73668
74392
|
|
|
73669
74393
|
state = new WebGLState( _gl, extensions );
|
|
73670
74394
|
|
|
73671
|
-
if ( capabilities.
|
|
74395
|
+
if ( capabilities.reversedDepthBuffer && reversedDepthBuffer ) {
|
|
73672
74396
|
|
|
73673
74397
|
state.buffers.depth.setReversed( true );
|
|
73674
74398
|
|
|
@@ -74817,7 +75541,7 @@ class WebGLRenderer {
|
|
|
74817
75541
|
renderStateStack.push( currentRenderState );
|
|
74818
75542
|
|
|
74819
75543
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
74820
|
-
_frustum.setFromProjectionMatrix( _projScreenMatrix );
|
|
75544
|
+
_frustum.setFromProjectionMatrix( _projScreenMatrix, WebGLCoordinateSystem, camera.reversedDepth );
|
|
74821
75545
|
|
|
74822
75546
|
_localClippingEnabled = this.localClippingEnabled;
|
|
74823
75547
|
_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );
|
|
@@ -75160,6 +75884,9 @@ class WebGLRenderer {
|
|
|
75160
75884
|
//
|
|
75161
75885
|
|
|
75162
75886
|
const currentRenderTarget = _this.getRenderTarget();
|
|
75887
|
+
const currentActiveCubeFace = _this.getActiveCubeFace();
|
|
75888
|
+
const currentActiveMipmapLevel = _this.getActiveMipmapLevel();
|
|
75889
|
+
|
|
75163
75890
|
_this.setRenderTarget( transmissionRenderTarget );
|
|
75164
75891
|
|
|
75165
75892
|
_this.getClearColor( _currentClearColor );
|
|
@@ -75229,7 +75956,7 @@ class WebGLRenderer {
|
|
|
75229
75956
|
|
|
75230
75957
|
}
|
|
75231
75958
|
|
|
75232
|
-
_this.setRenderTarget( currentRenderTarget );
|
|
75959
|
+
_this.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
|
|
75233
75960
|
|
|
75234
75961
|
_this.setClearColor( _currentClearColor, _currentClearAlpha );
|
|
75235
75962
|
|
|
@@ -75661,23 +76388,17 @@ class WebGLRenderer {
|
|
|
75661
76388
|
|
|
75662
76389
|
} else {
|
|
75663
76390
|
|
|
75664
|
-
const
|
|
75665
|
-
|
|
75666
|
-
if ( reverseDepthBuffer ) {
|
|
75667
|
-
|
|
75668
|
-
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
75669
|
-
|
|
75670
|
-
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
75671
|
-
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
75672
|
-
|
|
75673
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
76391
|
+
const reversedDepthBuffer = state.buffers.depth.getReversed();
|
|
75674
76392
|
|
|
75675
|
-
|
|
76393
|
+
if ( reversedDepthBuffer && camera.reversedDepth !== true ) {
|
|
75676
76394
|
|
|
75677
|
-
|
|
76395
|
+
camera._reversedDepth = true;
|
|
76396
|
+
camera.updateProjectionMatrix();
|
|
75678
76397
|
|
|
75679
76398
|
}
|
|
75680
76399
|
|
|
76400
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
76401
|
+
|
|
75681
76402
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
75682
76403
|
|
|
75683
76404
|
}
|
|
@@ -76143,9 +76864,15 @@ class WebGLRenderer {
|
|
|
76143
76864
|
|
|
76144
76865
|
} else if ( isRenderTarget3D ) {
|
|
76145
76866
|
|
|
76146
|
-
const textureProperties = properties.get( renderTarget.texture );
|
|
76147
76867
|
const layer = activeCubeFace;
|
|
76148
|
-
|
|
76868
|
+
|
|
76869
|
+
for ( let i = 0; i < renderTarget.textures.length; i ++ ) {
|
|
76870
|
+
|
|
76871
|
+
const textureProperties = properties.get( renderTarget.textures[ i ] );
|
|
76872
|
+
|
|
76873
|
+
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, textureProperties.__webglTexture, activeMipmapLevel, layer );
|
|
76874
|
+
|
|
76875
|
+
}
|
|
76149
76876
|
|
|
76150
76877
|
} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {
|
|
76151
76878
|
|
|
@@ -76217,7 +76944,7 @@ class WebGLRenderer {
|
|
|
76217
76944
|
|
|
76218
76945
|
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
76219
76946
|
|
|
76220
|
-
// when using MRT, select the
|
|
76947
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
76221
76948
|
|
|
76222
76949
|
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
76223
76950
|
|
|
@@ -76297,7 +77024,7 @@ class WebGLRenderer {
|
|
|
76297
77024
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
76298
77025
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
76299
77026
|
|
|
76300
|
-
// when using MRT, select the
|
|
77027
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
76301
77028
|
|
|
76302
77029
|
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
76303
77030
|
|
|
@@ -77115,6 +77842,7 @@ exports.TetrahedronGeometry = TetrahedronGeometry;
|
|
|
77115
77842
|
exports.Texture = Texture;
|
|
77116
77843
|
exports.TextureLoader = TextureLoader;
|
|
77117
77844
|
exports.TextureUtils = TextureUtils;
|
|
77845
|
+
exports.Timer = Timer;
|
|
77118
77846
|
exports.TimestampQuery = TimestampQuery;
|
|
77119
77847
|
exports.TorusGeometry = TorusGeometry;
|
|
77120
77848
|
exports.TorusKnotGeometry = TorusKnotGeometry;
|