super-three 0.168.0 → 0.169.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +384 -700
- package/build/three.module.js +384 -700
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +24644 -22406
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -6
- package/examples/jsm/controls/TrackballControls.js +32 -12
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +1 -1
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +10 -7
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +29 -10
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +5 -4
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +1 -2
- package/examples/jsm/objects/Water2Mesh.js +2 -3
- package/examples/jsm/objects/WaterMesh.js +1 -2
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +1 -0
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +2 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +2 -1
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +1 -1
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/nodes/NodeLoader.js +24 -4
- package/src/loaders/nodes/NodeMaterialLoader.js +21 -17
- package/src/loaders/nodes/NodeObjectLoader.js +19 -0
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +19 -34
- package/src/materials/nodes/Line2NodeMaterial.js +26 -26
- package/src/materials/nodes/LineBasicNodeMaterial.js +7 -3
- package/src/materials/nodes/LineDashedNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshBasicNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshLambertNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshNormalNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshPhongNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +6 -3
- package/src/materials/nodes/MeshSSSNodeMaterial.js +6 -3
- package/src/materials/nodes/MeshStandardNodeMaterial.js +7 -3
- package/src/materials/nodes/MeshToonNodeMaterial.js +7 -3
- package/src/materials/nodes/NodeMaterial.js +20 -45
- package/src/materials/nodes/NodeMaterials.js +2 -0
- package/src/materials/nodes/PointsNodeMaterial.js +7 -3
- package/src/materials/nodes/ShadowNodeMaterial.js +7 -3
- package/src/materials/nodes/SpriteNodeMaterial.js +39 -6
- package/src/materials/nodes/VolumeNodeMaterial.js +13 -9
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +3 -3
- package/src/nodes/TSL.js +96 -93
- package/src/nodes/accessors/BatchNode.js +7 -3
- package/src/nodes/accessors/BufferAttributeNode.js +6 -3
- package/src/nodes/accessors/BufferNode.js +6 -3
- package/src/nodes/accessors/Camera.js +10 -16
- package/src/nodes/accessors/ClippingNode.js +7 -3
- package/src/nodes/accessors/CubeTextureNode.js +6 -3
- package/src/nodes/accessors/InstanceNode.js +11 -11
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +6 -3
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +8 -4
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -3
- package/src/nodes/accessors/ModelNode.js +42 -7
- package/src/nodes/accessors/ModelViewProjectionNode.js +9 -5
- package/src/nodes/accessors/MorphNode.js +7 -3
- package/src/nodes/accessors/Normal.js +32 -6
- package/src/nodes/accessors/Object3DNode.js +11 -27
- package/src/nodes/accessors/PointUVNode.js +7 -3
- package/src/nodes/accessors/ReferenceBaseNode.js +32 -4
- package/src/nodes/accessors/ReferenceNode.js +40 -3
- package/src/nodes/accessors/RendererReferenceNode.js +9 -3
- package/src/nodes/accessors/SceneNode.js +7 -3
- package/src/nodes/accessors/SkinningNode.js +7 -3
- package/src/nodes/accessors/StorageBufferNode.js +21 -3
- package/src/nodes/accessors/StorageTextureNode.js +7 -4
- package/src/nodes/accessors/Texture3DNode.js +7 -4
- package/src/nodes/accessors/TextureNode.js +19 -8
- package/src/nodes/accessors/TextureSizeNode.js +8 -5
- package/src/nodes/accessors/UniformArrayNode.js +12 -9
- package/src/nodes/accessors/UserDataNode.js +9 -6
- package/src/nodes/accessors/VelocityNode.js +74 -23
- package/src/nodes/accessors/VertexColorNode.js +6 -3
- package/src/nodes/code/CodeNode.js +7 -3
- package/src/nodes/code/ExpressionNode.js +8 -4
- package/src/nodes/code/FunctionCallNode.js +6 -3
- package/src/nodes/code/FunctionNode.js +6 -3
- package/src/nodes/code/ScriptableNode.js +11 -6
- package/src/nodes/code/ScriptableValueNode.js +7 -3
- package/src/nodes/core/AssignNode.js +9 -6
- package/src/nodes/core/AttributeNode.js +7 -3
- package/src/nodes/core/BypassNode.js +8 -4
- package/src/nodes/core/CacheNode.js +8 -4
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +7 -3
- package/src/nodes/core/IndexNode.js +25 -3
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +6 -3
- package/src/nodes/core/Node.js +10 -51
- package/src/nodes/core/NodeBuilder.js +71 -5
- package/src/nodes/core/NodeUtils.js +48 -6
- package/src/nodes/core/OutputStructNode.js +8 -4
- package/src/nodes/core/ParameterNode.js +6 -3
- package/src/nodes/core/PropertyNode.js +7 -3
- package/src/nodes/core/StackNode.js +7 -3
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +10 -6
- package/src/nodes/core/UniformNode.js +6 -3
- package/src/nodes/core/VarNode.js +8 -4
- package/src/nodes/core/VaryingNode.js +7 -3
- package/src/nodes/display/AfterImageNode.js +6 -0
- package/src/nodes/display/AnaglyphPassNode.js +6 -0
- package/src/nodes/display/AnamorphicNode.js +6 -0
- package/src/nodes/display/BloomNode.js +6 -0
- package/src/nodes/display/BumpMapNode.js +6 -0
- package/src/nodes/display/ColorSpaceFunctions.js +4 -4
- package/src/nodes/display/ColorSpaceNode.js +43 -14
- package/src/nodes/display/DenoiseNode.js +6 -3
- package/src/nodes/display/DepthOfFieldNode.js +6 -3
- package/src/nodes/display/DotScreenNode.js +8 -5
- package/src/nodes/display/FXAANode.js +6 -3
- package/src/nodes/display/FilmNode.js +6 -3
- package/src/nodes/display/FrontFacingNode.js +7 -3
- package/src/nodes/display/GTAONode.js +6 -3
- package/src/nodes/display/GaussianBlurNode.js +6 -3
- package/src/nodes/display/Lut3DNode.js +6 -3
- package/src/nodes/display/NormalMapNode.js +8 -6
- package/src/nodes/display/ParallaxBarrierPassNode.js +8 -5
- package/src/nodes/display/PassNode.js +18 -7
- package/src/nodes/display/PixelationPassNode.js +12 -5
- package/src/nodes/display/PosterizeNode.js +6 -3
- package/src/nodes/display/RGBShiftNode.js +6 -3
- package/src/nodes/display/RenderOutputNode.js +12 -8
- package/src/nodes/display/SSAAPassNode.js +6 -3
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/SobelOperatorNode.js +6 -3
- package/src/nodes/display/StereoCompositePassNode.js +6 -3
- package/src/nodes/display/StereoPassNode.js +6 -3
- package/src/nodes/display/ToneMappingFunctions.js +12 -12
- package/src/nodes/display/ToneMappingNode.js +8 -7
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +6 -3
- package/src/nodes/display/ViewportDepthNode.js +7 -3
- package/src/nodes/display/ViewportDepthTextureNode.js +8 -5
- package/src/nodes/display/ViewportSharedTextureNode.js +8 -5
- package/src/nodes/display/ViewportTextureNode.js +8 -5
- package/src/nodes/fog/FogExp2Node.js +6 -3
- package/src/nodes/fog/FogNode.js +7 -3
- package/src/nodes/fog/FogRangeNode.js +6 -3
- package/src/nodes/functions/PhysicalLightingModel.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +7 -3
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +8 -4
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -3
- package/src/nodes/lighting/AnalyticLightNode.js +198 -30
- package/src/nodes/lighting/BasicEnvironmentNode.js +6 -3
- package/src/nodes/lighting/BasicLightMapNode.js +6 -3
- package/src/nodes/lighting/DirectionalLightNode.js +7 -4
- package/src/nodes/lighting/EnvironmentNode.js +6 -3
- package/src/nodes/lighting/HemisphereLightNode.js +10 -6
- package/src/nodes/lighting/IESSpotLightNode.js +6 -3
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +8 -31
- package/src/nodes/lighting/LightingContextNode.js +6 -3
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +24 -5
- package/src/nodes/lighting/PointLightNode.js +11 -7
- package/src/nodes/lighting/RectAreaLightNode.js +11 -7
- package/src/nodes/lighting/SpotLightNode.js +13 -10
- package/src/nodes/math/ConditionalNode.js +23 -6
- package/src/nodes/math/MathNode.js +6 -3
- package/src/nodes/math/OperatorNode.js +6 -3
- package/src/nodes/pmrem/PMREMNode.js +6 -3
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +6 -3
- package/src/nodes/utils/EquirectUVNode.js +6 -3
- package/src/nodes/utils/FlipNode.js +7 -4
- package/src/nodes/utils/FunctionOverloadingNode.js +7 -3
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +7 -3
- package/src/nodes/utils/MatcapUVNode.js +6 -3
- package/src/nodes/utils/MaxMipLevelNode.js +6 -3
- package/src/nodes/utils/OscNode.js +7 -3
- package/src/nodes/utils/RTTNode.js +6 -3
- package/src/nodes/utils/ReflectorNode.js +8 -5
- package/src/nodes/utils/RemapNode.js +7 -3
- package/src/nodes/utils/RotateNode.js +6 -3
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +7 -3
- package/src/nodes/utils/StorageArrayElementNode.js +9 -8
- package/src/nodes/utils/TimerNode.js +6 -3
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -3
- package/src/nodes/utils/ViewportUtils.js +2 -2
- package/src/objects/BatchedMesh.js +76 -10
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +65 -50
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +4 -3
- package/src/renderers/common/RenderContext.js +4 -5
- package/src/renderers/common/RenderObject.js +116 -5
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +57 -49
- package/src/renderers/common/extras/PMREMGenerator.js +7 -9
- package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
- package/src/renderers/common/nodes/Nodes.js +33 -14
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +2 -0
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +22 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +50 -45
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +61 -16
- package/src/renderers/webgpu/WebGPUBackend.js +33 -25
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +5 -2
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/{common → webgpu}/nodes/StandardNodeLibrary.js +11 -11
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +91 -11
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +7 -5
- package/src/renderers/webgpu/utils/WebGPUUtils.js +1 -1
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/display/ViewportNode.js +0 -138
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/renderers/common/StandardRenderer.js +0 -18
- package/src/renderers/webvr/WebVRManager.js +0 -495
- package/src/renderers/webvr/WebVRUtils.js +0 -66
package/build/three.module.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2010-2024 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
const REVISION = '
|
|
6
|
+
const REVISION = '169';
|
|
7
7
|
|
|
8
8
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
9
9
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -1592,6 +1592,38 @@ function probeAsync( gl, sync, interval ) {
|
|
|
1592
1592
|
|
|
1593
1593
|
}
|
|
1594
1594
|
|
|
1595
|
+
function toNormalizedProjectionMatrix( projectionMatrix ) {
|
|
1596
|
+
|
|
1597
|
+
const m = projectionMatrix.elements;
|
|
1598
|
+
|
|
1599
|
+
// Convert [-1, 1] to [0, 1] projection matrix
|
|
1600
|
+
m[ 2 ] = 0.5 * m[ 2 ] + 0.5 * m[ 3 ];
|
|
1601
|
+
m[ 6 ] = 0.5 * m[ 6 ] + 0.5 * m[ 7 ];
|
|
1602
|
+
m[ 10 ] = 0.5 * m[ 10 ] + 0.5 * m[ 11 ];
|
|
1603
|
+
m[ 14 ] = 0.5 * m[ 14 ] + 0.5 * m[ 15 ];
|
|
1604
|
+
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
function toReversedProjectionMatrix( projectionMatrix ) {
|
|
1608
|
+
|
|
1609
|
+
const m = projectionMatrix.elements;
|
|
1610
|
+
const isPerspectiveMatrix = m[ 11 ] === - 1;
|
|
1611
|
+
|
|
1612
|
+
// Reverse [0, 1] projection matrix
|
|
1613
|
+
if ( isPerspectiveMatrix ) {
|
|
1614
|
+
|
|
1615
|
+
m[ 10 ] = - m[ 10 ] - 1;
|
|
1616
|
+
m[ 14 ] = - m[ 14 ];
|
|
1617
|
+
|
|
1618
|
+
} else {
|
|
1619
|
+
|
|
1620
|
+
m[ 10 ] = - m[ 10 ];
|
|
1621
|
+
m[ 14 ] = - m[ 14 ] + 1;
|
|
1622
|
+
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1595
1627
|
/**
|
|
1596
1628
|
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
|
|
1597
1629
|
* or clipping. Based on W3C specifications for sRGB and Display P3,
|
|
@@ -8187,6 +8219,10 @@ const _vap = /*@__PURE__*/ new Vector3();
|
|
|
8187
8219
|
const _vbp = /*@__PURE__*/ new Vector3();
|
|
8188
8220
|
const _vcp = /*@__PURE__*/ new Vector3();
|
|
8189
8221
|
|
|
8222
|
+
const _v40 = /*@__PURE__*/ new Vector4();
|
|
8223
|
+
const _v41 = /*@__PURE__*/ new Vector4();
|
|
8224
|
+
const _v42 = /*@__PURE__*/ new Vector4();
|
|
8225
|
+
|
|
8190
8226
|
class Triangle {
|
|
8191
8227
|
|
|
8192
8228
|
constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
|
|
@@ -8281,6 +8317,25 @@ class Triangle {
|
|
|
8281
8317
|
|
|
8282
8318
|
}
|
|
8283
8319
|
|
|
8320
|
+
static getInterpolatedAttribute( attr, i1, i2, i3, barycoord, target ) {
|
|
8321
|
+
|
|
8322
|
+
_v40.setScalar( 0 );
|
|
8323
|
+
_v41.setScalar( 0 );
|
|
8324
|
+
_v42.setScalar( 0 );
|
|
8325
|
+
|
|
8326
|
+
_v40.fromBufferAttribute( attr, i1 );
|
|
8327
|
+
_v41.fromBufferAttribute( attr, i2 );
|
|
8328
|
+
_v42.fromBufferAttribute( attr, i3 );
|
|
8329
|
+
|
|
8330
|
+
target.setScalar( 0 );
|
|
8331
|
+
target.addScaledVector( _v40, barycoord.x );
|
|
8332
|
+
target.addScaledVector( _v41, barycoord.y );
|
|
8333
|
+
target.addScaledVector( _v42, barycoord.z );
|
|
8334
|
+
|
|
8335
|
+
return target;
|
|
8336
|
+
|
|
8337
|
+
}
|
|
8338
|
+
|
|
8284
8339
|
static isFrontFacing( a, b, c, direction ) {
|
|
8285
8340
|
|
|
8286
8341
|
_v0$2.subVectors( c, b );
|
|
@@ -9896,7 +9951,6 @@ class BufferAttribute {
|
|
|
9896
9951
|
this.normalized = normalized;
|
|
9897
9952
|
|
|
9898
9953
|
this.usage = StaticDrawUsage;
|
|
9899
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
9900
9954
|
this.updateRanges = [];
|
|
9901
9955
|
this.gpuType = FloatType;
|
|
9902
9956
|
|
|
@@ -9912,13 +9966,6 @@ class BufferAttribute {
|
|
|
9912
9966
|
|
|
9913
9967
|
}
|
|
9914
9968
|
|
|
9915
|
-
get updateRange() {
|
|
9916
|
-
|
|
9917
|
-
warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
9918
|
-
return this._updateRange;
|
|
9919
|
-
|
|
9920
|
-
}
|
|
9921
|
-
|
|
9922
9969
|
setUsage( value ) {
|
|
9923
9970
|
|
|
9924
9971
|
this.usage = value;
|
|
@@ -11563,14 +11610,6 @@ const _vC$1 = /*@__PURE__*/ new Vector3();
|
|
|
11563
11610
|
const _tempA = /*@__PURE__*/ new Vector3();
|
|
11564
11611
|
const _morphA = /*@__PURE__*/ new Vector3();
|
|
11565
11612
|
|
|
11566
|
-
const _uvA$1 = /*@__PURE__*/ new Vector2();
|
|
11567
|
-
const _uvB$1 = /*@__PURE__*/ new Vector2();
|
|
11568
|
-
const _uvC$1 = /*@__PURE__*/ new Vector2();
|
|
11569
|
-
|
|
11570
|
-
const _normalA = /*@__PURE__*/ new Vector3();
|
|
11571
|
-
const _normalB = /*@__PURE__*/ new Vector3();
|
|
11572
|
-
const _normalC = /*@__PURE__*/ new Vector3();
|
|
11573
|
-
|
|
11574
11613
|
const _intersectionPoint = /*@__PURE__*/ new Vector3();
|
|
11575
11614
|
const _intersectionPointWorld = /*@__PURE__*/ new Vector3();
|
|
11576
11615
|
|
|
@@ -11913,33 +11952,24 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11913
11952
|
|
|
11914
11953
|
if ( intersection ) {
|
|
11915
11954
|
|
|
11916
|
-
|
|
11955
|
+
const barycoord = new Vector3();
|
|
11956
|
+
Triangle.getBarycoord( _intersectionPoint, _vA$1, _vB$1, _vC$1, barycoord );
|
|
11917
11957
|
|
|
11918
|
-
|
|
11919
|
-
_uvB$1.fromBufferAttribute( uv, b );
|
|
11920
|
-
_uvC$1.fromBufferAttribute( uv, c );
|
|
11958
|
+
if ( uv ) {
|
|
11921
11959
|
|
|
11922
|
-
intersection.uv = Triangle.
|
|
11960
|
+
intersection.uv = Triangle.getInterpolatedAttribute( uv, a, b, c, barycoord, new Vector2() );
|
|
11923
11961
|
|
|
11924
11962
|
}
|
|
11925
11963
|
|
|
11926
11964
|
if ( uv1 ) {
|
|
11927
11965
|
|
|
11928
|
-
|
|
11929
|
-
_uvB$1.fromBufferAttribute( uv1, b );
|
|
11930
|
-
_uvC$1.fromBufferAttribute( uv1, c );
|
|
11931
|
-
|
|
11932
|
-
intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
|
|
11966
|
+
intersection.uv1 = Triangle.getInterpolatedAttribute( uv1, a, b, c, barycoord, new Vector2() );
|
|
11933
11967
|
|
|
11934
11968
|
}
|
|
11935
11969
|
|
|
11936
11970
|
if ( normal ) {
|
|
11937
11971
|
|
|
11938
|
-
|
|
11939
|
-
_normalB.fromBufferAttribute( normal, b );
|
|
11940
|
-
_normalC.fromBufferAttribute( normal, c );
|
|
11941
|
-
|
|
11942
|
-
intersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );
|
|
11972
|
+
intersection.normal = Triangle.getInterpolatedAttribute( normal, a, b, c, barycoord, new Vector3() );
|
|
11943
11973
|
|
|
11944
11974
|
if ( intersection.normal.dot( ray.direction ) > 0 ) {
|
|
11945
11975
|
|
|
@@ -11960,6 +11990,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11960
11990
|
Triangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );
|
|
11961
11991
|
|
|
11962
11992
|
intersection.face = face;
|
|
11993
|
+
intersection.barycoord = barycoord;
|
|
11963
11994
|
|
|
11964
11995
|
}
|
|
11965
11996
|
|
|
@@ -13603,40 +13634,71 @@ function WebGLAttributes( gl ) {
|
|
|
13603
13634
|
function updateBuffer( buffer, attribute, bufferType ) {
|
|
13604
13635
|
|
|
13605
13636
|
const array = attribute.array;
|
|
13606
|
-
const updateRange = attribute._updateRange; // @deprecated, r159
|
|
13607
13637
|
const updateRanges = attribute.updateRanges;
|
|
13608
13638
|
|
|
13609
13639
|
gl.bindBuffer( bufferType, buffer );
|
|
13610
13640
|
|
|
13611
|
-
if (
|
|
13641
|
+
if ( updateRanges.length === 0 ) {
|
|
13612
13642
|
|
|
13613
13643
|
// Not using update ranges
|
|
13614
13644
|
gl.bufferSubData( bufferType, 0, array );
|
|
13615
13645
|
|
|
13616
|
-
}
|
|
13646
|
+
} else {
|
|
13617
13647
|
|
|
13618
|
-
|
|
13648
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
13649
|
+
// ranges to reduce load on `gl.bufferSubData`. Empirically, this has led
|
|
13650
|
+
// to performance improvements for applications which make heavy use of
|
|
13651
|
+
// update ranges. Likely due to GPU command overhead.
|
|
13652
|
+
//
|
|
13653
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
13654
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
13655
|
+
// update ranges once updated.
|
|
13619
13656
|
|
|
13620
|
-
|
|
13657
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
13658
|
+
|
|
13659
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
13660
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
13661
|
+
// array which is smaller than the original. This index tracks the last
|
|
13662
|
+
// index representing a merged range, any data after this index can be
|
|
13663
|
+
// trimmed once the merge algorithm is completed.
|
|
13664
|
+
let mergeIndex = 0;
|
|
13665
|
+
|
|
13666
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
13621
13667
|
|
|
13668
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
13622
13669
|
const range = updateRanges[ i ];
|
|
13623
13670
|
|
|
13624
|
-
|
|
13625
|
-
|
|
13671
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
13672
|
+
// operate over positive integers.
|
|
13673
|
+
if ( range.start <= previousRange.start + previousRange.count + 1 ) {
|
|
13674
|
+
|
|
13675
|
+
previousRange.count = Math.max(
|
|
13676
|
+
previousRange.count,
|
|
13677
|
+
range.start + range.count - previousRange.start
|
|
13678
|
+
);
|
|
13679
|
+
|
|
13680
|
+
} else {
|
|
13681
|
+
|
|
13682
|
+
++ mergeIndex;
|
|
13683
|
+
updateRanges[ mergeIndex ] = range;
|
|
13684
|
+
|
|
13685
|
+
}
|
|
13626
13686
|
|
|
13627
13687
|
}
|
|
13628
13688
|
|
|
13629
|
-
|
|
13689
|
+
// Trim the array to only contain the merged ranges.
|
|
13690
|
+
updateRanges.length = mergeIndex + 1;
|
|
13630
13691
|
|
|
13631
|
-
|
|
13692
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
13693
|
+
|
|
13694
|
+
const range = updateRanges[ i ];
|
|
13632
13695
|
|
|
13633
|
-
|
|
13634
|
-
|
|
13696
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13697
|
+
array, range.start, range.count );
|
|
13635
13698
|
|
|
13636
|
-
|
|
13637
|
-
array, updateRange.offset, updateRange.count );
|
|
13699
|
+
}
|
|
13638
13700
|
|
|
13639
|
-
|
|
13701
|
+
attribute.clearUpdateRanges();
|
|
13640
13702
|
|
|
13641
13703
|
}
|
|
13642
13704
|
|
|
@@ -14097,7 +14159,7 @@ const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <
|
|
|
14097
14159
|
|
|
14098
14160
|
const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
|
|
14099
14161
|
|
|
14100
|
-
const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix
|
|
14162
|
+
const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
|
|
14101
14163
|
|
|
14102
14164
|
const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\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 <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
|
|
14103
14165
|
|
|
@@ -15863,6 +15925,14 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
15863
15925
|
}
|
|
15864
15926
|
|
|
15865
15927
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
15928
|
+
const reverseDepthBuffer = parameters.reverseDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
15929
|
+
|
|
15930
|
+
if ( reverseDepthBuffer === true ) {
|
|
15931
|
+
|
|
15932
|
+
const ext = extensions.get( 'EXT_clip_control' );
|
|
15933
|
+
ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );
|
|
15934
|
+
|
|
15935
|
+
}
|
|
15866
15936
|
|
|
15867
15937
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
15868
15938
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -15890,6 +15960,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
15890
15960
|
|
|
15891
15961
|
precision: precision,
|
|
15892
15962
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
15963
|
+
reverseDepthBuffer: reverseDepthBuffer,
|
|
15893
15964
|
|
|
15894
15965
|
maxTextures: maxTextures,
|
|
15895
15966
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -20006,6 +20077,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20006
20077
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
20007
20078
|
|
|
20008
20079
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20080
|
+
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
20009
20081
|
|
|
20010
20082
|
'uniform mat4 modelMatrix;',
|
|
20011
20083
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -20171,6 +20243,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20171
20243
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
20172
20244
|
|
|
20173
20245
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20246
|
+
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
20174
20247
|
|
|
20175
20248
|
'uniform mat4 viewMatrix;',
|
|
20176
20249
|
'uniform vec3 cameraPosition;',
|
|
@@ -20611,6 +20684,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20611
20684
|
const programs = [];
|
|
20612
20685
|
|
|
20613
20686
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
20687
|
+
const reverseDepthBuffer = capabilities.reverseDepthBuffer;
|
|
20614
20688
|
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
20615
20689
|
|
|
20616
20690
|
let precision = capabilities.precision;
|
|
@@ -20905,6 +20979,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20905
20979
|
|
|
20906
20980
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
20907
20981
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
20982
|
+
reverseDepthBuffer: reverseDepthBuffer,
|
|
20908
20983
|
|
|
20909
20984
|
skinning: object.isSkinnedMesh === true,
|
|
20910
20985
|
|
|
@@ -21124,40 +21199,42 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
21124
21199
|
_programLayers.enable( 2 );
|
|
21125
21200
|
if ( parameters.logarithmicDepthBuffer )
|
|
21126
21201
|
_programLayers.enable( 3 );
|
|
21127
|
-
if ( parameters.
|
|
21202
|
+
if ( parameters.reverseDepthBuffer )
|
|
21128
21203
|
_programLayers.enable( 4 );
|
|
21129
|
-
if ( parameters.
|
|
21204
|
+
if ( parameters.skinning )
|
|
21130
21205
|
_programLayers.enable( 5 );
|
|
21131
|
-
if ( parameters.
|
|
21206
|
+
if ( parameters.morphTargets )
|
|
21132
21207
|
_programLayers.enable( 6 );
|
|
21133
|
-
if ( parameters.
|
|
21208
|
+
if ( parameters.morphNormals )
|
|
21134
21209
|
_programLayers.enable( 7 );
|
|
21135
|
-
if ( parameters.
|
|
21210
|
+
if ( parameters.morphColors )
|
|
21136
21211
|
_programLayers.enable( 8 );
|
|
21137
|
-
if ( parameters.
|
|
21212
|
+
if ( parameters.premultipliedAlpha )
|
|
21138
21213
|
_programLayers.enable( 9 );
|
|
21139
|
-
if ( parameters.
|
|
21214
|
+
if ( parameters.shadowMapEnabled )
|
|
21140
21215
|
_programLayers.enable( 10 );
|
|
21141
|
-
if ( parameters.
|
|
21216
|
+
if ( parameters.doubleSided )
|
|
21142
21217
|
_programLayers.enable( 11 );
|
|
21143
|
-
if ( parameters.
|
|
21218
|
+
if ( parameters.flipSided )
|
|
21144
21219
|
_programLayers.enable( 12 );
|
|
21145
|
-
if ( parameters.
|
|
21220
|
+
if ( parameters.useDepthPacking )
|
|
21146
21221
|
_programLayers.enable( 13 );
|
|
21147
|
-
if ( parameters.
|
|
21222
|
+
if ( parameters.dithering )
|
|
21148
21223
|
_programLayers.enable( 14 );
|
|
21149
|
-
if ( parameters.
|
|
21224
|
+
if ( parameters.transmission )
|
|
21150
21225
|
_programLayers.enable( 15 );
|
|
21151
|
-
if ( parameters.
|
|
21226
|
+
if ( parameters.sheen )
|
|
21152
21227
|
_programLayers.enable( 16 );
|
|
21153
|
-
if ( parameters.
|
|
21228
|
+
if ( parameters.opaque )
|
|
21154
21229
|
_programLayers.enable( 17 );
|
|
21155
|
-
if ( parameters.
|
|
21230
|
+
if ( parameters.pointsUvs )
|
|
21156
21231
|
_programLayers.enable( 18 );
|
|
21157
|
-
if ( parameters.
|
|
21232
|
+
if ( parameters.decodeVideoTexture )
|
|
21158
21233
|
_programLayers.enable( 19 );
|
|
21159
|
-
if ( parameters.
|
|
21234
|
+
if ( parameters.alphaToCoverage )
|
|
21160
21235
|
_programLayers.enable( 20 );
|
|
21236
|
+
if ( parameters.numMultiviewViews )
|
|
21237
|
+
_programLayers.enable( 21 );
|
|
21161
21238
|
|
|
21162
21239
|
array.push( _programLayers.mask );
|
|
21163
21240
|
|
|
@@ -22715,6 +22792,18 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
22715
22792
|
|
|
22716
22793
|
}
|
|
22717
22794
|
|
|
22795
|
+
const reversedFuncs = {
|
|
22796
|
+
[ NeverDepth ]: AlwaysDepth,
|
|
22797
|
+
[ LessDepth ]: GreaterDepth,
|
|
22798
|
+
[ EqualDepth ]: NotEqualDepth,
|
|
22799
|
+
[ LessEqualDepth ]: GreaterEqualDepth,
|
|
22800
|
+
|
|
22801
|
+
[ AlwaysDepth ]: NeverDepth,
|
|
22802
|
+
[ GreaterDepth ]: LessDepth,
|
|
22803
|
+
[ NotEqualDepth ]: EqualDepth,
|
|
22804
|
+
[ GreaterEqualDepth ]: LessEqualDepth,
|
|
22805
|
+
};
|
|
22806
|
+
|
|
22718
22807
|
function WebGLState( gl ) {
|
|
22719
22808
|
|
|
22720
22809
|
function ColorBuffer() {
|
|
@@ -22779,6 +22868,7 @@ function WebGLState( gl ) {
|
|
|
22779
22868
|
function DepthBuffer() {
|
|
22780
22869
|
|
|
22781
22870
|
let locked = false;
|
|
22871
|
+
let reversed = false;
|
|
22782
22872
|
|
|
22783
22873
|
let currentDepthMask = null;
|
|
22784
22874
|
let currentDepthFunc = null;
|
|
@@ -22786,6 +22876,12 @@ function WebGLState( gl ) {
|
|
|
22786
22876
|
|
|
22787
22877
|
return {
|
|
22788
22878
|
|
|
22879
|
+
setReversed: function ( value ) {
|
|
22880
|
+
|
|
22881
|
+
reversed = value;
|
|
22882
|
+
|
|
22883
|
+
},
|
|
22884
|
+
|
|
22789
22885
|
setTest: function ( depthTest ) {
|
|
22790
22886
|
|
|
22791
22887
|
if ( depthTest ) {
|
|
@@ -22813,6 +22909,8 @@ function WebGLState( gl ) {
|
|
|
22813
22909
|
|
|
22814
22910
|
setFunc: function ( depthFunc ) {
|
|
22815
22911
|
|
|
22912
|
+
if ( reversed ) depthFunc = reversedFuncs[ depthFunc ];
|
|
22913
|
+
|
|
22816
22914
|
if ( currentDepthFunc !== depthFunc ) {
|
|
22817
22915
|
|
|
22818
22916
|
switch ( depthFunc ) {
|
|
@@ -24358,6 +24456,28 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24358
24456
|
|
|
24359
24457
|
}
|
|
24360
24458
|
|
|
24459
|
+
if ( glFormat === _gl.RGB_INTEGER ) {
|
|
24460
|
+
|
|
24461
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGB8UI;
|
|
24462
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGB16UI;
|
|
24463
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGB32UI;
|
|
24464
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.RGB8I;
|
|
24465
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.RGB16I;
|
|
24466
|
+
if ( glType === _gl.INT ) internalFormat = _gl.RGB32I;
|
|
24467
|
+
|
|
24468
|
+
}
|
|
24469
|
+
|
|
24470
|
+
if ( glFormat === _gl.RGBA_INTEGER ) {
|
|
24471
|
+
|
|
24472
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGBA8UI;
|
|
24473
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGBA16UI;
|
|
24474
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGBA32UI;
|
|
24475
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.RGBA8I;
|
|
24476
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.RGBA16I;
|
|
24477
|
+
if ( glType === _gl.INT ) internalFormat = _gl.RGBA32I;
|
|
24478
|
+
|
|
24479
|
+
}
|
|
24480
|
+
|
|
24361
24481
|
if ( glFormat === _gl.RGB ) {
|
|
24362
24482
|
|
|
24363
24483
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
@@ -26716,20 +26836,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
26716
26836
|
|
|
26717
26837
|
}
|
|
26718
26838
|
|
|
26719
|
-
class Group extends Object3D {
|
|
26720
|
-
|
|
26721
|
-
constructor() {
|
|
26722
|
-
|
|
26723
|
-
super();
|
|
26724
|
-
|
|
26725
|
-
this.isGroup = true;
|
|
26726
|
-
|
|
26727
|
-
this.type = 'Group';
|
|
26728
|
-
|
|
26729
|
-
}
|
|
26730
|
-
|
|
26731
|
-
}
|
|
26732
|
-
|
|
26733
26839
|
class ArrayCamera extends PerspectiveCamera {
|
|
26734
26840
|
|
|
26735
26841
|
constructor( array = [] ) {
|
|
@@ -26744,553 +26850,6 @@ class ArrayCamera extends PerspectiveCamera {
|
|
|
26744
26850
|
|
|
26745
26851
|
}
|
|
26746
26852
|
|
|
26747
|
-
/**
|
|
26748
|
-
* @author jsantell / https://www.jsantell.com/
|
|
26749
|
-
* @author mrdoob / http://mrdoob.com/
|
|
26750
|
-
*/
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
var cameraLPos = new Vector3();
|
|
26754
|
-
var cameraRPos = new Vector3();
|
|
26755
|
-
|
|
26756
|
-
/**
|
|
26757
|
-
* Assumes 2 cameras that are parallel and share an X-axis, and that
|
|
26758
|
-
* the cameras' projection and world matrices have already been set.
|
|
26759
|
-
* And that near and far planes are identical for both cameras.
|
|
26760
|
-
* Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
|
|
26761
|
-
*/
|
|
26762
|
-
function setProjectionFromUnion( camera, cameraL, cameraR ) {
|
|
26763
|
-
|
|
26764
|
-
cameraLPos.setFromMatrixPosition( cameraL.matrixWorld );
|
|
26765
|
-
cameraRPos.setFromMatrixPosition( cameraR.matrixWorld );
|
|
26766
|
-
|
|
26767
|
-
var ipd = cameraLPos.distanceTo( cameraRPos );
|
|
26768
|
-
|
|
26769
|
-
var projL = cameraL.projectionMatrix.elements;
|
|
26770
|
-
var projR = cameraR.projectionMatrix.elements;
|
|
26771
|
-
|
|
26772
|
-
// VR systems will have identical far and near planes, and
|
|
26773
|
-
// most likely identical top and bottom frustum extents.
|
|
26774
|
-
// Use the left camera for these values.
|
|
26775
|
-
var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
|
|
26776
|
-
var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
|
|
26777
|
-
var topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];
|
|
26778
|
-
var bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];
|
|
26779
|
-
|
|
26780
|
-
var leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];
|
|
26781
|
-
var rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];
|
|
26782
|
-
var left = near * leftFov;
|
|
26783
|
-
var right = near * rightFov;
|
|
26784
|
-
|
|
26785
|
-
// Calculate the new camera's position offset from the
|
|
26786
|
-
// left camera. xOffset should be roughly half `ipd`.
|
|
26787
|
-
var zOffset = ipd / ( - leftFov + rightFov );
|
|
26788
|
-
var xOffset = zOffset * - leftFov;
|
|
26789
|
-
|
|
26790
|
-
// TODO: Better way to apply this offset?
|
|
26791
|
-
cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );
|
|
26792
|
-
camera.translateX( xOffset );
|
|
26793
|
-
camera.translateZ( zOffset );
|
|
26794
|
-
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
|
|
26795
|
-
camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
|
|
26796
|
-
|
|
26797
|
-
// Find the union of the frustum values of the cameras and scale
|
|
26798
|
-
// the values so that the near plane's position does not change in world space,
|
|
26799
|
-
// although must now be relative to the new union camera.
|
|
26800
|
-
var near2 = near + zOffset;
|
|
26801
|
-
var far2 = far + zOffset;
|
|
26802
|
-
var left2 = left - xOffset;
|
|
26803
|
-
var right2 = right + ( ipd - xOffset );
|
|
26804
|
-
var top2 = topFov * far / far2 * near2;
|
|
26805
|
-
var bottom2 = bottomFov * far / far2 * near2;
|
|
26806
|
-
|
|
26807
|
-
camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
|
|
26808
|
-
|
|
26809
|
-
}
|
|
26810
|
-
|
|
26811
|
-
/**
|
|
26812
|
-
* @author mrdoob / http://mrdoob.com/
|
|
26813
|
-
*/
|
|
26814
|
-
|
|
26815
|
-
|
|
26816
|
-
function WebVRManager( renderer ) {
|
|
26817
|
-
|
|
26818
|
-
var renderWidth, renderHeight;
|
|
26819
|
-
var scope = this;
|
|
26820
|
-
|
|
26821
|
-
var device = null;
|
|
26822
|
-
var frameData = null;
|
|
26823
|
-
|
|
26824
|
-
var poseTarget = null;
|
|
26825
|
-
|
|
26826
|
-
var controllers = [];
|
|
26827
|
-
var standingMatrix = new Matrix4();
|
|
26828
|
-
var standingMatrixInverse = new Matrix4();
|
|
26829
|
-
|
|
26830
|
-
var framebufferScaleFactor = 1.0;
|
|
26831
|
-
|
|
26832
|
-
var referenceSpaceType = 'local-floor';
|
|
26833
|
-
|
|
26834
|
-
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
|
|
26835
|
-
|
|
26836
|
-
frameData = new window.VRFrameData();
|
|
26837
|
-
window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
|
|
26838
|
-
|
|
26839
|
-
}
|
|
26840
|
-
|
|
26841
|
-
var matrixWorldInverse = new Matrix4();
|
|
26842
|
-
var tempQuaternion = new Quaternion();
|
|
26843
|
-
var tempPosition = new Vector3();
|
|
26844
|
-
|
|
26845
|
-
var cameraL = new PerspectiveCamera();
|
|
26846
|
-
cameraL.viewport = new Vector4();
|
|
26847
|
-
cameraL.layers.enable( 1 );
|
|
26848
|
-
|
|
26849
|
-
var cameraR = new PerspectiveCamera();
|
|
26850
|
-
cameraR.viewport = new Vector4();
|
|
26851
|
-
cameraR.layers.enable( 2 );
|
|
26852
|
-
|
|
26853
|
-
var cameraVR = new ArrayCamera( [ cameraL, cameraR ] );
|
|
26854
|
-
cameraVR.layers.enable( 1 );
|
|
26855
|
-
cameraVR.layers.enable( 2 );
|
|
26856
|
-
|
|
26857
|
-
var currentSize = new Vector2(), currentPixelRatio;
|
|
26858
|
-
|
|
26859
|
-
function onVRDisplayPresentChange() {
|
|
26860
|
-
|
|
26861
|
-
var isPresenting = scope.isPresenting = device !== null && device.isPresenting === true;
|
|
26862
|
-
|
|
26863
|
-
if ( isPresenting ) {
|
|
26864
|
-
|
|
26865
|
-
var eyeParameters = device.getEyeParameters( 'left' );
|
|
26866
|
-
renderWidth = 2 * eyeParameters.renderWidth * framebufferScaleFactor;
|
|
26867
|
-
renderHeight = eyeParameters.renderHeight * framebufferScaleFactor;
|
|
26868
|
-
|
|
26869
|
-
currentPixelRatio = renderer.getPixelRatio();
|
|
26870
|
-
renderer.getSize( currentSize );
|
|
26871
|
-
|
|
26872
|
-
renderer.setDrawingBufferSize( renderWidth, renderHeight, 1 );
|
|
26873
|
-
|
|
26874
|
-
cameraL.viewport.set( 0, 0, renderWidth / 2, renderHeight );
|
|
26875
|
-
cameraR.viewport.set( renderWidth / 2, 0, renderWidth / 2, renderHeight );
|
|
26876
|
-
|
|
26877
|
-
animation.start();
|
|
26878
|
-
|
|
26879
|
-
scope.dispatchEvent( { type: 'sessionstart' } );
|
|
26880
|
-
|
|
26881
|
-
} else {
|
|
26882
|
-
|
|
26883
|
-
if ( scope.enabled ) {
|
|
26884
|
-
|
|
26885
|
-
renderer.setDrawingBufferSize( currentSize.width, currentSize.height, currentPixelRatio );
|
|
26886
|
-
|
|
26887
|
-
}
|
|
26888
|
-
|
|
26889
|
-
animation.stop();
|
|
26890
|
-
|
|
26891
|
-
scope.dispatchEvent( { type: 'sessionend' } );
|
|
26892
|
-
|
|
26893
|
-
}
|
|
26894
|
-
|
|
26895
|
-
}
|
|
26896
|
-
|
|
26897
|
-
//
|
|
26898
|
-
|
|
26899
|
-
var triggers = [];
|
|
26900
|
-
var grips = [];
|
|
26901
|
-
|
|
26902
|
-
function findGamepad( id ) {
|
|
26903
|
-
|
|
26904
|
-
var gamepads = navigator.getGamepads && navigator.getGamepads();
|
|
26905
|
-
|
|
26906
|
-
for ( var i = 0, l = gamepads.length; i < l; i ++ ) {
|
|
26907
|
-
|
|
26908
|
-
var gamepad = gamepads[ i ];
|
|
26909
|
-
|
|
26910
|
-
if ( gamepad && ( gamepad.id === 'Daydream Controller' ||
|
|
26911
|
-
gamepad.id === 'Gear VR Controller' || gamepad.id === 'Oculus Go Controller' ||
|
|
26912
|
-
gamepad.id === 'OpenVR Gamepad' || gamepad.id.startsWith( 'Oculus Touch' ) ||
|
|
26913
|
-
gamepad.id.startsWith( 'HTC Vive Focus' ) ||
|
|
26914
|
-
gamepad.id.startsWith( 'Spatial Controller' ) ) ) {
|
|
26915
|
-
|
|
26916
|
-
var hand = gamepad.hand;
|
|
26917
|
-
|
|
26918
|
-
if ( id === 0 && ( hand === '' || hand === 'right' ) ) return gamepad;
|
|
26919
|
-
if ( id === 1 && ( hand === 'left' ) ) return gamepad;
|
|
26920
|
-
|
|
26921
|
-
}
|
|
26922
|
-
|
|
26923
|
-
}
|
|
26924
|
-
|
|
26925
|
-
}
|
|
26926
|
-
|
|
26927
|
-
function updateControllers() {
|
|
26928
|
-
|
|
26929
|
-
for ( var i = 0; i < controllers.length; i ++ ) {
|
|
26930
|
-
|
|
26931
|
-
var controller = controllers[ i ];
|
|
26932
|
-
|
|
26933
|
-
var gamepad = findGamepad( i );
|
|
26934
|
-
|
|
26935
|
-
if ( gamepad !== undefined && gamepad.pose !== undefined ) {
|
|
26936
|
-
|
|
26937
|
-
if ( gamepad.pose === null ) return;
|
|
26938
|
-
|
|
26939
|
-
// Pose
|
|
26940
|
-
|
|
26941
|
-
var pose = gamepad.pose;
|
|
26942
|
-
|
|
26943
|
-
if ( pose.hasPosition === false ) controller.position.set( 0.2, - 0.6, - 0.05 );
|
|
26944
|
-
|
|
26945
|
-
if ( pose.position !== null ) controller.position.fromArray( pose.position );
|
|
26946
|
-
if ( pose.orientation !== null ) controller.quaternion.fromArray( pose.orientation );
|
|
26947
|
-
controller.matrix.compose( controller.position, controller.quaternion, controller.scale );
|
|
26948
|
-
controller.matrix.premultiply( standingMatrix );
|
|
26949
|
-
controller.matrix.decompose( controller.position, controller.quaternion, controller.scale );
|
|
26950
|
-
controller.matrixWorldNeedsUpdate = true;
|
|
26951
|
-
controller.visible = true;
|
|
26952
|
-
|
|
26953
|
-
// Trigger
|
|
26954
|
-
|
|
26955
|
-
var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1;
|
|
26956
|
-
|
|
26957
|
-
if ( triggers[ i ] === undefined ) triggers[ i ] = false;
|
|
26958
|
-
|
|
26959
|
-
if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
26960
|
-
|
|
26961
|
-
triggers[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
26962
|
-
|
|
26963
|
-
if ( triggers[ i ] === true ) {
|
|
26964
|
-
|
|
26965
|
-
controller.dispatchEvent( { type: 'selectstart' } );
|
|
26966
|
-
|
|
26967
|
-
} else {
|
|
26968
|
-
|
|
26969
|
-
controller.dispatchEvent( { type: 'selectend' } );
|
|
26970
|
-
controller.dispatchEvent( { type: 'select' } );
|
|
26971
|
-
|
|
26972
|
-
}
|
|
26973
|
-
|
|
26974
|
-
}
|
|
26975
|
-
|
|
26976
|
-
// Grip
|
|
26977
|
-
buttonId = 2;
|
|
26978
|
-
|
|
26979
|
-
if ( grips[ i ] === undefined ) grips[ i ] = false;
|
|
26980
|
-
|
|
26981
|
-
// Skip if the grip button doesn't exist on this controller
|
|
26982
|
-
if ( gamepad.buttons[ buttonId ] !== undefined ) {
|
|
26983
|
-
|
|
26984
|
-
if ( grips[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
26985
|
-
|
|
26986
|
-
grips[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
26987
|
-
|
|
26988
|
-
if ( grips[ i ] === true ) {
|
|
26989
|
-
|
|
26990
|
-
controller.dispatchEvent( { type: 'squeezestart' } );
|
|
26991
|
-
|
|
26992
|
-
} else {
|
|
26993
|
-
|
|
26994
|
-
controller.dispatchEvent( { type: 'squeezeend' } );
|
|
26995
|
-
controller.dispatchEvent( { type: 'squeeze' } );
|
|
26996
|
-
|
|
26997
|
-
}
|
|
26998
|
-
|
|
26999
|
-
}
|
|
27000
|
-
|
|
27001
|
-
}
|
|
27002
|
-
|
|
27003
|
-
} else {
|
|
27004
|
-
|
|
27005
|
-
controller.visible = false;
|
|
27006
|
-
|
|
27007
|
-
}
|
|
27008
|
-
|
|
27009
|
-
}
|
|
27010
|
-
|
|
27011
|
-
}
|
|
27012
|
-
|
|
27013
|
-
function updateViewportFromBounds( viewport, bounds ) {
|
|
27014
|
-
|
|
27015
|
-
if ( bounds !== null && bounds.length === 4 ) {
|
|
27016
|
-
|
|
27017
|
-
viewport.set( bounds[ 0 ] * renderWidth, bounds[ 1 ] * renderHeight, bounds[ 2 ] * renderWidth, bounds[ 3 ] * renderHeight );
|
|
27018
|
-
|
|
27019
|
-
}
|
|
27020
|
-
|
|
27021
|
-
}
|
|
27022
|
-
|
|
27023
|
-
//
|
|
27024
|
-
|
|
27025
|
-
this.enabled = false;
|
|
27026
|
-
|
|
27027
|
-
this.getController = function ( id ) {
|
|
27028
|
-
|
|
27029
|
-
var controller = controllers[ id ];
|
|
27030
|
-
|
|
27031
|
-
if ( controller === undefined ) {
|
|
27032
|
-
|
|
27033
|
-
controller = new Group();
|
|
27034
|
-
controller.matrixAutoUpdate = false;
|
|
27035
|
-
controller.visible = false;
|
|
27036
|
-
|
|
27037
|
-
controllers[ id ] = controller;
|
|
27038
|
-
|
|
27039
|
-
}
|
|
27040
|
-
|
|
27041
|
-
return controller;
|
|
27042
|
-
|
|
27043
|
-
};
|
|
27044
|
-
|
|
27045
|
-
this.getDevice = function () {
|
|
27046
|
-
|
|
27047
|
-
return device;
|
|
27048
|
-
|
|
27049
|
-
};
|
|
27050
|
-
|
|
27051
|
-
this.setDevice = function ( value ) {
|
|
27052
|
-
|
|
27053
|
-
if ( value !== undefined ) device = value;
|
|
27054
|
-
|
|
27055
|
-
animation.setContext( value );
|
|
27056
|
-
|
|
27057
|
-
};
|
|
27058
|
-
|
|
27059
|
-
this.setFramebufferScaleFactor = function ( value ) {
|
|
27060
|
-
|
|
27061
|
-
framebufferScaleFactor = value;
|
|
27062
|
-
|
|
27063
|
-
};
|
|
27064
|
-
|
|
27065
|
-
this.setReferenceSpaceType = function ( value ) {
|
|
27066
|
-
|
|
27067
|
-
referenceSpaceType = value;
|
|
27068
|
-
|
|
27069
|
-
};
|
|
27070
|
-
|
|
27071
|
-
this.setPoseTarget = function ( object ) {
|
|
27072
|
-
|
|
27073
|
-
if ( object !== undefined ) poseTarget = object;
|
|
27074
|
-
|
|
27075
|
-
};
|
|
27076
|
-
|
|
27077
|
-
//
|
|
27078
|
-
|
|
27079
|
-
this.cameraAutoUpdate = true;
|
|
27080
|
-
|
|
27081
|
-
this.updateCamera = function ( camera ) {
|
|
27082
|
-
|
|
27083
|
-
var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
|
|
27084
|
-
|
|
27085
|
-
device.depthNear = camera.near;
|
|
27086
|
-
device.depthFar = camera.far;
|
|
27087
|
-
|
|
27088
|
-
device.getFrameData( frameData );
|
|
27089
|
-
|
|
27090
|
-
//
|
|
27091
|
-
|
|
27092
|
-
if ( referenceSpaceType === 'local-floor' ) {
|
|
27093
|
-
|
|
27094
|
-
var stageParameters = device.stageParameters;
|
|
27095
|
-
|
|
27096
|
-
if ( stageParameters ) {
|
|
27097
|
-
|
|
27098
|
-
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
|
|
27099
|
-
|
|
27100
|
-
} else {
|
|
27101
|
-
|
|
27102
|
-
standingMatrix.makeTranslation( 0, userHeight, 0 );
|
|
27103
|
-
|
|
27104
|
-
}
|
|
27105
|
-
|
|
27106
|
-
}
|
|
27107
|
-
|
|
27108
|
-
|
|
27109
|
-
var pose = frameData.pose;
|
|
27110
|
-
var poseObject = poseTarget !== null ? poseTarget : camera;
|
|
27111
|
-
|
|
27112
|
-
// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
|
|
27113
|
-
poseObject.matrix.copy( standingMatrix );
|
|
27114
|
-
poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
|
|
27115
|
-
|
|
27116
|
-
if ( pose.orientation !== null ) {
|
|
27117
|
-
|
|
27118
|
-
tempQuaternion.fromArray( pose.orientation );
|
|
27119
|
-
poseObject.quaternion.multiply( tempQuaternion );
|
|
27120
|
-
|
|
27121
|
-
}
|
|
27122
|
-
|
|
27123
|
-
if ( pose.position !== null ) {
|
|
27124
|
-
|
|
27125
|
-
tempQuaternion.setFromRotationMatrix( standingMatrix );
|
|
27126
|
-
tempPosition.fromArray( pose.position );
|
|
27127
|
-
tempPosition.applyQuaternion( tempQuaternion );
|
|
27128
|
-
poseObject.position.add( tempPosition );
|
|
27129
|
-
|
|
27130
|
-
}
|
|
27131
|
-
|
|
27132
|
-
poseObject.updateMatrixWorld();
|
|
27133
|
-
|
|
27134
|
-
var children = poseObject.children;
|
|
27135
|
-
for ( var i = 0, l = children.length; i < l; i ++ ) {
|
|
27136
|
-
|
|
27137
|
-
children[ i ].updateMatrixWorld( true );
|
|
27138
|
-
|
|
27139
|
-
}
|
|
27140
|
-
|
|
27141
|
-
//
|
|
27142
|
-
|
|
27143
|
-
cameraL.near = camera.near;
|
|
27144
|
-
cameraR.near = camera.near;
|
|
27145
|
-
|
|
27146
|
-
cameraL.far = camera.far;
|
|
27147
|
-
cameraR.far = camera.far;
|
|
27148
|
-
|
|
27149
|
-
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
27150
|
-
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
27151
|
-
|
|
27152
|
-
// TODO (mrdoob) Double check this code
|
|
27153
|
-
|
|
27154
|
-
standingMatrixInverse.copy( standingMatrix ).invert();
|
|
27155
|
-
|
|
27156
|
-
if ( referenceSpaceType === 'local-floor' ) {
|
|
27157
|
-
|
|
27158
|
-
cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
27159
|
-
cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
27160
|
-
|
|
27161
|
-
}
|
|
27162
|
-
|
|
27163
|
-
var parent = poseObject.parent;
|
|
27164
|
-
|
|
27165
|
-
if ( parent !== null ) {
|
|
27166
|
-
|
|
27167
|
-
matrixWorldInverse.copy( parent.matrixWorld ).invert();
|
|
27168
|
-
|
|
27169
|
-
cameraL.matrixWorldInverse.multiply( matrixWorldInverse );
|
|
27170
|
-
cameraR.matrixWorldInverse.multiply( matrixWorldInverse );
|
|
27171
|
-
|
|
27172
|
-
}
|
|
27173
|
-
|
|
27174
|
-
// envMap and Mirror needs camera.matrixWorld
|
|
27175
|
-
|
|
27176
|
-
cameraL.matrixWorld.copy( cameraL.matrixWorldInverse ).invert();
|
|
27177
|
-
cameraR.matrixWorld.copy( cameraR.matrixWorldInverse ).invert();
|
|
27178
|
-
|
|
27179
|
-
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
|
|
27180
|
-
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
|
|
27181
|
-
|
|
27182
|
-
setProjectionFromUnion( cameraVR, cameraL, cameraR );
|
|
27183
|
-
|
|
27184
|
-
//
|
|
27185
|
-
|
|
27186
|
-
var layers = device.getLayers();
|
|
27187
|
-
|
|
27188
|
-
if ( layers.length ) {
|
|
27189
|
-
|
|
27190
|
-
var layer = layers[ 0 ];
|
|
27191
|
-
|
|
27192
|
-
updateViewportFromBounds( cameraL.viewport, layer.leftBounds );
|
|
27193
|
-
updateViewportFromBounds( cameraR.viewport, layer.rightBounds );
|
|
27194
|
-
|
|
27195
|
-
}
|
|
27196
|
-
|
|
27197
|
-
updateControllers();
|
|
27198
|
-
|
|
27199
|
-
return cameraVR;
|
|
27200
|
-
|
|
27201
|
-
};
|
|
27202
|
-
|
|
27203
|
-
this.getCamera = function () {
|
|
27204
|
-
|
|
27205
|
-
return cameraVR;
|
|
27206
|
-
|
|
27207
|
-
};
|
|
27208
|
-
|
|
27209
|
-
// Dummy getFoveation/setFoveation to have the same API as WebXR
|
|
27210
|
-
|
|
27211
|
-
this.getFoveation = function () {
|
|
27212
|
-
|
|
27213
|
-
return 1;
|
|
27214
|
-
|
|
27215
|
-
};
|
|
27216
|
-
|
|
27217
|
-
this.setFoveation = function ( foveation ) {
|
|
27218
|
-
|
|
27219
|
-
if ( foveation !== 1 ) {
|
|
27220
|
-
|
|
27221
|
-
console.warn( 'THREE.WebVRManager: setFoveation() not used in WebVR.' );
|
|
27222
|
-
|
|
27223
|
-
}
|
|
27224
|
-
|
|
27225
|
-
};
|
|
27226
|
-
|
|
27227
|
-
// Dummy getEnvironmentBlendMode to have the same API as WebXR
|
|
27228
|
-
|
|
27229
|
-
this.getEnvironmentBlendMode = function () {
|
|
27230
|
-
|
|
27231
|
-
if ( scope.isPresenting ) {
|
|
27232
|
-
|
|
27233
|
-
return 'opaque';
|
|
27234
|
-
|
|
27235
|
-
}
|
|
27236
|
-
|
|
27237
|
-
};
|
|
27238
|
-
|
|
27239
|
-
//
|
|
27240
|
-
|
|
27241
|
-
this.getStandingMatrix = function () {
|
|
27242
|
-
|
|
27243
|
-
return standingMatrix;
|
|
27244
|
-
|
|
27245
|
-
};
|
|
27246
|
-
|
|
27247
|
-
this.isPresenting = false;
|
|
27248
|
-
|
|
27249
|
-
// Animation Loop
|
|
27250
|
-
|
|
27251
|
-
var animation = new WebGLAnimation();
|
|
27252
|
-
|
|
27253
|
-
this.setAnimationLoop = function ( callback ) {
|
|
27254
|
-
|
|
27255
|
-
animation.setAnimationLoop( callback );
|
|
27256
|
-
|
|
27257
|
-
if ( this.isPresenting ) animation.start();
|
|
27258
|
-
|
|
27259
|
-
};
|
|
27260
|
-
|
|
27261
|
-
this.submitFrame = function () {
|
|
27262
|
-
|
|
27263
|
-
if ( this.isPresenting ) device.submitFrame();
|
|
27264
|
-
|
|
27265
|
-
};
|
|
27266
|
-
|
|
27267
|
-
this.dispose = function () {
|
|
27268
|
-
|
|
27269
|
-
if ( typeof window !== 'undefined' ) {
|
|
27270
|
-
|
|
27271
|
-
window.removeEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange );
|
|
27272
|
-
|
|
27273
|
-
}
|
|
27274
|
-
|
|
27275
|
-
};
|
|
27276
|
-
|
|
27277
|
-
// DEPRECATED
|
|
27278
|
-
|
|
27279
|
-
this.setFrameOfReferenceType = function () {
|
|
27280
|
-
|
|
27281
|
-
console.warn( 'THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.' );
|
|
27282
|
-
|
|
27283
|
-
};
|
|
27284
|
-
|
|
27285
|
-
}
|
|
27286
|
-
|
|
27287
|
-
Object.assign( WebVRManager.prototype, {
|
|
27288
|
-
addEventListener: EventDispatcher.prototype.addEventListener,
|
|
27289
|
-
hasEventListener: EventDispatcher.prototype.hasEventListener,
|
|
27290
|
-
removeEventListener: EventDispatcher.prototype.removeEventListener,
|
|
27291
|
-
dispatchEvent: EventDispatcher.prototype.dispatchEvent
|
|
27292
|
-
} );
|
|
27293
|
-
|
|
27294
26853
|
/**
|
|
27295
26854
|
* @author fernandojsg / http://fernandojsg.com
|
|
27296
26855
|
* @author Takahiro https://github.com/takahirox
|
|
@@ -27324,6 +26883,20 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
|
27324
26883
|
|
|
27325
26884
|
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
27326
26885
|
|
|
26886
|
+
class Group extends Object3D {
|
|
26887
|
+
|
|
26888
|
+
constructor() {
|
|
26889
|
+
|
|
26890
|
+
super();
|
|
26891
|
+
|
|
26892
|
+
this.isGroup = true;
|
|
26893
|
+
|
|
26894
|
+
this.type = 'Group';
|
|
26895
|
+
|
|
26896
|
+
}
|
|
26897
|
+
|
|
26898
|
+
}
|
|
26899
|
+
|
|
27327
26900
|
const _moveEvent = { type: 'move' };
|
|
27328
26901
|
|
|
27329
26902
|
class WebXRController {
|
|
@@ -29765,6 +29338,7 @@ class WebGLRenderer {
|
|
|
29765
29338
|
|
|
29766
29339
|
// camera matrices cache
|
|
29767
29340
|
|
|
29341
|
+
const _currentProjectionMatrix = new Matrix4();
|
|
29768
29342
|
const _projScreenMatrix = new Matrix4();
|
|
29769
29343
|
|
|
29770
29344
|
const _vector3 = new Vector3();
|
|
@@ -29861,6 +29435,8 @@ class WebGLRenderer {
|
|
|
29861
29435
|
|
|
29862
29436
|
state = new WebGLState( _gl );
|
|
29863
29437
|
|
|
29438
|
+
if ( capabilities.reverseDepthBuffer ) state.buffers.depth.setReversed( true );
|
|
29439
|
+
|
|
29864
29440
|
info = new WebGLInfo( _gl );
|
|
29865
29441
|
properties = new WebGLProperties();
|
|
29866
29442
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
@@ -29900,7 +29476,7 @@ class WebGLRenderer {
|
|
|
29900
29476
|
|
|
29901
29477
|
// xr
|
|
29902
29478
|
|
|
29903
|
-
const xr =
|
|
29479
|
+
const xr = new WebXRManager( _this, _gl );
|
|
29904
29480
|
|
|
29905
29481
|
this.xr = xr;
|
|
29906
29482
|
|
|
@@ -30161,7 +29737,13 @@ class WebGLRenderer {
|
|
|
30161
29737
|
|
|
30162
29738
|
}
|
|
30163
29739
|
|
|
30164
|
-
if ( depth )
|
|
29740
|
+
if ( depth ) {
|
|
29741
|
+
|
|
29742
|
+
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
29743
|
+
_gl.clearDepth( this.capabilities.reverseDepthBuffer ? 0 : 1 );
|
|
29744
|
+
|
|
29745
|
+
}
|
|
29746
|
+
|
|
30165
29747
|
if ( stencil ) {
|
|
30166
29748
|
|
|
30167
29749
|
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -30550,6 +30132,12 @@ class WebGLRenderer {
|
|
|
30550
30132
|
|
|
30551
30133
|
scene.traverse( function ( object ) {
|
|
30552
30134
|
|
|
30135
|
+
if ( ! ( object.isMesh || object.isPoints || object.isLine || object.isSprite ) ) {
|
|
30136
|
+
|
|
30137
|
+
return;
|
|
30138
|
+
|
|
30139
|
+
}
|
|
30140
|
+
|
|
30553
30141
|
const material = object.material;
|
|
30554
30142
|
|
|
30555
30143
|
if ( material ) {
|
|
@@ -30848,13 +30436,6 @@ class WebGLRenderer {
|
|
|
30848
30436
|
|
|
30849
30437
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
30850
30438
|
|
|
30851
|
-
textures.runDeferredUploads();
|
|
30852
|
-
|
|
30853
|
-
if ( xr.enabled && xr.submitFrame ) {
|
|
30854
|
-
|
|
30855
|
-
xr.submitFrame();
|
|
30856
|
-
|
|
30857
|
-
}
|
|
30858
30439
|
// _gl.finish();
|
|
30859
30440
|
|
|
30860
30441
|
bindingStates.resetDefaultState();
|
|
@@ -31567,7 +31148,21 @@ class WebGLRenderer {
|
|
|
31567
31148
|
|
|
31568
31149
|
} else {
|
|
31569
31150
|
|
|
31570
|
-
|
|
31151
|
+
if ( capabilities.reverseDepthBuffer ) {
|
|
31152
|
+
|
|
31153
|
+
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
31154
|
+
|
|
31155
|
+
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
31156
|
+
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
31157
|
+
|
|
31158
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
31159
|
+
|
|
31160
|
+
} else {
|
|
31161
|
+
|
|
31162
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
31163
|
+
|
|
31164
|
+
}
|
|
31165
|
+
|
|
31571
31166
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
31572
31167
|
|
|
31573
31168
|
}
|
|
@@ -32085,61 +31680,55 @@ class WebGLRenderer {
|
|
|
32085
31680
|
|
|
32086
31681
|
if ( framebuffer ) {
|
|
32087
31682
|
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
|
|
32091
|
-
|
|
32092
|
-
const texture = renderTarget.texture;
|
|
32093
|
-
const textureFormat = texture.format;
|
|
32094
|
-
const textureType = texture.type;
|
|
32095
|
-
|
|
32096
|
-
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
31683
|
+
const texture = renderTarget.texture;
|
|
31684
|
+
const textureFormat = texture.format;
|
|
31685
|
+
const textureType = texture.type;
|
|
32097
31686
|
|
|
32098
|
-
|
|
31687
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
32099
31688
|
|
|
32100
|
-
|
|
31689
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
32101
31690
|
|
|
32102
|
-
|
|
31691
|
+
}
|
|
32103
31692
|
|
|
32104
|
-
|
|
31693
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
32105
31694
|
|
|
32106
|
-
|
|
31695
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
32107
31696
|
|
|
32108
|
-
|
|
32109
|
-
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32110
|
-
|
|
32111
|
-
const glBuffer = _gl.createBuffer();
|
|
32112
|
-
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32113
|
-
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
32114
|
-
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32115
|
-
_gl.flush();
|
|
31697
|
+
}
|
|
32116
31698
|
|
|
32117
|
-
|
|
32118
|
-
|
|
32119
|
-
await probeAsync( _gl, sync, 4 );
|
|
31699
|
+
// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
|
|
31700
|
+
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32120
31701
|
|
|
32121
|
-
|
|
31702
|
+
// set the active frame buffer to the one we want to read
|
|
31703
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
32122
31704
|
|
|
32123
|
-
|
|
32124
|
-
|
|
31705
|
+
const glBuffer = _gl.createBuffer();
|
|
31706
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
31707
|
+
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
31708
|
+
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32125
31709
|
|
|
32126
|
-
|
|
31710
|
+
// reset the frame buffer to the currently set buffer before waiting
|
|
31711
|
+
const currFramebuffer = _currentRenderTarget !== null ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
31712
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, currFramebuffer );
|
|
32127
31713
|
|
|
32128
|
-
|
|
32129
|
-
|
|
31714
|
+
// check if the commands have finished every 8 ms
|
|
31715
|
+
const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
|
|
32130
31716
|
|
|
32131
|
-
|
|
31717
|
+
_gl.flush();
|
|
32132
31718
|
|
|
32133
|
-
|
|
31719
|
+
await probeAsync( _gl, sync, 4 );
|
|
32134
31720
|
|
|
32135
|
-
|
|
31721
|
+
// read the data and delete the buffer
|
|
31722
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
31723
|
+
_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
|
|
31724
|
+
_gl.deleteBuffer( glBuffer );
|
|
31725
|
+
_gl.deleteSync( sync );
|
|
32136
31726
|
|
|
32137
|
-
|
|
31727
|
+
return buffer;
|
|
32138
31728
|
|
|
32139
|
-
|
|
31729
|
+
} else {
|
|
32140
31730
|
|
|
32141
|
-
|
|
32142
|
-
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
31731
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.' );
|
|
32143
31732
|
|
|
32144
31733
|
}
|
|
32145
31734
|
|
|
@@ -32625,7 +32214,6 @@ class InterleavedBuffer {
|
|
|
32625
32214
|
this.count = array !== undefined ? array.length / stride : 0;
|
|
32626
32215
|
|
|
32627
32216
|
this.usage = StaticDrawUsage;
|
|
32628
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
32629
32217
|
this.updateRanges = [];
|
|
32630
32218
|
|
|
32631
32219
|
this.version = 0;
|
|
@@ -32642,13 +32230,6 @@ class InterleavedBuffer {
|
|
|
32642
32230
|
|
|
32643
32231
|
}
|
|
32644
32232
|
|
|
32645
|
-
get updateRange() {
|
|
32646
|
-
|
|
32647
|
-
warnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
32648
|
-
return this._updateRange;
|
|
32649
|
-
|
|
32650
|
-
}
|
|
32651
|
-
|
|
32652
32233
|
setUsage( value ) {
|
|
32653
32234
|
|
|
32654
32235
|
this.usage = value;
|
|
@@ -33413,6 +32994,27 @@ class LOD extends Object3D {
|
|
|
33413
32994
|
|
|
33414
32995
|
}
|
|
33415
32996
|
|
|
32997
|
+
removeLevel( distance ) {
|
|
32998
|
+
|
|
32999
|
+
const levels = this.levels;
|
|
33000
|
+
|
|
33001
|
+
for ( let i = 0; i < levels.length; i ++ ) {
|
|
33002
|
+
|
|
33003
|
+
if ( levels[ i ].distance === distance ) {
|
|
33004
|
+
|
|
33005
|
+
const removedElements = levels.splice( i, 1 );
|
|
33006
|
+
this.remove( removedElements[ 0 ].object );
|
|
33007
|
+
|
|
33008
|
+
return true;
|
|
33009
|
+
|
|
33010
|
+
}
|
|
33011
|
+
|
|
33012
|
+
}
|
|
33013
|
+
|
|
33014
|
+
return false;
|
|
33015
|
+
|
|
33016
|
+
}
|
|
33017
|
+
|
|
33416
33018
|
getCurrentLevel() {
|
|
33417
33019
|
|
|
33418
33020
|
return this._currentLevel;
|
|
@@ -34532,6 +34134,9 @@ class BatchedMesh extends Mesh {
|
|
|
34532
34134
|
// stores visible, active, and geometry id per object
|
|
34533
34135
|
this._drawInfo = [];
|
|
34534
34136
|
|
|
34137
|
+
// instance ids that have been set as inactive, and are available to be overwritten
|
|
34138
|
+
this._availableInstanceIds = [];
|
|
34139
|
+
|
|
34535
34140
|
// geometry information
|
|
34536
34141
|
this._drawRanges = [];
|
|
34537
34142
|
this._reservedRanges = [];
|
|
@@ -34731,23 +34336,36 @@ class BatchedMesh extends Mesh {
|
|
|
34731
34336
|
|
|
34732
34337
|
addInstance( geometryId ) {
|
|
34733
34338
|
|
|
34339
|
+
const atCapacity = this._drawInfo.length >= this.maxInstanceCount;
|
|
34340
|
+
|
|
34734
34341
|
// ensure we're not over geometry
|
|
34735
|
-
if ( this.
|
|
34342
|
+
if ( atCapacity && this._availableInstanceIds.length === 0 ) {
|
|
34736
34343
|
|
|
34737
34344
|
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34738
34345
|
|
|
34739
34346
|
}
|
|
34740
34347
|
|
|
34741
|
-
|
|
34742
|
-
|
|
34348
|
+
const instanceDrawInfo = {
|
|
34743
34349
|
visible: true,
|
|
34744
34350
|
active: true,
|
|
34745
34351
|
geometryIndex: geometryId,
|
|
34352
|
+
};
|
|
34746
34353
|
|
|
34747
|
-
|
|
34354
|
+
let drawId = null;
|
|
34355
|
+
|
|
34356
|
+
// Prioritize using previously freed instance ids
|
|
34357
|
+
if ( this._availableInstanceIds.length > 0 ) {
|
|
34358
|
+
|
|
34359
|
+
drawId = this._availableInstanceIds.pop();
|
|
34360
|
+
this._drawInfo[ drawId ] = instanceDrawInfo;
|
|
34361
|
+
|
|
34362
|
+
} else {
|
|
34363
|
+
|
|
34364
|
+
drawId = this._drawInfo.length;
|
|
34365
|
+
this._drawInfo.push( instanceDrawInfo );
|
|
34366
|
+
|
|
34367
|
+
}
|
|
34748
34368
|
|
|
34749
|
-
// initialize the matrix
|
|
34750
|
-
const drawId = this._drawInfo.length - 1;
|
|
34751
34369
|
const matricesTexture = this._matricesTexture;
|
|
34752
34370
|
const matricesArray = matricesTexture.image.data;
|
|
34753
34371
|
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
@@ -34996,11 +34614,8 @@ class BatchedMesh extends Mesh {
|
|
|
34996
34614
|
}
|
|
34997
34615
|
*/
|
|
34998
34616
|
|
|
34999
|
-
/*
|
|
35000
34617
|
deleteInstance( instanceId ) {
|
|
35001
34618
|
|
|
35002
|
-
// Note: User needs to call optimize() afterward to pack the data.
|
|
35003
|
-
|
|
35004
34619
|
const drawInfo = this._drawInfo;
|
|
35005
34620
|
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35006
34621
|
|
|
@@ -35009,12 +34624,12 @@ class BatchedMesh extends Mesh {
|
|
|
35009
34624
|
}
|
|
35010
34625
|
|
|
35011
34626
|
drawInfo[ instanceId ].active = false;
|
|
34627
|
+
this._availableInstanceIds.push( instanceId );
|
|
35012
34628
|
this._visibilityChanged = true;
|
|
35013
34629
|
|
|
35014
34630
|
return this;
|
|
35015
34631
|
|
|
35016
34632
|
}
|
|
35017
|
-
*/
|
|
35018
34633
|
|
|
35019
34634
|
// get bounding box and compute it if it doesn't exist
|
|
35020
34635
|
getBoundingBoxAt( geometryId, target ) {
|
|
@@ -35219,6 +34834,59 @@ class BatchedMesh extends Mesh {
|
|
|
35219
34834
|
|
|
35220
34835
|
}
|
|
35221
34836
|
|
|
34837
|
+
setGeometryIdAt( instanceId, geometryId ) {
|
|
34838
|
+
|
|
34839
|
+
// return early if the geometry is out of range or not active
|
|
34840
|
+
const drawInfo = this._drawInfo;
|
|
34841
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34842
|
+
|
|
34843
|
+
return null;
|
|
34844
|
+
|
|
34845
|
+
}
|
|
34846
|
+
|
|
34847
|
+
// check if the provided geometryId is within the valid range
|
|
34848
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
34849
|
+
|
|
34850
|
+
return null;
|
|
34851
|
+
|
|
34852
|
+
}
|
|
34853
|
+
|
|
34854
|
+
drawInfo[ instanceId ].geometryIndex = geometryId;
|
|
34855
|
+
|
|
34856
|
+
return this;
|
|
34857
|
+
|
|
34858
|
+
}
|
|
34859
|
+
|
|
34860
|
+
getGeometryIdAt( instanceId ) {
|
|
34861
|
+
|
|
34862
|
+
const drawInfo = this._drawInfo;
|
|
34863
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34864
|
+
|
|
34865
|
+
return - 1;
|
|
34866
|
+
|
|
34867
|
+
}
|
|
34868
|
+
|
|
34869
|
+
return drawInfo[ instanceId ].geometryIndex;
|
|
34870
|
+
|
|
34871
|
+
}
|
|
34872
|
+
|
|
34873
|
+
getGeometryRangeAt( geometryId, target = {} ) {
|
|
34874
|
+
|
|
34875
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
34876
|
+
|
|
34877
|
+
return null;
|
|
34878
|
+
|
|
34879
|
+
}
|
|
34880
|
+
|
|
34881
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34882
|
+
|
|
34883
|
+
target.start = drawRange.start;
|
|
34884
|
+
target.count = drawRange.count;
|
|
34885
|
+
|
|
34886
|
+
return target;
|
|
34887
|
+
|
|
34888
|
+
}
|
|
34889
|
+
|
|
35222
34890
|
raycast( raycaster, intersects ) {
|
|
35223
34891
|
|
|
35224
34892
|
const drawInfo = this._drawInfo;
|
|
@@ -35770,6 +35438,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
35770
35438
|
index: a,
|
|
35771
35439
|
face: null,
|
|
35772
35440
|
faceIndex: null,
|
|
35441
|
+
barycoord: null,
|
|
35773
35442
|
object: object
|
|
35774
35443
|
|
|
35775
35444
|
};
|
|
@@ -36035,6 +35704,8 @@ function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, inte
|
|
|
36035
35704
|
point: intersectPoint,
|
|
36036
35705
|
index: index,
|
|
36037
35706
|
face: null,
|
|
35707
|
+
faceIndex: null,
|
|
35708
|
+
barycoord: null,
|
|
36038
35709
|
object: object
|
|
36039
35710
|
|
|
36040
35711
|
} );
|
|
@@ -38537,12 +38208,19 @@ class CylinderGeometry extends BufferGeometry {
|
|
|
38537
38208
|
|
|
38538
38209
|
// faces
|
|
38539
38210
|
|
|
38540
|
-
|
|
38541
|
-
indices.push( b, c, d );
|
|
38211
|
+
if ( radiusTop > 0 ) {
|
|
38542
38212
|
|
|
38543
|
-
|
|
38213
|
+
indices.push( a, b, d );
|
|
38214
|
+
groupCount += 3;
|
|
38544
38215
|
|
|
38545
|
-
|
|
38216
|
+
}
|
|
38217
|
+
|
|
38218
|
+
if ( radiusBottom > 0 ) {
|
|
38219
|
+
|
|
38220
|
+
indices.push( b, c, d );
|
|
38221
|
+
groupCount += 3;
|
|
38222
|
+
|
|
38223
|
+
}
|
|
38546
38224
|
|
|
38547
38225
|
}
|
|
38548
38226
|
|
|
@@ -46852,7 +46530,7 @@ class MaterialLoader extends Loader {
|
|
|
46852
46530
|
|
|
46853
46531
|
}
|
|
46854
46532
|
|
|
46855
|
-
const material =
|
|
46533
|
+
const material = this.createMaterialFromType( json.type );
|
|
46856
46534
|
|
|
46857
46535
|
if ( json.uuid !== undefined ) material.uuid = json.uuid;
|
|
46858
46536
|
if ( json.name !== undefined ) material.name = json.name;
|
|
@@ -47108,6 +46786,12 @@ class MaterialLoader extends Loader {
|
|
|
47108
46786
|
|
|
47109
46787
|
}
|
|
47110
46788
|
|
|
46789
|
+
createMaterialFromType( type ) {
|
|
46790
|
+
|
|
46791
|
+
return MaterialLoader.createMaterialFromType( type );
|
|
46792
|
+
|
|
46793
|
+
}
|
|
46794
|
+
|
|
47111
46795
|
static createMaterialFromType( type ) {
|
|
47112
46796
|
|
|
47113
46797
|
const materialLib = {
|
|
@@ -48953,7 +48637,7 @@ class Clock {
|
|
|
48953
48637
|
|
|
48954
48638
|
function now() {
|
|
48955
48639
|
|
|
48956
|
-
return
|
|
48640
|
+
return performance.now();
|
|
48957
48641
|
|
|
48958
48642
|
}
|
|
48959
48643
|
|
|
@@ -49245,7 +48929,7 @@ class Audio extends Object3D {
|
|
|
49245
48929
|
|
|
49246
48930
|
}
|
|
49247
48931
|
|
|
49248
|
-
stop() {
|
|
48932
|
+
stop( delay = 0 ) {
|
|
49249
48933
|
|
|
49250
48934
|
if ( this.hasPlaybackControl === false ) {
|
|
49251
48935
|
|
|
@@ -49258,7 +48942,7 @@ class Audio extends Object3D {
|
|
|
49258
48942
|
|
|
49259
48943
|
if ( this.source !== null ) {
|
|
49260
48944
|
|
|
49261
|
-
this.source.stop();
|
|
48945
|
+
this.source.stop( this.context.currentTime + delay );
|
|
49262
48946
|
this.source.onended = null;
|
|
49263
48947
|
|
|
49264
48948
|
}
|
|
@@ -54900,7 +54584,7 @@ class ShapePath {
|
|
|
54900
54584
|
|
|
54901
54585
|
class Controls extends EventDispatcher {
|
|
54902
54586
|
|
|
54903
|
-
constructor( object, domElement ) {
|
|
54587
|
+
constructor( object, domElement = null ) {
|
|
54904
54588
|
|
|
54905
54589
|
super();
|
|
54906
54590
|
|