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.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '169';
|
|
9
9
|
|
|
10
10
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
11
11
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -1594,6 +1594,38 @@ function probeAsync( gl, sync, interval ) {
|
|
|
1594
1594
|
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
|
+
function toNormalizedProjectionMatrix( projectionMatrix ) {
|
|
1598
|
+
|
|
1599
|
+
const m = projectionMatrix.elements;
|
|
1600
|
+
|
|
1601
|
+
// Convert [-1, 1] to [0, 1] projection matrix
|
|
1602
|
+
m[ 2 ] = 0.5 * m[ 2 ] + 0.5 * m[ 3 ];
|
|
1603
|
+
m[ 6 ] = 0.5 * m[ 6 ] + 0.5 * m[ 7 ];
|
|
1604
|
+
m[ 10 ] = 0.5 * m[ 10 ] + 0.5 * m[ 11 ];
|
|
1605
|
+
m[ 14 ] = 0.5 * m[ 14 ] + 0.5 * m[ 15 ];
|
|
1606
|
+
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
function toReversedProjectionMatrix( projectionMatrix ) {
|
|
1610
|
+
|
|
1611
|
+
const m = projectionMatrix.elements;
|
|
1612
|
+
const isPerspectiveMatrix = m[ 11 ] === - 1;
|
|
1613
|
+
|
|
1614
|
+
// Reverse [0, 1] projection matrix
|
|
1615
|
+
if ( isPerspectiveMatrix ) {
|
|
1616
|
+
|
|
1617
|
+
m[ 10 ] = - m[ 10 ] - 1;
|
|
1618
|
+
m[ 14 ] = - m[ 14 ];
|
|
1619
|
+
|
|
1620
|
+
} else {
|
|
1621
|
+
|
|
1622
|
+
m[ 10 ] = - m[ 10 ];
|
|
1623
|
+
m[ 14 ] = - m[ 14 ] + 1;
|
|
1624
|
+
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1597
1629
|
/**
|
|
1598
1630
|
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
|
|
1599
1631
|
* or clipping. Based on W3C specifications for sRGB and Display P3,
|
|
@@ -8189,6 +8221,10 @@ const _vap = /*@__PURE__*/ new Vector3();
|
|
|
8189
8221
|
const _vbp = /*@__PURE__*/ new Vector3();
|
|
8190
8222
|
const _vcp = /*@__PURE__*/ new Vector3();
|
|
8191
8223
|
|
|
8224
|
+
const _v40 = /*@__PURE__*/ new Vector4();
|
|
8225
|
+
const _v41 = /*@__PURE__*/ new Vector4();
|
|
8226
|
+
const _v42 = /*@__PURE__*/ new Vector4();
|
|
8227
|
+
|
|
8192
8228
|
class Triangle {
|
|
8193
8229
|
|
|
8194
8230
|
constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
|
|
@@ -8283,6 +8319,25 @@ class Triangle {
|
|
|
8283
8319
|
|
|
8284
8320
|
}
|
|
8285
8321
|
|
|
8322
|
+
static getInterpolatedAttribute( attr, i1, i2, i3, barycoord, target ) {
|
|
8323
|
+
|
|
8324
|
+
_v40.setScalar( 0 );
|
|
8325
|
+
_v41.setScalar( 0 );
|
|
8326
|
+
_v42.setScalar( 0 );
|
|
8327
|
+
|
|
8328
|
+
_v40.fromBufferAttribute( attr, i1 );
|
|
8329
|
+
_v41.fromBufferAttribute( attr, i2 );
|
|
8330
|
+
_v42.fromBufferAttribute( attr, i3 );
|
|
8331
|
+
|
|
8332
|
+
target.setScalar( 0 );
|
|
8333
|
+
target.addScaledVector( _v40, barycoord.x );
|
|
8334
|
+
target.addScaledVector( _v41, barycoord.y );
|
|
8335
|
+
target.addScaledVector( _v42, barycoord.z );
|
|
8336
|
+
|
|
8337
|
+
return target;
|
|
8338
|
+
|
|
8339
|
+
}
|
|
8340
|
+
|
|
8286
8341
|
static isFrontFacing( a, b, c, direction ) {
|
|
8287
8342
|
|
|
8288
8343
|
_v0$2.subVectors( c, b );
|
|
@@ -9898,7 +9953,6 @@ class BufferAttribute {
|
|
|
9898
9953
|
this.normalized = normalized;
|
|
9899
9954
|
|
|
9900
9955
|
this.usage = StaticDrawUsage;
|
|
9901
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
9902
9956
|
this.updateRanges = [];
|
|
9903
9957
|
this.gpuType = FloatType;
|
|
9904
9958
|
|
|
@@ -9914,13 +9968,6 @@ class BufferAttribute {
|
|
|
9914
9968
|
|
|
9915
9969
|
}
|
|
9916
9970
|
|
|
9917
|
-
get updateRange() {
|
|
9918
|
-
|
|
9919
|
-
warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
9920
|
-
return this._updateRange;
|
|
9921
|
-
|
|
9922
|
-
}
|
|
9923
|
-
|
|
9924
9971
|
setUsage( value ) {
|
|
9925
9972
|
|
|
9926
9973
|
this.usage = value;
|
|
@@ -11565,14 +11612,6 @@ const _vC$1 = /*@__PURE__*/ new Vector3();
|
|
|
11565
11612
|
const _tempA = /*@__PURE__*/ new Vector3();
|
|
11566
11613
|
const _morphA = /*@__PURE__*/ new Vector3();
|
|
11567
11614
|
|
|
11568
|
-
const _uvA$1 = /*@__PURE__*/ new Vector2();
|
|
11569
|
-
const _uvB$1 = /*@__PURE__*/ new Vector2();
|
|
11570
|
-
const _uvC$1 = /*@__PURE__*/ new Vector2();
|
|
11571
|
-
|
|
11572
|
-
const _normalA = /*@__PURE__*/ new Vector3();
|
|
11573
|
-
const _normalB = /*@__PURE__*/ new Vector3();
|
|
11574
|
-
const _normalC = /*@__PURE__*/ new Vector3();
|
|
11575
|
-
|
|
11576
11615
|
const _intersectionPoint = /*@__PURE__*/ new Vector3();
|
|
11577
11616
|
const _intersectionPointWorld = /*@__PURE__*/ new Vector3();
|
|
11578
11617
|
|
|
@@ -11915,33 +11954,24 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11915
11954
|
|
|
11916
11955
|
if ( intersection ) {
|
|
11917
11956
|
|
|
11918
|
-
|
|
11957
|
+
const barycoord = new Vector3();
|
|
11958
|
+
Triangle.getBarycoord( _intersectionPoint, _vA$1, _vB$1, _vC$1, barycoord );
|
|
11919
11959
|
|
|
11920
|
-
|
|
11921
|
-
_uvB$1.fromBufferAttribute( uv, b );
|
|
11922
|
-
_uvC$1.fromBufferAttribute( uv, c );
|
|
11960
|
+
if ( uv ) {
|
|
11923
11961
|
|
|
11924
|
-
intersection.uv = Triangle.
|
|
11962
|
+
intersection.uv = Triangle.getInterpolatedAttribute( uv, a, b, c, barycoord, new Vector2() );
|
|
11925
11963
|
|
|
11926
11964
|
}
|
|
11927
11965
|
|
|
11928
11966
|
if ( uv1 ) {
|
|
11929
11967
|
|
|
11930
|
-
|
|
11931
|
-
_uvB$1.fromBufferAttribute( uv1, b );
|
|
11932
|
-
_uvC$1.fromBufferAttribute( uv1, c );
|
|
11933
|
-
|
|
11934
|
-
intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
|
|
11968
|
+
intersection.uv1 = Triangle.getInterpolatedAttribute( uv1, a, b, c, barycoord, new Vector2() );
|
|
11935
11969
|
|
|
11936
11970
|
}
|
|
11937
11971
|
|
|
11938
11972
|
if ( normal ) {
|
|
11939
11973
|
|
|
11940
|
-
|
|
11941
|
-
_normalB.fromBufferAttribute( normal, b );
|
|
11942
|
-
_normalC.fromBufferAttribute( normal, c );
|
|
11943
|
-
|
|
11944
|
-
intersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );
|
|
11974
|
+
intersection.normal = Triangle.getInterpolatedAttribute( normal, a, b, c, barycoord, new Vector3() );
|
|
11945
11975
|
|
|
11946
11976
|
if ( intersection.normal.dot( ray.direction ) > 0 ) {
|
|
11947
11977
|
|
|
@@ -11962,6 +11992,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11962
11992
|
Triangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );
|
|
11963
11993
|
|
|
11964
11994
|
intersection.face = face;
|
|
11995
|
+
intersection.barycoord = barycoord;
|
|
11965
11996
|
|
|
11966
11997
|
}
|
|
11967
11998
|
|
|
@@ -13605,40 +13636,71 @@ function WebGLAttributes( gl ) {
|
|
|
13605
13636
|
function updateBuffer( buffer, attribute, bufferType ) {
|
|
13606
13637
|
|
|
13607
13638
|
const array = attribute.array;
|
|
13608
|
-
const updateRange = attribute._updateRange; // @deprecated, r159
|
|
13609
13639
|
const updateRanges = attribute.updateRanges;
|
|
13610
13640
|
|
|
13611
13641
|
gl.bindBuffer( bufferType, buffer );
|
|
13612
13642
|
|
|
13613
|
-
if (
|
|
13643
|
+
if ( updateRanges.length === 0 ) {
|
|
13614
13644
|
|
|
13615
13645
|
// Not using update ranges
|
|
13616
13646
|
gl.bufferSubData( bufferType, 0, array );
|
|
13617
13647
|
|
|
13618
|
-
}
|
|
13648
|
+
} else {
|
|
13619
13649
|
|
|
13620
|
-
|
|
13650
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
13651
|
+
// ranges to reduce load on `gl.bufferSubData`. Empirically, this has led
|
|
13652
|
+
// to performance improvements for applications which make heavy use of
|
|
13653
|
+
// update ranges. Likely due to GPU command overhead.
|
|
13654
|
+
//
|
|
13655
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
13656
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
13657
|
+
// update ranges once updated.
|
|
13621
13658
|
|
|
13622
|
-
|
|
13659
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
13660
|
+
|
|
13661
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
13662
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
13663
|
+
// array which is smaller than the original. This index tracks the last
|
|
13664
|
+
// index representing a merged range, any data after this index can be
|
|
13665
|
+
// trimmed once the merge algorithm is completed.
|
|
13666
|
+
let mergeIndex = 0;
|
|
13667
|
+
|
|
13668
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
13623
13669
|
|
|
13670
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
13624
13671
|
const range = updateRanges[ i ];
|
|
13625
13672
|
|
|
13626
|
-
|
|
13627
|
-
|
|
13673
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
13674
|
+
// operate over positive integers.
|
|
13675
|
+
if ( range.start <= previousRange.start + previousRange.count + 1 ) {
|
|
13676
|
+
|
|
13677
|
+
previousRange.count = Math.max(
|
|
13678
|
+
previousRange.count,
|
|
13679
|
+
range.start + range.count - previousRange.start
|
|
13680
|
+
);
|
|
13681
|
+
|
|
13682
|
+
} else {
|
|
13683
|
+
|
|
13684
|
+
++ mergeIndex;
|
|
13685
|
+
updateRanges[ mergeIndex ] = range;
|
|
13686
|
+
|
|
13687
|
+
}
|
|
13628
13688
|
|
|
13629
13689
|
}
|
|
13630
13690
|
|
|
13631
|
-
|
|
13691
|
+
// Trim the array to only contain the merged ranges.
|
|
13692
|
+
updateRanges.length = mergeIndex + 1;
|
|
13632
13693
|
|
|
13633
|
-
|
|
13694
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
13695
|
+
|
|
13696
|
+
const range = updateRanges[ i ];
|
|
13634
13697
|
|
|
13635
|
-
|
|
13636
|
-
|
|
13698
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13699
|
+
array, range.start, range.count );
|
|
13637
13700
|
|
|
13638
|
-
|
|
13639
|
-
array, updateRange.offset, updateRange.count );
|
|
13701
|
+
}
|
|
13640
13702
|
|
|
13641
|
-
|
|
13703
|
+
attribute.clearUpdateRanges();
|
|
13642
13704
|
|
|
13643
13705
|
}
|
|
13644
13706
|
|
|
@@ -14099,7 +14161,7 @@ const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <
|
|
|
14099
14161
|
|
|
14100
14162
|
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}";
|
|
14101
14163
|
|
|
14102
|
-
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
|
|
14164
|
+
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}";
|
|
14103
14165
|
|
|
14104
14166
|
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}";
|
|
14105
14167
|
|
|
@@ -15865,6 +15927,14 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
15865
15927
|
}
|
|
15866
15928
|
|
|
15867
15929
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
15930
|
+
const reverseDepthBuffer = parameters.reverseDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
15931
|
+
|
|
15932
|
+
if ( reverseDepthBuffer === true ) {
|
|
15933
|
+
|
|
15934
|
+
const ext = extensions.get( 'EXT_clip_control' );
|
|
15935
|
+
ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );
|
|
15936
|
+
|
|
15937
|
+
}
|
|
15868
15938
|
|
|
15869
15939
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
15870
15940
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -15892,6 +15962,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
15892
15962
|
|
|
15893
15963
|
precision: precision,
|
|
15894
15964
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
15965
|
+
reverseDepthBuffer: reverseDepthBuffer,
|
|
15895
15966
|
|
|
15896
15967
|
maxTextures: maxTextures,
|
|
15897
15968
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -20008,6 +20079,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20008
20079
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
20009
20080
|
|
|
20010
20081
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20082
|
+
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
20011
20083
|
|
|
20012
20084
|
'uniform mat4 modelMatrix;',
|
|
20013
20085
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -20173,6 +20245,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20173
20245
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
20174
20246
|
|
|
20175
20247
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20248
|
+
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
20176
20249
|
|
|
20177
20250
|
'uniform mat4 viewMatrix;',
|
|
20178
20251
|
'uniform vec3 cameraPosition;',
|
|
@@ -20613,6 +20686,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20613
20686
|
const programs = [];
|
|
20614
20687
|
|
|
20615
20688
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
20689
|
+
const reverseDepthBuffer = capabilities.reverseDepthBuffer;
|
|
20616
20690
|
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
20617
20691
|
|
|
20618
20692
|
let precision = capabilities.precision;
|
|
@@ -20907,6 +20981,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20907
20981
|
|
|
20908
20982
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
20909
20983
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
20984
|
+
reverseDepthBuffer: reverseDepthBuffer,
|
|
20910
20985
|
|
|
20911
20986
|
skinning: object.isSkinnedMesh === true,
|
|
20912
20987
|
|
|
@@ -21126,40 +21201,42 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
21126
21201
|
_programLayers.enable( 2 );
|
|
21127
21202
|
if ( parameters.logarithmicDepthBuffer )
|
|
21128
21203
|
_programLayers.enable( 3 );
|
|
21129
|
-
if ( parameters.
|
|
21204
|
+
if ( parameters.reverseDepthBuffer )
|
|
21130
21205
|
_programLayers.enable( 4 );
|
|
21131
|
-
if ( parameters.
|
|
21206
|
+
if ( parameters.skinning )
|
|
21132
21207
|
_programLayers.enable( 5 );
|
|
21133
|
-
if ( parameters.
|
|
21208
|
+
if ( parameters.morphTargets )
|
|
21134
21209
|
_programLayers.enable( 6 );
|
|
21135
|
-
if ( parameters.
|
|
21210
|
+
if ( parameters.morphNormals )
|
|
21136
21211
|
_programLayers.enable( 7 );
|
|
21137
|
-
if ( parameters.
|
|
21212
|
+
if ( parameters.morphColors )
|
|
21138
21213
|
_programLayers.enable( 8 );
|
|
21139
|
-
if ( parameters.
|
|
21214
|
+
if ( parameters.premultipliedAlpha )
|
|
21140
21215
|
_programLayers.enable( 9 );
|
|
21141
|
-
if ( parameters.
|
|
21216
|
+
if ( parameters.shadowMapEnabled )
|
|
21142
21217
|
_programLayers.enable( 10 );
|
|
21143
|
-
if ( parameters.
|
|
21218
|
+
if ( parameters.doubleSided )
|
|
21144
21219
|
_programLayers.enable( 11 );
|
|
21145
|
-
if ( parameters.
|
|
21220
|
+
if ( parameters.flipSided )
|
|
21146
21221
|
_programLayers.enable( 12 );
|
|
21147
|
-
if ( parameters.
|
|
21222
|
+
if ( parameters.useDepthPacking )
|
|
21148
21223
|
_programLayers.enable( 13 );
|
|
21149
|
-
if ( parameters.
|
|
21224
|
+
if ( parameters.dithering )
|
|
21150
21225
|
_programLayers.enable( 14 );
|
|
21151
|
-
if ( parameters.
|
|
21226
|
+
if ( parameters.transmission )
|
|
21152
21227
|
_programLayers.enable( 15 );
|
|
21153
|
-
if ( parameters.
|
|
21228
|
+
if ( parameters.sheen )
|
|
21154
21229
|
_programLayers.enable( 16 );
|
|
21155
|
-
if ( parameters.
|
|
21230
|
+
if ( parameters.opaque )
|
|
21156
21231
|
_programLayers.enable( 17 );
|
|
21157
|
-
if ( parameters.
|
|
21232
|
+
if ( parameters.pointsUvs )
|
|
21158
21233
|
_programLayers.enable( 18 );
|
|
21159
|
-
if ( parameters.
|
|
21234
|
+
if ( parameters.decodeVideoTexture )
|
|
21160
21235
|
_programLayers.enable( 19 );
|
|
21161
|
-
if ( parameters.
|
|
21236
|
+
if ( parameters.alphaToCoverage )
|
|
21162
21237
|
_programLayers.enable( 20 );
|
|
21238
|
+
if ( parameters.numMultiviewViews )
|
|
21239
|
+
_programLayers.enable( 21 );
|
|
21163
21240
|
|
|
21164
21241
|
array.push( _programLayers.mask );
|
|
21165
21242
|
|
|
@@ -22717,6 +22794,18 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
22717
22794
|
|
|
22718
22795
|
}
|
|
22719
22796
|
|
|
22797
|
+
const reversedFuncs = {
|
|
22798
|
+
[ NeverDepth ]: AlwaysDepth,
|
|
22799
|
+
[ LessDepth ]: GreaterDepth,
|
|
22800
|
+
[ EqualDepth ]: NotEqualDepth,
|
|
22801
|
+
[ LessEqualDepth ]: GreaterEqualDepth,
|
|
22802
|
+
|
|
22803
|
+
[ AlwaysDepth ]: NeverDepth,
|
|
22804
|
+
[ GreaterDepth ]: LessDepth,
|
|
22805
|
+
[ NotEqualDepth ]: EqualDepth,
|
|
22806
|
+
[ GreaterEqualDepth ]: LessEqualDepth,
|
|
22807
|
+
};
|
|
22808
|
+
|
|
22720
22809
|
function WebGLState( gl ) {
|
|
22721
22810
|
|
|
22722
22811
|
function ColorBuffer() {
|
|
@@ -22781,6 +22870,7 @@ function WebGLState( gl ) {
|
|
|
22781
22870
|
function DepthBuffer() {
|
|
22782
22871
|
|
|
22783
22872
|
let locked = false;
|
|
22873
|
+
let reversed = false;
|
|
22784
22874
|
|
|
22785
22875
|
let currentDepthMask = null;
|
|
22786
22876
|
let currentDepthFunc = null;
|
|
@@ -22788,6 +22878,12 @@ function WebGLState( gl ) {
|
|
|
22788
22878
|
|
|
22789
22879
|
return {
|
|
22790
22880
|
|
|
22881
|
+
setReversed: function ( value ) {
|
|
22882
|
+
|
|
22883
|
+
reversed = value;
|
|
22884
|
+
|
|
22885
|
+
},
|
|
22886
|
+
|
|
22791
22887
|
setTest: function ( depthTest ) {
|
|
22792
22888
|
|
|
22793
22889
|
if ( depthTest ) {
|
|
@@ -22815,6 +22911,8 @@ function WebGLState( gl ) {
|
|
|
22815
22911
|
|
|
22816
22912
|
setFunc: function ( depthFunc ) {
|
|
22817
22913
|
|
|
22914
|
+
if ( reversed ) depthFunc = reversedFuncs[ depthFunc ];
|
|
22915
|
+
|
|
22818
22916
|
if ( currentDepthFunc !== depthFunc ) {
|
|
22819
22917
|
|
|
22820
22918
|
switch ( depthFunc ) {
|
|
@@ -24360,6 +24458,28 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24360
24458
|
|
|
24361
24459
|
}
|
|
24362
24460
|
|
|
24461
|
+
if ( glFormat === _gl.RGB_INTEGER ) {
|
|
24462
|
+
|
|
24463
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGB8UI;
|
|
24464
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGB16UI;
|
|
24465
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGB32UI;
|
|
24466
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.RGB8I;
|
|
24467
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.RGB16I;
|
|
24468
|
+
if ( glType === _gl.INT ) internalFormat = _gl.RGB32I;
|
|
24469
|
+
|
|
24470
|
+
}
|
|
24471
|
+
|
|
24472
|
+
if ( glFormat === _gl.RGBA_INTEGER ) {
|
|
24473
|
+
|
|
24474
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGBA8UI;
|
|
24475
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGBA16UI;
|
|
24476
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGBA32UI;
|
|
24477
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.RGBA8I;
|
|
24478
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.RGBA16I;
|
|
24479
|
+
if ( glType === _gl.INT ) internalFormat = _gl.RGBA32I;
|
|
24480
|
+
|
|
24481
|
+
}
|
|
24482
|
+
|
|
24363
24483
|
if ( glFormat === _gl.RGB ) {
|
|
24364
24484
|
|
|
24365
24485
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
@@ -26718,20 +26838,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
26718
26838
|
|
|
26719
26839
|
}
|
|
26720
26840
|
|
|
26721
|
-
class Group extends Object3D {
|
|
26722
|
-
|
|
26723
|
-
constructor() {
|
|
26724
|
-
|
|
26725
|
-
super();
|
|
26726
|
-
|
|
26727
|
-
this.isGroup = true;
|
|
26728
|
-
|
|
26729
|
-
this.type = 'Group';
|
|
26730
|
-
|
|
26731
|
-
}
|
|
26732
|
-
|
|
26733
|
-
}
|
|
26734
|
-
|
|
26735
26841
|
class ArrayCamera extends PerspectiveCamera {
|
|
26736
26842
|
|
|
26737
26843
|
constructor( array = [] ) {
|
|
@@ -26746,553 +26852,6 @@ class ArrayCamera extends PerspectiveCamera {
|
|
|
26746
26852
|
|
|
26747
26853
|
}
|
|
26748
26854
|
|
|
26749
|
-
/**
|
|
26750
|
-
* @author jsantell / https://www.jsantell.com/
|
|
26751
|
-
* @author mrdoob / http://mrdoob.com/
|
|
26752
|
-
*/
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
var cameraLPos = new Vector3();
|
|
26756
|
-
var cameraRPos = new Vector3();
|
|
26757
|
-
|
|
26758
|
-
/**
|
|
26759
|
-
* Assumes 2 cameras that are parallel and share an X-axis, and that
|
|
26760
|
-
* the cameras' projection and world matrices have already been set.
|
|
26761
|
-
* And that near and far planes are identical for both cameras.
|
|
26762
|
-
* Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
|
|
26763
|
-
*/
|
|
26764
|
-
function setProjectionFromUnion( camera, cameraL, cameraR ) {
|
|
26765
|
-
|
|
26766
|
-
cameraLPos.setFromMatrixPosition( cameraL.matrixWorld );
|
|
26767
|
-
cameraRPos.setFromMatrixPosition( cameraR.matrixWorld );
|
|
26768
|
-
|
|
26769
|
-
var ipd = cameraLPos.distanceTo( cameraRPos );
|
|
26770
|
-
|
|
26771
|
-
var projL = cameraL.projectionMatrix.elements;
|
|
26772
|
-
var projR = cameraR.projectionMatrix.elements;
|
|
26773
|
-
|
|
26774
|
-
// VR systems will have identical far and near planes, and
|
|
26775
|
-
// most likely identical top and bottom frustum extents.
|
|
26776
|
-
// Use the left camera for these values.
|
|
26777
|
-
var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
|
|
26778
|
-
var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
|
|
26779
|
-
var topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];
|
|
26780
|
-
var bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];
|
|
26781
|
-
|
|
26782
|
-
var leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];
|
|
26783
|
-
var rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];
|
|
26784
|
-
var left = near * leftFov;
|
|
26785
|
-
var right = near * rightFov;
|
|
26786
|
-
|
|
26787
|
-
// Calculate the new camera's position offset from the
|
|
26788
|
-
// left camera. xOffset should be roughly half `ipd`.
|
|
26789
|
-
var zOffset = ipd / ( - leftFov + rightFov );
|
|
26790
|
-
var xOffset = zOffset * - leftFov;
|
|
26791
|
-
|
|
26792
|
-
// TODO: Better way to apply this offset?
|
|
26793
|
-
cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );
|
|
26794
|
-
camera.translateX( xOffset );
|
|
26795
|
-
camera.translateZ( zOffset );
|
|
26796
|
-
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
|
|
26797
|
-
camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
|
|
26798
|
-
|
|
26799
|
-
// Find the union of the frustum values of the cameras and scale
|
|
26800
|
-
// the values so that the near plane's position does not change in world space,
|
|
26801
|
-
// although must now be relative to the new union camera.
|
|
26802
|
-
var near2 = near + zOffset;
|
|
26803
|
-
var far2 = far + zOffset;
|
|
26804
|
-
var left2 = left - xOffset;
|
|
26805
|
-
var right2 = right + ( ipd - xOffset );
|
|
26806
|
-
var top2 = topFov * far / far2 * near2;
|
|
26807
|
-
var bottom2 = bottomFov * far / far2 * near2;
|
|
26808
|
-
|
|
26809
|
-
camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
|
|
26810
|
-
|
|
26811
|
-
}
|
|
26812
|
-
|
|
26813
|
-
/**
|
|
26814
|
-
* @author mrdoob / http://mrdoob.com/
|
|
26815
|
-
*/
|
|
26816
|
-
|
|
26817
|
-
|
|
26818
|
-
function WebVRManager( renderer ) {
|
|
26819
|
-
|
|
26820
|
-
var renderWidth, renderHeight;
|
|
26821
|
-
var scope = this;
|
|
26822
|
-
|
|
26823
|
-
var device = null;
|
|
26824
|
-
var frameData = null;
|
|
26825
|
-
|
|
26826
|
-
var poseTarget = null;
|
|
26827
|
-
|
|
26828
|
-
var controllers = [];
|
|
26829
|
-
var standingMatrix = new Matrix4();
|
|
26830
|
-
var standingMatrixInverse = new Matrix4();
|
|
26831
|
-
|
|
26832
|
-
var framebufferScaleFactor = 1.0;
|
|
26833
|
-
|
|
26834
|
-
var referenceSpaceType = 'local-floor';
|
|
26835
|
-
|
|
26836
|
-
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
|
|
26837
|
-
|
|
26838
|
-
frameData = new window.VRFrameData();
|
|
26839
|
-
window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
|
|
26840
|
-
|
|
26841
|
-
}
|
|
26842
|
-
|
|
26843
|
-
var matrixWorldInverse = new Matrix4();
|
|
26844
|
-
var tempQuaternion = new Quaternion();
|
|
26845
|
-
var tempPosition = new Vector3();
|
|
26846
|
-
|
|
26847
|
-
var cameraL = new PerspectiveCamera();
|
|
26848
|
-
cameraL.viewport = new Vector4();
|
|
26849
|
-
cameraL.layers.enable( 1 );
|
|
26850
|
-
|
|
26851
|
-
var cameraR = new PerspectiveCamera();
|
|
26852
|
-
cameraR.viewport = new Vector4();
|
|
26853
|
-
cameraR.layers.enable( 2 );
|
|
26854
|
-
|
|
26855
|
-
var cameraVR = new ArrayCamera( [ cameraL, cameraR ] );
|
|
26856
|
-
cameraVR.layers.enable( 1 );
|
|
26857
|
-
cameraVR.layers.enable( 2 );
|
|
26858
|
-
|
|
26859
|
-
var currentSize = new Vector2(), currentPixelRatio;
|
|
26860
|
-
|
|
26861
|
-
function onVRDisplayPresentChange() {
|
|
26862
|
-
|
|
26863
|
-
var isPresenting = scope.isPresenting = device !== null && device.isPresenting === true;
|
|
26864
|
-
|
|
26865
|
-
if ( isPresenting ) {
|
|
26866
|
-
|
|
26867
|
-
var eyeParameters = device.getEyeParameters( 'left' );
|
|
26868
|
-
renderWidth = 2 * eyeParameters.renderWidth * framebufferScaleFactor;
|
|
26869
|
-
renderHeight = eyeParameters.renderHeight * framebufferScaleFactor;
|
|
26870
|
-
|
|
26871
|
-
currentPixelRatio = renderer.getPixelRatio();
|
|
26872
|
-
renderer.getSize( currentSize );
|
|
26873
|
-
|
|
26874
|
-
renderer.setDrawingBufferSize( renderWidth, renderHeight, 1 );
|
|
26875
|
-
|
|
26876
|
-
cameraL.viewport.set( 0, 0, renderWidth / 2, renderHeight );
|
|
26877
|
-
cameraR.viewport.set( renderWidth / 2, 0, renderWidth / 2, renderHeight );
|
|
26878
|
-
|
|
26879
|
-
animation.start();
|
|
26880
|
-
|
|
26881
|
-
scope.dispatchEvent( { type: 'sessionstart' } );
|
|
26882
|
-
|
|
26883
|
-
} else {
|
|
26884
|
-
|
|
26885
|
-
if ( scope.enabled ) {
|
|
26886
|
-
|
|
26887
|
-
renderer.setDrawingBufferSize( currentSize.width, currentSize.height, currentPixelRatio );
|
|
26888
|
-
|
|
26889
|
-
}
|
|
26890
|
-
|
|
26891
|
-
animation.stop();
|
|
26892
|
-
|
|
26893
|
-
scope.dispatchEvent( { type: 'sessionend' } );
|
|
26894
|
-
|
|
26895
|
-
}
|
|
26896
|
-
|
|
26897
|
-
}
|
|
26898
|
-
|
|
26899
|
-
//
|
|
26900
|
-
|
|
26901
|
-
var triggers = [];
|
|
26902
|
-
var grips = [];
|
|
26903
|
-
|
|
26904
|
-
function findGamepad( id ) {
|
|
26905
|
-
|
|
26906
|
-
var gamepads = navigator.getGamepads && navigator.getGamepads();
|
|
26907
|
-
|
|
26908
|
-
for ( var i = 0, l = gamepads.length; i < l; i ++ ) {
|
|
26909
|
-
|
|
26910
|
-
var gamepad = gamepads[ i ];
|
|
26911
|
-
|
|
26912
|
-
if ( gamepad && ( gamepad.id === 'Daydream Controller' ||
|
|
26913
|
-
gamepad.id === 'Gear VR Controller' || gamepad.id === 'Oculus Go Controller' ||
|
|
26914
|
-
gamepad.id === 'OpenVR Gamepad' || gamepad.id.startsWith( 'Oculus Touch' ) ||
|
|
26915
|
-
gamepad.id.startsWith( 'HTC Vive Focus' ) ||
|
|
26916
|
-
gamepad.id.startsWith( 'Spatial Controller' ) ) ) {
|
|
26917
|
-
|
|
26918
|
-
var hand = gamepad.hand;
|
|
26919
|
-
|
|
26920
|
-
if ( id === 0 && ( hand === '' || hand === 'right' ) ) return gamepad;
|
|
26921
|
-
if ( id === 1 && ( hand === 'left' ) ) return gamepad;
|
|
26922
|
-
|
|
26923
|
-
}
|
|
26924
|
-
|
|
26925
|
-
}
|
|
26926
|
-
|
|
26927
|
-
}
|
|
26928
|
-
|
|
26929
|
-
function updateControllers() {
|
|
26930
|
-
|
|
26931
|
-
for ( var i = 0; i < controllers.length; i ++ ) {
|
|
26932
|
-
|
|
26933
|
-
var controller = controllers[ i ];
|
|
26934
|
-
|
|
26935
|
-
var gamepad = findGamepad( i );
|
|
26936
|
-
|
|
26937
|
-
if ( gamepad !== undefined && gamepad.pose !== undefined ) {
|
|
26938
|
-
|
|
26939
|
-
if ( gamepad.pose === null ) return;
|
|
26940
|
-
|
|
26941
|
-
// Pose
|
|
26942
|
-
|
|
26943
|
-
var pose = gamepad.pose;
|
|
26944
|
-
|
|
26945
|
-
if ( pose.hasPosition === false ) controller.position.set( 0.2, - 0.6, - 0.05 );
|
|
26946
|
-
|
|
26947
|
-
if ( pose.position !== null ) controller.position.fromArray( pose.position );
|
|
26948
|
-
if ( pose.orientation !== null ) controller.quaternion.fromArray( pose.orientation );
|
|
26949
|
-
controller.matrix.compose( controller.position, controller.quaternion, controller.scale );
|
|
26950
|
-
controller.matrix.premultiply( standingMatrix );
|
|
26951
|
-
controller.matrix.decompose( controller.position, controller.quaternion, controller.scale );
|
|
26952
|
-
controller.matrixWorldNeedsUpdate = true;
|
|
26953
|
-
controller.visible = true;
|
|
26954
|
-
|
|
26955
|
-
// Trigger
|
|
26956
|
-
|
|
26957
|
-
var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1;
|
|
26958
|
-
|
|
26959
|
-
if ( triggers[ i ] === undefined ) triggers[ i ] = false;
|
|
26960
|
-
|
|
26961
|
-
if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
26962
|
-
|
|
26963
|
-
triggers[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
26964
|
-
|
|
26965
|
-
if ( triggers[ i ] === true ) {
|
|
26966
|
-
|
|
26967
|
-
controller.dispatchEvent( { type: 'selectstart' } );
|
|
26968
|
-
|
|
26969
|
-
} else {
|
|
26970
|
-
|
|
26971
|
-
controller.dispatchEvent( { type: 'selectend' } );
|
|
26972
|
-
controller.dispatchEvent( { type: 'select' } );
|
|
26973
|
-
|
|
26974
|
-
}
|
|
26975
|
-
|
|
26976
|
-
}
|
|
26977
|
-
|
|
26978
|
-
// Grip
|
|
26979
|
-
buttonId = 2;
|
|
26980
|
-
|
|
26981
|
-
if ( grips[ i ] === undefined ) grips[ i ] = false;
|
|
26982
|
-
|
|
26983
|
-
// Skip if the grip button doesn't exist on this controller
|
|
26984
|
-
if ( gamepad.buttons[ buttonId ] !== undefined ) {
|
|
26985
|
-
|
|
26986
|
-
if ( grips[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
26987
|
-
|
|
26988
|
-
grips[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
26989
|
-
|
|
26990
|
-
if ( grips[ i ] === true ) {
|
|
26991
|
-
|
|
26992
|
-
controller.dispatchEvent( { type: 'squeezestart' } );
|
|
26993
|
-
|
|
26994
|
-
} else {
|
|
26995
|
-
|
|
26996
|
-
controller.dispatchEvent( { type: 'squeezeend' } );
|
|
26997
|
-
controller.dispatchEvent( { type: 'squeeze' } );
|
|
26998
|
-
|
|
26999
|
-
}
|
|
27000
|
-
|
|
27001
|
-
}
|
|
27002
|
-
|
|
27003
|
-
}
|
|
27004
|
-
|
|
27005
|
-
} else {
|
|
27006
|
-
|
|
27007
|
-
controller.visible = false;
|
|
27008
|
-
|
|
27009
|
-
}
|
|
27010
|
-
|
|
27011
|
-
}
|
|
27012
|
-
|
|
27013
|
-
}
|
|
27014
|
-
|
|
27015
|
-
function updateViewportFromBounds( viewport, bounds ) {
|
|
27016
|
-
|
|
27017
|
-
if ( bounds !== null && bounds.length === 4 ) {
|
|
27018
|
-
|
|
27019
|
-
viewport.set( bounds[ 0 ] * renderWidth, bounds[ 1 ] * renderHeight, bounds[ 2 ] * renderWidth, bounds[ 3 ] * renderHeight );
|
|
27020
|
-
|
|
27021
|
-
}
|
|
27022
|
-
|
|
27023
|
-
}
|
|
27024
|
-
|
|
27025
|
-
//
|
|
27026
|
-
|
|
27027
|
-
this.enabled = false;
|
|
27028
|
-
|
|
27029
|
-
this.getController = function ( id ) {
|
|
27030
|
-
|
|
27031
|
-
var controller = controllers[ id ];
|
|
27032
|
-
|
|
27033
|
-
if ( controller === undefined ) {
|
|
27034
|
-
|
|
27035
|
-
controller = new Group();
|
|
27036
|
-
controller.matrixAutoUpdate = false;
|
|
27037
|
-
controller.visible = false;
|
|
27038
|
-
|
|
27039
|
-
controllers[ id ] = controller;
|
|
27040
|
-
|
|
27041
|
-
}
|
|
27042
|
-
|
|
27043
|
-
return controller;
|
|
27044
|
-
|
|
27045
|
-
};
|
|
27046
|
-
|
|
27047
|
-
this.getDevice = function () {
|
|
27048
|
-
|
|
27049
|
-
return device;
|
|
27050
|
-
|
|
27051
|
-
};
|
|
27052
|
-
|
|
27053
|
-
this.setDevice = function ( value ) {
|
|
27054
|
-
|
|
27055
|
-
if ( value !== undefined ) device = value;
|
|
27056
|
-
|
|
27057
|
-
animation.setContext( value );
|
|
27058
|
-
|
|
27059
|
-
};
|
|
27060
|
-
|
|
27061
|
-
this.setFramebufferScaleFactor = function ( value ) {
|
|
27062
|
-
|
|
27063
|
-
framebufferScaleFactor = value;
|
|
27064
|
-
|
|
27065
|
-
};
|
|
27066
|
-
|
|
27067
|
-
this.setReferenceSpaceType = function ( value ) {
|
|
27068
|
-
|
|
27069
|
-
referenceSpaceType = value;
|
|
27070
|
-
|
|
27071
|
-
};
|
|
27072
|
-
|
|
27073
|
-
this.setPoseTarget = function ( object ) {
|
|
27074
|
-
|
|
27075
|
-
if ( object !== undefined ) poseTarget = object;
|
|
27076
|
-
|
|
27077
|
-
};
|
|
27078
|
-
|
|
27079
|
-
//
|
|
27080
|
-
|
|
27081
|
-
this.cameraAutoUpdate = true;
|
|
27082
|
-
|
|
27083
|
-
this.updateCamera = function ( camera ) {
|
|
27084
|
-
|
|
27085
|
-
var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
|
|
27086
|
-
|
|
27087
|
-
device.depthNear = camera.near;
|
|
27088
|
-
device.depthFar = camera.far;
|
|
27089
|
-
|
|
27090
|
-
device.getFrameData( frameData );
|
|
27091
|
-
|
|
27092
|
-
//
|
|
27093
|
-
|
|
27094
|
-
if ( referenceSpaceType === 'local-floor' ) {
|
|
27095
|
-
|
|
27096
|
-
var stageParameters = device.stageParameters;
|
|
27097
|
-
|
|
27098
|
-
if ( stageParameters ) {
|
|
27099
|
-
|
|
27100
|
-
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
|
|
27101
|
-
|
|
27102
|
-
} else {
|
|
27103
|
-
|
|
27104
|
-
standingMatrix.makeTranslation( 0, userHeight, 0 );
|
|
27105
|
-
|
|
27106
|
-
}
|
|
27107
|
-
|
|
27108
|
-
}
|
|
27109
|
-
|
|
27110
|
-
|
|
27111
|
-
var pose = frameData.pose;
|
|
27112
|
-
var poseObject = poseTarget !== null ? poseTarget : camera;
|
|
27113
|
-
|
|
27114
|
-
// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
|
|
27115
|
-
poseObject.matrix.copy( standingMatrix );
|
|
27116
|
-
poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
|
|
27117
|
-
|
|
27118
|
-
if ( pose.orientation !== null ) {
|
|
27119
|
-
|
|
27120
|
-
tempQuaternion.fromArray( pose.orientation );
|
|
27121
|
-
poseObject.quaternion.multiply( tempQuaternion );
|
|
27122
|
-
|
|
27123
|
-
}
|
|
27124
|
-
|
|
27125
|
-
if ( pose.position !== null ) {
|
|
27126
|
-
|
|
27127
|
-
tempQuaternion.setFromRotationMatrix( standingMatrix );
|
|
27128
|
-
tempPosition.fromArray( pose.position );
|
|
27129
|
-
tempPosition.applyQuaternion( tempQuaternion );
|
|
27130
|
-
poseObject.position.add( tempPosition );
|
|
27131
|
-
|
|
27132
|
-
}
|
|
27133
|
-
|
|
27134
|
-
poseObject.updateMatrixWorld();
|
|
27135
|
-
|
|
27136
|
-
var children = poseObject.children;
|
|
27137
|
-
for ( var i = 0, l = children.length; i < l; i ++ ) {
|
|
27138
|
-
|
|
27139
|
-
children[ i ].updateMatrixWorld( true );
|
|
27140
|
-
|
|
27141
|
-
}
|
|
27142
|
-
|
|
27143
|
-
//
|
|
27144
|
-
|
|
27145
|
-
cameraL.near = camera.near;
|
|
27146
|
-
cameraR.near = camera.near;
|
|
27147
|
-
|
|
27148
|
-
cameraL.far = camera.far;
|
|
27149
|
-
cameraR.far = camera.far;
|
|
27150
|
-
|
|
27151
|
-
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
27152
|
-
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
27153
|
-
|
|
27154
|
-
// TODO (mrdoob) Double check this code
|
|
27155
|
-
|
|
27156
|
-
standingMatrixInverse.copy( standingMatrix ).invert();
|
|
27157
|
-
|
|
27158
|
-
if ( referenceSpaceType === 'local-floor' ) {
|
|
27159
|
-
|
|
27160
|
-
cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
27161
|
-
cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
27162
|
-
|
|
27163
|
-
}
|
|
27164
|
-
|
|
27165
|
-
var parent = poseObject.parent;
|
|
27166
|
-
|
|
27167
|
-
if ( parent !== null ) {
|
|
27168
|
-
|
|
27169
|
-
matrixWorldInverse.copy( parent.matrixWorld ).invert();
|
|
27170
|
-
|
|
27171
|
-
cameraL.matrixWorldInverse.multiply( matrixWorldInverse );
|
|
27172
|
-
cameraR.matrixWorldInverse.multiply( matrixWorldInverse );
|
|
27173
|
-
|
|
27174
|
-
}
|
|
27175
|
-
|
|
27176
|
-
// envMap and Mirror needs camera.matrixWorld
|
|
27177
|
-
|
|
27178
|
-
cameraL.matrixWorld.copy( cameraL.matrixWorldInverse ).invert();
|
|
27179
|
-
cameraR.matrixWorld.copy( cameraR.matrixWorldInverse ).invert();
|
|
27180
|
-
|
|
27181
|
-
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
|
|
27182
|
-
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
|
|
27183
|
-
|
|
27184
|
-
setProjectionFromUnion( cameraVR, cameraL, cameraR );
|
|
27185
|
-
|
|
27186
|
-
//
|
|
27187
|
-
|
|
27188
|
-
var layers = device.getLayers();
|
|
27189
|
-
|
|
27190
|
-
if ( layers.length ) {
|
|
27191
|
-
|
|
27192
|
-
var layer = layers[ 0 ];
|
|
27193
|
-
|
|
27194
|
-
updateViewportFromBounds( cameraL.viewport, layer.leftBounds );
|
|
27195
|
-
updateViewportFromBounds( cameraR.viewport, layer.rightBounds );
|
|
27196
|
-
|
|
27197
|
-
}
|
|
27198
|
-
|
|
27199
|
-
updateControllers();
|
|
27200
|
-
|
|
27201
|
-
return cameraVR;
|
|
27202
|
-
|
|
27203
|
-
};
|
|
27204
|
-
|
|
27205
|
-
this.getCamera = function () {
|
|
27206
|
-
|
|
27207
|
-
return cameraVR;
|
|
27208
|
-
|
|
27209
|
-
};
|
|
27210
|
-
|
|
27211
|
-
// Dummy getFoveation/setFoveation to have the same API as WebXR
|
|
27212
|
-
|
|
27213
|
-
this.getFoveation = function () {
|
|
27214
|
-
|
|
27215
|
-
return 1;
|
|
27216
|
-
|
|
27217
|
-
};
|
|
27218
|
-
|
|
27219
|
-
this.setFoveation = function ( foveation ) {
|
|
27220
|
-
|
|
27221
|
-
if ( foveation !== 1 ) {
|
|
27222
|
-
|
|
27223
|
-
console.warn( 'THREE.WebVRManager: setFoveation() not used in WebVR.' );
|
|
27224
|
-
|
|
27225
|
-
}
|
|
27226
|
-
|
|
27227
|
-
};
|
|
27228
|
-
|
|
27229
|
-
// Dummy getEnvironmentBlendMode to have the same API as WebXR
|
|
27230
|
-
|
|
27231
|
-
this.getEnvironmentBlendMode = function () {
|
|
27232
|
-
|
|
27233
|
-
if ( scope.isPresenting ) {
|
|
27234
|
-
|
|
27235
|
-
return 'opaque';
|
|
27236
|
-
|
|
27237
|
-
}
|
|
27238
|
-
|
|
27239
|
-
};
|
|
27240
|
-
|
|
27241
|
-
//
|
|
27242
|
-
|
|
27243
|
-
this.getStandingMatrix = function () {
|
|
27244
|
-
|
|
27245
|
-
return standingMatrix;
|
|
27246
|
-
|
|
27247
|
-
};
|
|
27248
|
-
|
|
27249
|
-
this.isPresenting = false;
|
|
27250
|
-
|
|
27251
|
-
// Animation Loop
|
|
27252
|
-
|
|
27253
|
-
var animation = new WebGLAnimation();
|
|
27254
|
-
|
|
27255
|
-
this.setAnimationLoop = function ( callback ) {
|
|
27256
|
-
|
|
27257
|
-
animation.setAnimationLoop( callback );
|
|
27258
|
-
|
|
27259
|
-
if ( this.isPresenting ) animation.start();
|
|
27260
|
-
|
|
27261
|
-
};
|
|
27262
|
-
|
|
27263
|
-
this.submitFrame = function () {
|
|
27264
|
-
|
|
27265
|
-
if ( this.isPresenting ) device.submitFrame();
|
|
27266
|
-
|
|
27267
|
-
};
|
|
27268
|
-
|
|
27269
|
-
this.dispose = function () {
|
|
27270
|
-
|
|
27271
|
-
if ( typeof window !== 'undefined' ) {
|
|
27272
|
-
|
|
27273
|
-
window.removeEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange );
|
|
27274
|
-
|
|
27275
|
-
}
|
|
27276
|
-
|
|
27277
|
-
};
|
|
27278
|
-
|
|
27279
|
-
// DEPRECATED
|
|
27280
|
-
|
|
27281
|
-
this.setFrameOfReferenceType = function () {
|
|
27282
|
-
|
|
27283
|
-
console.warn( 'THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.' );
|
|
27284
|
-
|
|
27285
|
-
};
|
|
27286
|
-
|
|
27287
|
-
}
|
|
27288
|
-
|
|
27289
|
-
Object.assign( WebVRManager.prototype, {
|
|
27290
|
-
addEventListener: EventDispatcher.prototype.addEventListener,
|
|
27291
|
-
hasEventListener: EventDispatcher.prototype.hasEventListener,
|
|
27292
|
-
removeEventListener: EventDispatcher.prototype.removeEventListener,
|
|
27293
|
-
dispatchEvent: EventDispatcher.prototype.dispatchEvent
|
|
27294
|
-
} );
|
|
27295
|
-
|
|
27296
26855
|
/**
|
|
27297
26856
|
* @author fernandojsg / http://fernandojsg.com
|
|
27298
26857
|
* @author Takahiro https://github.com/takahirox
|
|
@@ -27326,6 +26885,20 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
|
27326
26885
|
|
|
27327
26886
|
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
27328
26887
|
|
|
26888
|
+
class Group extends Object3D {
|
|
26889
|
+
|
|
26890
|
+
constructor() {
|
|
26891
|
+
|
|
26892
|
+
super();
|
|
26893
|
+
|
|
26894
|
+
this.isGroup = true;
|
|
26895
|
+
|
|
26896
|
+
this.type = 'Group';
|
|
26897
|
+
|
|
26898
|
+
}
|
|
26899
|
+
|
|
26900
|
+
}
|
|
26901
|
+
|
|
27329
26902
|
const _moveEvent = { type: 'move' };
|
|
27330
26903
|
|
|
27331
26904
|
class WebXRController {
|
|
@@ -29767,6 +29340,7 @@ class WebGLRenderer {
|
|
|
29767
29340
|
|
|
29768
29341
|
// camera matrices cache
|
|
29769
29342
|
|
|
29343
|
+
const _currentProjectionMatrix = new Matrix4();
|
|
29770
29344
|
const _projScreenMatrix = new Matrix4();
|
|
29771
29345
|
|
|
29772
29346
|
const _vector3 = new Vector3();
|
|
@@ -29863,6 +29437,8 @@ class WebGLRenderer {
|
|
|
29863
29437
|
|
|
29864
29438
|
state = new WebGLState( _gl );
|
|
29865
29439
|
|
|
29440
|
+
if ( capabilities.reverseDepthBuffer ) state.buffers.depth.setReversed( true );
|
|
29441
|
+
|
|
29866
29442
|
info = new WebGLInfo( _gl );
|
|
29867
29443
|
properties = new WebGLProperties();
|
|
29868
29444
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
@@ -29902,7 +29478,7 @@ class WebGLRenderer {
|
|
|
29902
29478
|
|
|
29903
29479
|
// xr
|
|
29904
29480
|
|
|
29905
|
-
const xr =
|
|
29481
|
+
const xr = new WebXRManager( _this, _gl );
|
|
29906
29482
|
|
|
29907
29483
|
this.xr = xr;
|
|
29908
29484
|
|
|
@@ -30163,7 +29739,13 @@ class WebGLRenderer {
|
|
|
30163
29739
|
|
|
30164
29740
|
}
|
|
30165
29741
|
|
|
30166
|
-
if ( depth )
|
|
29742
|
+
if ( depth ) {
|
|
29743
|
+
|
|
29744
|
+
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
29745
|
+
_gl.clearDepth( this.capabilities.reverseDepthBuffer ? 0 : 1 );
|
|
29746
|
+
|
|
29747
|
+
}
|
|
29748
|
+
|
|
30167
29749
|
if ( stencil ) {
|
|
30168
29750
|
|
|
30169
29751
|
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -30552,6 +30134,12 @@ class WebGLRenderer {
|
|
|
30552
30134
|
|
|
30553
30135
|
scene.traverse( function ( object ) {
|
|
30554
30136
|
|
|
30137
|
+
if ( ! ( object.isMesh || object.isPoints || object.isLine || object.isSprite ) ) {
|
|
30138
|
+
|
|
30139
|
+
return;
|
|
30140
|
+
|
|
30141
|
+
}
|
|
30142
|
+
|
|
30555
30143
|
const material = object.material;
|
|
30556
30144
|
|
|
30557
30145
|
if ( material ) {
|
|
@@ -30850,13 +30438,6 @@ class WebGLRenderer {
|
|
|
30850
30438
|
|
|
30851
30439
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
30852
30440
|
|
|
30853
|
-
textures.runDeferredUploads();
|
|
30854
|
-
|
|
30855
|
-
if ( xr.enabled && xr.submitFrame ) {
|
|
30856
|
-
|
|
30857
|
-
xr.submitFrame();
|
|
30858
|
-
|
|
30859
|
-
}
|
|
30860
30441
|
// _gl.finish();
|
|
30861
30442
|
|
|
30862
30443
|
bindingStates.resetDefaultState();
|
|
@@ -31569,7 +31150,21 @@ class WebGLRenderer {
|
|
|
31569
31150
|
|
|
31570
31151
|
} else {
|
|
31571
31152
|
|
|
31572
|
-
|
|
31153
|
+
if ( capabilities.reverseDepthBuffer ) {
|
|
31154
|
+
|
|
31155
|
+
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
31156
|
+
|
|
31157
|
+
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
31158
|
+
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
31159
|
+
|
|
31160
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
31161
|
+
|
|
31162
|
+
} else {
|
|
31163
|
+
|
|
31164
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
31165
|
+
|
|
31166
|
+
}
|
|
31167
|
+
|
|
31573
31168
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
31574
31169
|
|
|
31575
31170
|
}
|
|
@@ -32087,61 +31682,55 @@ class WebGLRenderer {
|
|
|
32087
31682
|
|
|
32088
31683
|
if ( framebuffer ) {
|
|
32089
31684
|
|
|
32090
|
-
|
|
32091
|
-
|
|
32092
|
-
|
|
32093
|
-
|
|
32094
|
-
const texture = renderTarget.texture;
|
|
32095
|
-
const textureFormat = texture.format;
|
|
32096
|
-
const textureType = texture.type;
|
|
32097
|
-
|
|
32098
|
-
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
31685
|
+
const texture = renderTarget.texture;
|
|
31686
|
+
const textureFormat = texture.format;
|
|
31687
|
+
const textureType = texture.type;
|
|
32099
31688
|
|
|
32100
|
-
|
|
31689
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
32101
31690
|
|
|
32102
|
-
|
|
31691
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
32103
31692
|
|
|
32104
|
-
|
|
31693
|
+
}
|
|
32105
31694
|
|
|
32106
|
-
|
|
31695
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
32107
31696
|
|
|
32108
|
-
|
|
31697
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
32109
31698
|
|
|
32110
|
-
|
|
32111
|
-
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32112
|
-
|
|
32113
|
-
const glBuffer = _gl.createBuffer();
|
|
32114
|
-
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32115
|
-
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
32116
|
-
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32117
|
-
_gl.flush();
|
|
31699
|
+
}
|
|
32118
31700
|
|
|
32119
|
-
|
|
32120
|
-
|
|
32121
|
-
await probeAsync( _gl, sync, 4 );
|
|
31701
|
+
// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
|
|
31702
|
+
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32122
31703
|
|
|
32123
|
-
|
|
31704
|
+
// set the active frame buffer to the one we want to read
|
|
31705
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
32124
31706
|
|
|
32125
|
-
|
|
32126
|
-
|
|
31707
|
+
const glBuffer = _gl.createBuffer();
|
|
31708
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
31709
|
+
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
31710
|
+
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32127
31711
|
|
|
32128
|
-
|
|
31712
|
+
// reset the frame buffer to the currently set buffer before waiting
|
|
31713
|
+
const currFramebuffer = _currentRenderTarget !== null ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
31714
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, currFramebuffer );
|
|
32129
31715
|
|
|
32130
|
-
|
|
32131
|
-
|
|
31716
|
+
// check if the commands have finished every 8 ms
|
|
31717
|
+
const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
|
|
32132
31718
|
|
|
32133
|
-
|
|
31719
|
+
_gl.flush();
|
|
32134
31720
|
|
|
32135
|
-
|
|
31721
|
+
await probeAsync( _gl, sync, 4 );
|
|
32136
31722
|
|
|
32137
|
-
|
|
31723
|
+
// read the data and delete the buffer
|
|
31724
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
31725
|
+
_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
|
|
31726
|
+
_gl.deleteBuffer( glBuffer );
|
|
31727
|
+
_gl.deleteSync( sync );
|
|
32138
31728
|
|
|
32139
|
-
|
|
31729
|
+
return buffer;
|
|
32140
31730
|
|
|
32141
|
-
|
|
31731
|
+
} else {
|
|
32142
31732
|
|
|
32143
|
-
|
|
32144
|
-
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
31733
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.' );
|
|
32145
31734
|
|
|
32146
31735
|
}
|
|
32147
31736
|
|
|
@@ -32627,7 +32216,6 @@ class InterleavedBuffer {
|
|
|
32627
32216
|
this.count = array !== undefined ? array.length / stride : 0;
|
|
32628
32217
|
|
|
32629
32218
|
this.usage = StaticDrawUsage;
|
|
32630
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
32631
32219
|
this.updateRanges = [];
|
|
32632
32220
|
|
|
32633
32221
|
this.version = 0;
|
|
@@ -32644,13 +32232,6 @@ class InterleavedBuffer {
|
|
|
32644
32232
|
|
|
32645
32233
|
}
|
|
32646
32234
|
|
|
32647
|
-
get updateRange() {
|
|
32648
|
-
|
|
32649
|
-
warnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
32650
|
-
return this._updateRange;
|
|
32651
|
-
|
|
32652
|
-
}
|
|
32653
|
-
|
|
32654
32235
|
setUsage( value ) {
|
|
32655
32236
|
|
|
32656
32237
|
this.usage = value;
|
|
@@ -33415,6 +32996,27 @@ class LOD extends Object3D {
|
|
|
33415
32996
|
|
|
33416
32997
|
}
|
|
33417
32998
|
|
|
32999
|
+
removeLevel( distance ) {
|
|
33000
|
+
|
|
33001
|
+
const levels = this.levels;
|
|
33002
|
+
|
|
33003
|
+
for ( let i = 0; i < levels.length; i ++ ) {
|
|
33004
|
+
|
|
33005
|
+
if ( levels[ i ].distance === distance ) {
|
|
33006
|
+
|
|
33007
|
+
const removedElements = levels.splice( i, 1 );
|
|
33008
|
+
this.remove( removedElements[ 0 ].object );
|
|
33009
|
+
|
|
33010
|
+
return true;
|
|
33011
|
+
|
|
33012
|
+
}
|
|
33013
|
+
|
|
33014
|
+
}
|
|
33015
|
+
|
|
33016
|
+
return false;
|
|
33017
|
+
|
|
33018
|
+
}
|
|
33019
|
+
|
|
33418
33020
|
getCurrentLevel() {
|
|
33419
33021
|
|
|
33420
33022
|
return this._currentLevel;
|
|
@@ -34534,6 +34136,9 @@ class BatchedMesh extends Mesh {
|
|
|
34534
34136
|
// stores visible, active, and geometry id per object
|
|
34535
34137
|
this._drawInfo = [];
|
|
34536
34138
|
|
|
34139
|
+
// instance ids that have been set as inactive, and are available to be overwritten
|
|
34140
|
+
this._availableInstanceIds = [];
|
|
34141
|
+
|
|
34537
34142
|
// geometry information
|
|
34538
34143
|
this._drawRanges = [];
|
|
34539
34144
|
this._reservedRanges = [];
|
|
@@ -34733,23 +34338,36 @@ class BatchedMesh extends Mesh {
|
|
|
34733
34338
|
|
|
34734
34339
|
addInstance( geometryId ) {
|
|
34735
34340
|
|
|
34341
|
+
const atCapacity = this._drawInfo.length >= this.maxInstanceCount;
|
|
34342
|
+
|
|
34736
34343
|
// ensure we're not over geometry
|
|
34737
|
-
if ( this.
|
|
34344
|
+
if ( atCapacity && this._availableInstanceIds.length === 0 ) {
|
|
34738
34345
|
|
|
34739
34346
|
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34740
34347
|
|
|
34741
34348
|
}
|
|
34742
34349
|
|
|
34743
|
-
|
|
34744
|
-
|
|
34350
|
+
const instanceDrawInfo = {
|
|
34745
34351
|
visible: true,
|
|
34746
34352
|
active: true,
|
|
34747
34353
|
geometryIndex: geometryId,
|
|
34354
|
+
};
|
|
34748
34355
|
|
|
34749
|
-
|
|
34356
|
+
let drawId = null;
|
|
34357
|
+
|
|
34358
|
+
// Prioritize using previously freed instance ids
|
|
34359
|
+
if ( this._availableInstanceIds.length > 0 ) {
|
|
34360
|
+
|
|
34361
|
+
drawId = this._availableInstanceIds.pop();
|
|
34362
|
+
this._drawInfo[ drawId ] = instanceDrawInfo;
|
|
34363
|
+
|
|
34364
|
+
} else {
|
|
34365
|
+
|
|
34366
|
+
drawId = this._drawInfo.length;
|
|
34367
|
+
this._drawInfo.push( instanceDrawInfo );
|
|
34368
|
+
|
|
34369
|
+
}
|
|
34750
34370
|
|
|
34751
|
-
// initialize the matrix
|
|
34752
|
-
const drawId = this._drawInfo.length - 1;
|
|
34753
34371
|
const matricesTexture = this._matricesTexture;
|
|
34754
34372
|
const matricesArray = matricesTexture.image.data;
|
|
34755
34373
|
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
@@ -34998,11 +34616,8 @@ class BatchedMesh extends Mesh {
|
|
|
34998
34616
|
}
|
|
34999
34617
|
*/
|
|
35000
34618
|
|
|
35001
|
-
/*
|
|
35002
34619
|
deleteInstance( instanceId ) {
|
|
35003
34620
|
|
|
35004
|
-
// Note: User needs to call optimize() afterward to pack the data.
|
|
35005
|
-
|
|
35006
34621
|
const drawInfo = this._drawInfo;
|
|
35007
34622
|
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35008
34623
|
|
|
@@ -35011,12 +34626,12 @@ class BatchedMesh extends Mesh {
|
|
|
35011
34626
|
}
|
|
35012
34627
|
|
|
35013
34628
|
drawInfo[ instanceId ].active = false;
|
|
34629
|
+
this._availableInstanceIds.push( instanceId );
|
|
35014
34630
|
this._visibilityChanged = true;
|
|
35015
34631
|
|
|
35016
34632
|
return this;
|
|
35017
34633
|
|
|
35018
34634
|
}
|
|
35019
|
-
*/
|
|
35020
34635
|
|
|
35021
34636
|
// get bounding box and compute it if it doesn't exist
|
|
35022
34637
|
getBoundingBoxAt( geometryId, target ) {
|
|
@@ -35221,6 +34836,59 @@ class BatchedMesh extends Mesh {
|
|
|
35221
34836
|
|
|
35222
34837
|
}
|
|
35223
34838
|
|
|
34839
|
+
setGeometryIdAt( instanceId, geometryId ) {
|
|
34840
|
+
|
|
34841
|
+
// return early if the geometry is out of range or not active
|
|
34842
|
+
const drawInfo = this._drawInfo;
|
|
34843
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34844
|
+
|
|
34845
|
+
return null;
|
|
34846
|
+
|
|
34847
|
+
}
|
|
34848
|
+
|
|
34849
|
+
// check if the provided geometryId is within the valid range
|
|
34850
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
34851
|
+
|
|
34852
|
+
return null;
|
|
34853
|
+
|
|
34854
|
+
}
|
|
34855
|
+
|
|
34856
|
+
drawInfo[ instanceId ].geometryIndex = geometryId;
|
|
34857
|
+
|
|
34858
|
+
return this;
|
|
34859
|
+
|
|
34860
|
+
}
|
|
34861
|
+
|
|
34862
|
+
getGeometryIdAt( instanceId ) {
|
|
34863
|
+
|
|
34864
|
+
const drawInfo = this._drawInfo;
|
|
34865
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34866
|
+
|
|
34867
|
+
return - 1;
|
|
34868
|
+
|
|
34869
|
+
}
|
|
34870
|
+
|
|
34871
|
+
return drawInfo[ instanceId ].geometryIndex;
|
|
34872
|
+
|
|
34873
|
+
}
|
|
34874
|
+
|
|
34875
|
+
getGeometryRangeAt( geometryId, target = {} ) {
|
|
34876
|
+
|
|
34877
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
34878
|
+
|
|
34879
|
+
return null;
|
|
34880
|
+
|
|
34881
|
+
}
|
|
34882
|
+
|
|
34883
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
34884
|
+
|
|
34885
|
+
target.start = drawRange.start;
|
|
34886
|
+
target.count = drawRange.count;
|
|
34887
|
+
|
|
34888
|
+
return target;
|
|
34889
|
+
|
|
34890
|
+
}
|
|
34891
|
+
|
|
35224
34892
|
raycast( raycaster, intersects ) {
|
|
35225
34893
|
|
|
35226
34894
|
const drawInfo = this._drawInfo;
|
|
@@ -35772,6 +35440,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
35772
35440
|
index: a,
|
|
35773
35441
|
face: null,
|
|
35774
35442
|
faceIndex: null,
|
|
35443
|
+
barycoord: null,
|
|
35775
35444
|
object: object
|
|
35776
35445
|
|
|
35777
35446
|
};
|
|
@@ -36037,6 +35706,8 @@ function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, inte
|
|
|
36037
35706
|
point: intersectPoint,
|
|
36038
35707
|
index: index,
|
|
36039
35708
|
face: null,
|
|
35709
|
+
faceIndex: null,
|
|
35710
|
+
barycoord: null,
|
|
36040
35711
|
object: object
|
|
36041
35712
|
|
|
36042
35713
|
} );
|
|
@@ -38539,12 +38210,19 @@ class CylinderGeometry extends BufferGeometry {
|
|
|
38539
38210
|
|
|
38540
38211
|
// faces
|
|
38541
38212
|
|
|
38542
|
-
|
|
38543
|
-
indices.push( b, c, d );
|
|
38213
|
+
if ( radiusTop > 0 ) {
|
|
38544
38214
|
|
|
38545
|
-
|
|
38215
|
+
indices.push( a, b, d );
|
|
38216
|
+
groupCount += 3;
|
|
38546
38217
|
|
|
38547
|
-
|
|
38218
|
+
}
|
|
38219
|
+
|
|
38220
|
+
if ( radiusBottom > 0 ) {
|
|
38221
|
+
|
|
38222
|
+
indices.push( b, c, d );
|
|
38223
|
+
groupCount += 3;
|
|
38224
|
+
|
|
38225
|
+
}
|
|
38548
38226
|
|
|
38549
38227
|
}
|
|
38550
38228
|
|
|
@@ -46854,7 +46532,7 @@ class MaterialLoader extends Loader {
|
|
|
46854
46532
|
|
|
46855
46533
|
}
|
|
46856
46534
|
|
|
46857
|
-
const material =
|
|
46535
|
+
const material = this.createMaterialFromType( json.type );
|
|
46858
46536
|
|
|
46859
46537
|
if ( json.uuid !== undefined ) material.uuid = json.uuid;
|
|
46860
46538
|
if ( json.name !== undefined ) material.name = json.name;
|
|
@@ -47110,6 +46788,12 @@ class MaterialLoader extends Loader {
|
|
|
47110
46788
|
|
|
47111
46789
|
}
|
|
47112
46790
|
|
|
46791
|
+
createMaterialFromType( type ) {
|
|
46792
|
+
|
|
46793
|
+
return MaterialLoader.createMaterialFromType( type );
|
|
46794
|
+
|
|
46795
|
+
}
|
|
46796
|
+
|
|
47113
46797
|
static createMaterialFromType( type ) {
|
|
47114
46798
|
|
|
47115
46799
|
const materialLib = {
|
|
@@ -48955,7 +48639,7 @@ class Clock {
|
|
|
48955
48639
|
|
|
48956
48640
|
function now() {
|
|
48957
48641
|
|
|
48958
|
-
return
|
|
48642
|
+
return performance.now();
|
|
48959
48643
|
|
|
48960
48644
|
}
|
|
48961
48645
|
|
|
@@ -49247,7 +48931,7 @@ class Audio extends Object3D {
|
|
|
49247
48931
|
|
|
49248
48932
|
}
|
|
49249
48933
|
|
|
49250
|
-
stop() {
|
|
48934
|
+
stop( delay = 0 ) {
|
|
49251
48935
|
|
|
49252
48936
|
if ( this.hasPlaybackControl === false ) {
|
|
49253
48937
|
|
|
@@ -49260,7 +48944,7 @@ class Audio extends Object3D {
|
|
|
49260
48944
|
|
|
49261
48945
|
if ( this.source !== null ) {
|
|
49262
48946
|
|
|
49263
|
-
this.source.stop();
|
|
48947
|
+
this.source.stop( this.context.currentTime + delay );
|
|
49264
48948
|
this.source.onended = null;
|
|
49265
48949
|
|
|
49266
48950
|
}
|
|
@@ -54902,7 +54586,7 @@ class ShapePath {
|
|
|
54902
54586
|
|
|
54903
54587
|
class Controls extends EventDispatcher {
|
|
54904
54588
|
|
|
54905
|
-
constructor( object, domElement ) {
|
|
54589
|
+
constructor( object, domElement = null ) {
|
|
54906
54590
|
|
|
54907
54591
|
super();
|
|
54908
54592
|
|