super-three 0.168.0 → 0.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +369 -131
- package/build/three.module.js +369 -131
- 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 +64 -41
- 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/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 );
|
|
13623
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 ++ ) {
|
|
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 ++ ) {
|
|
13634
13695
|
|
|
13635
|
-
|
|
13636
|
-
if ( updateRange.count !== - 1 ) {
|
|
13696
|
+
const range = updateRanges[ i ];
|
|
13637
13697
|
|
|
13638
|
-
|
|
13639
|
-
|
|
13698
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13699
|
+
array, range.start, range.count );
|
|
13700
|
+
|
|
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;
|
|
@@ -29767,6 +29887,7 @@ class WebGLRenderer {
|
|
|
29767
29887
|
|
|
29768
29888
|
// camera matrices cache
|
|
29769
29889
|
|
|
29890
|
+
const _currentProjectionMatrix = new Matrix4();
|
|
29770
29891
|
const _projScreenMatrix = new Matrix4();
|
|
29771
29892
|
|
|
29772
29893
|
const _vector3 = new Vector3();
|
|
@@ -29863,6 +29984,8 @@ class WebGLRenderer {
|
|
|
29863
29984
|
|
|
29864
29985
|
state = new WebGLState( _gl );
|
|
29865
29986
|
|
|
29987
|
+
if ( capabilities.reverseDepthBuffer ) state.buffers.depth.setReversed( true );
|
|
29988
|
+
|
|
29866
29989
|
info = new WebGLInfo( _gl );
|
|
29867
29990
|
properties = new WebGLProperties();
|
|
29868
29991
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
@@ -30163,7 +30286,13 @@ class WebGLRenderer {
|
|
|
30163
30286
|
|
|
30164
30287
|
}
|
|
30165
30288
|
|
|
30166
|
-
if ( depth )
|
|
30289
|
+
if ( depth ) {
|
|
30290
|
+
|
|
30291
|
+
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
30292
|
+
_gl.clearDepth( this.capabilities.reverseDepthBuffer ? 0 : 1 );
|
|
30293
|
+
|
|
30294
|
+
}
|
|
30295
|
+
|
|
30167
30296
|
if ( stencil ) {
|
|
30168
30297
|
|
|
30169
30298
|
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -30552,6 +30681,12 @@ class WebGLRenderer {
|
|
|
30552
30681
|
|
|
30553
30682
|
scene.traverse( function ( object ) {
|
|
30554
30683
|
|
|
30684
|
+
if ( ! ( object.isMesh || object.isPoints || object.isLine || object.isSprite ) ) {
|
|
30685
|
+
|
|
30686
|
+
return;
|
|
30687
|
+
|
|
30688
|
+
}
|
|
30689
|
+
|
|
30555
30690
|
const material = object.material;
|
|
30556
30691
|
|
|
30557
30692
|
if ( material ) {
|
|
@@ -31569,7 +31704,21 @@ class WebGLRenderer {
|
|
|
31569
31704
|
|
|
31570
31705
|
} else {
|
|
31571
31706
|
|
|
31572
|
-
|
|
31707
|
+
if ( capabilities.reverseDepthBuffer ) {
|
|
31708
|
+
|
|
31709
|
+
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
31710
|
+
|
|
31711
|
+
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
31712
|
+
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
31713
|
+
|
|
31714
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
31715
|
+
|
|
31716
|
+
} else {
|
|
31717
|
+
|
|
31718
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
31719
|
+
|
|
31720
|
+
}
|
|
31721
|
+
|
|
31573
31722
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
31574
31723
|
|
|
31575
31724
|
}
|
|
@@ -32087,61 +32236,55 @@ class WebGLRenderer {
|
|
|
32087
32236
|
|
|
32088
32237
|
if ( framebuffer ) {
|
|
32089
32238
|
|
|
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 ) ) {
|
|
32239
|
+
const texture = renderTarget.texture;
|
|
32240
|
+
const textureFormat = texture.format;
|
|
32241
|
+
const textureType = texture.type;
|
|
32099
32242
|
|
|
32100
|
-
|
|
32243
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
32101
32244
|
|
|
32102
|
-
|
|
32245
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
32103
32246
|
|
|
32104
|
-
|
|
32247
|
+
}
|
|
32105
32248
|
|
|
32106
|
-
|
|
32249
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
32107
32250
|
|
|
32108
|
-
|
|
32251
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
32109
32252
|
|
|
32110
|
-
|
|
32111
|
-
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32253
|
+
}
|
|
32112
32254
|
|
|
32113
|
-
|
|
32114
|
-
|
|
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();
|
|
32255
|
+
// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
|
|
32256
|
+
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32118
32257
|
|
|
32119
|
-
|
|
32120
|
-
|
|
32121
|
-
await probeAsync( _gl, sync, 4 );
|
|
32258
|
+
// set the active frame buffer to the one we want to read
|
|
32259
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
32122
32260
|
|
|
32123
|
-
|
|
32261
|
+
const glBuffer = _gl.createBuffer();
|
|
32262
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32263
|
+
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
32264
|
+
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32124
32265
|
|
|
32125
|
-
|
|
32126
|
-
|
|
32266
|
+
// reset the frame buffer to the currently set buffer before waiting
|
|
32267
|
+
const currFramebuffer = _currentRenderTarget !== null ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
32268
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, currFramebuffer );
|
|
32127
32269
|
|
|
32128
|
-
|
|
32270
|
+
// check if the commands have finished every 8 ms
|
|
32271
|
+
const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
|
|
32129
32272
|
|
|
32130
|
-
|
|
32131
|
-
_gl.deleteSync( sync );
|
|
32273
|
+
_gl.flush();
|
|
32132
32274
|
|
|
32133
|
-
|
|
32275
|
+
await probeAsync( _gl, sync, 4 );
|
|
32134
32276
|
|
|
32135
|
-
|
|
32277
|
+
// read the data and delete the buffer
|
|
32278
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32279
|
+
_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
|
|
32280
|
+
_gl.deleteBuffer( glBuffer );
|
|
32281
|
+
_gl.deleteSync( sync );
|
|
32136
32282
|
|
|
32137
|
-
|
|
32283
|
+
return buffer;
|
|
32138
32284
|
|
|
32139
|
-
}
|
|
32285
|
+
} else {
|
|
32140
32286
|
|
|
32141
|
-
|
|
32142
|
-
|
|
32143
|
-
const framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
32144
|
-
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
32287
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.' );
|
|
32145
32288
|
|
|
32146
32289
|
}
|
|
32147
32290
|
|
|
@@ -32627,7 +32770,6 @@ class InterleavedBuffer {
|
|
|
32627
32770
|
this.count = array !== undefined ? array.length / stride : 0;
|
|
32628
32771
|
|
|
32629
32772
|
this.usage = StaticDrawUsage;
|
|
32630
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
32631
32773
|
this.updateRanges = [];
|
|
32632
32774
|
|
|
32633
32775
|
this.version = 0;
|
|
@@ -32644,13 +32786,6 @@ class InterleavedBuffer {
|
|
|
32644
32786
|
|
|
32645
32787
|
}
|
|
32646
32788
|
|
|
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
32789
|
setUsage( value ) {
|
|
32655
32790
|
|
|
32656
32791
|
this.usage = value;
|
|
@@ -33415,6 +33550,27 @@ class LOD extends Object3D {
|
|
|
33415
33550
|
|
|
33416
33551
|
}
|
|
33417
33552
|
|
|
33553
|
+
removeLevel( distance ) {
|
|
33554
|
+
|
|
33555
|
+
const levels = this.levels;
|
|
33556
|
+
|
|
33557
|
+
for ( let i = 0; i < levels.length; i ++ ) {
|
|
33558
|
+
|
|
33559
|
+
if ( levels[ i ].distance === distance ) {
|
|
33560
|
+
|
|
33561
|
+
const removedElements = levels.splice( i, 1 );
|
|
33562
|
+
this.remove( removedElements[ 0 ].object );
|
|
33563
|
+
|
|
33564
|
+
return true;
|
|
33565
|
+
|
|
33566
|
+
}
|
|
33567
|
+
|
|
33568
|
+
}
|
|
33569
|
+
|
|
33570
|
+
return false;
|
|
33571
|
+
|
|
33572
|
+
}
|
|
33573
|
+
|
|
33418
33574
|
getCurrentLevel() {
|
|
33419
33575
|
|
|
33420
33576
|
return this._currentLevel;
|
|
@@ -34534,6 +34690,9 @@ class BatchedMesh extends Mesh {
|
|
|
34534
34690
|
// stores visible, active, and geometry id per object
|
|
34535
34691
|
this._drawInfo = [];
|
|
34536
34692
|
|
|
34693
|
+
// instance ids that have been set as inactive, and are available to be overwritten
|
|
34694
|
+
this._availableInstanceIds = [];
|
|
34695
|
+
|
|
34537
34696
|
// geometry information
|
|
34538
34697
|
this._drawRanges = [];
|
|
34539
34698
|
this._reservedRanges = [];
|
|
@@ -34733,23 +34892,36 @@ class BatchedMesh extends Mesh {
|
|
|
34733
34892
|
|
|
34734
34893
|
addInstance( geometryId ) {
|
|
34735
34894
|
|
|
34895
|
+
const atCapacity = this._drawInfo.length >= this.maxInstanceCount;
|
|
34896
|
+
|
|
34736
34897
|
// ensure we're not over geometry
|
|
34737
|
-
if ( this.
|
|
34898
|
+
if ( atCapacity && this._availableInstanceIds.length === 0 ) {
|
|
34738
34899
|
|
|
34739
34900
|
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34740
34901
|
|
|
34741
34902
|
}
|
|
34742
34903
|
|
|
34743
|
-
|
|
34744
|
-
|
|
34904
|
+
const instanceDrawInfo = {
|
|
34745
34905
|
visible: true,
|
|
34746
34906
|
active: true,
|
|
34747
34907
|
geometryIndex: geometryId,
|
|
34908
|
+
};
|
|
34748
34909
|
|
|
34749
|
-
|
|
34910
|
+
let drawId = null;
|
|
34911
|
+
|
|
34912
|
+
// Prioritize using previously freed instance ids
|
|
34913
|
+
if ( this._availableInstanceIds.length > 0 ) {
|
|
34914
|
+
|
|
34915
|
+
drawId = this._availableInstanceIds.pop();
|
|
34916
|
+
this._drawInfo[ drawId ] = instanceDrawInfo;
|
|
34917
|
+
|
|
34918
|
+
} else {
|
|
34919
|
+
|
|
34920
|
+
drawId = this._drawInfo.length;
|
|
34921
|
+
this._drawInfo.push( instanceDrawInfo );
|
|
34922
|
+
|
|
34923
|
+
}
|
|
34750
34924
|
|
|
34751
|
-
// initialize the matrix
|
|
34752
|
-
const drawId = this._drawInfo.length - 1;
|
|
34753
34925
|
const matricesTexture = this._matricesTexture;
|
|
34754
34926
|
const matricesArray = matricesTexture.image.data;
|
|
34755
34927
|
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
@@ -34998,11 +35170,8 @@ class BatchedMesh extends Mesh {
|
|
|
34998
35170
|
}
|
|
34999
35171
|
*/
|
|
35000
35172
|
|
|
35001
|
-
/*
|
|
35002
35173
|
deleteInstance( instanceId ) {
|
|
35003
35174
|
|
|
35004
|
-
// Note: User needs to call optimize() afterward to pack the data.
|
|
35005
|
-
|
|
35006
35175
|
const drawInfo = this._drawInfo;
|
|
35007
35176
|
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35008
35177
|
|
|
@@ -35011,12 +35180,12 @@ class BatchedMesh extends Mesh {
|
|
|
35011
35180
|
}
|
|
35012
35181
|
|
|
35013
35182
|
drawInfo[ instanceId ].active = false;
|
|
35183
|
+
this._availableInstanceIds.push( instanceId );
|
|
35014
35184
|
this._visibilityChanged = true;
|
|
35015
35185
|
|
|
35016
35186
|
return this;
|
|
35017
35187
|
|
|
35018
35188
|
}
|
|
35019
|
-
*/
|
|
35020
35189
|
|
|
35021
35190
|
// get bounding box and compute it if it doesn't exist
|
|
35022
35191
|
getBoundingBoxAt( geometryId, target ) {
|
|
@@ -35221,6 +35390,59 @@ class BatchedMesh extends Mesh {
|
|
|
35221
35390
|
|
|
35222
35391
|
}
|
|
35223
35392
|
|
|
35393
|
+
setGeometryIdAt( instanceId, geometryId ) {
|
|
35394
|
+
|
|
35395
|
+
// return early if the geometry is out of range or not active
|
|
35396
|
+
const drawInfo = this._drawInfo;
|
|
35397
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35398
|
+
|
|
35399
|
+
return null;
|
|
35400
|
+
|
|
35401
|
+
}
|
|
35402
|
+
|
|
35403
|
+
// check if the provided geometryId is within the valid range
|
|
35404
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
35405
|
+
|
|
35406
|
+
return null;
|
|
35407
|
+
|
|
35408
|
+
}
|
|
35409
|
+
|
|
35410
|
+
drawInfo[ instanceId ].geometryIndex = geometryId;
|
|
35411
|
+
|
|
35412
|
+
return this;
|
|
35413
|
+
|
|
35414
|
+
}
|
|
35415
|
+
|
|
35416
|
+
getGeometryIdAt( instanceId ) {
|
|
35417
|
+
|
|
35418
|
+
const drawInfo = this._drawInfo;
|
|
35419
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35420
|
+
|
|
35421
|
+
return - 1;
|
|
35422
|
+
|
|
35423
|
+
}
|
|
35424
|
+
|
|
35425
|
+
return drawInfo[ instanceId ].geometryIndex;
|
|
35426
|
+
|
|
35427
|
+
}
|
|
35428
|
+
|
|
35429
|
+
getGeometryRangeAt( geometryId, target = {} ) {
|
|
35430
|
+
|
|
35431
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
35432
|
+
|
|
35433
|
+
return null;
|
|
35434
|
+
|
|
35435
|
+
}
|
|
35436
|
+
|
|
35437
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
35438
|
+
|
|
35439
|
+
target.start = drawRange.start;
|
|
35440
|
+
target.count = drawRange.count;
|
|
35441
|
+
|
|
35442
|
+
return target;
|
|
35443
|
+
|
|
35444
|
+
}
|
|
35445
|
+
|
|
35224
35446
|
raycast( raycaster, intersects ) {
|
|
35225
35447
|
|
|
35226
35448
|
const drawInfo = this._drawInfo;
|
|
@@ -35772,6 +35994,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
35772
35994
|
index: a,
|
|
35773
35995
|
face: null,
|
|
35774
35996
|
faceIndex: null,
|
|
35997
|
+
barycoord: null,
|
|
35775
35998
|
object: object
|
|
35776
35999
|
|
|
35777
36000
|
};
|
|
@@ -36037,6 +36260,8 @@ function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, inte
|
|
|
36037
36260
|
point: intersectPoint,
|
|
36038
36261
|
index: index,
|
|
36039
36262
|
face: null,
|
|
36263
|
+
faceIndex: null,
|
|
36264
|
+
barycoord: null,
|
|
36040
36265
|
object: object
|
|
36041
36266
|
|
|
36042
36267
|
} );
|
|
@@ -38539,12 +38764,19 @@ class CylinderGeometry extends BufferGeometry {
|
|
|
38539
38764
|
|
|
38540
38765
|
// faces
|
|
38541
38766
|
|
|
38542
|
-
|
|
38543
|
-
indices.push( b, c, d );
|
|
38767
|
+
if ( radiusTop > 0 ) {
|
|
38544
38768
|
|
|
38545
|
-
|
|
38769
|
+
indices.push( a, b, d );
|
|
38770
|
+
groupCount += 3;
|
|
38546
38771
|
|
|
38547
|
-
|
|
38772
|
+
}
|
|
38773
|
+
|
|
38774
|
+
if ( radiusBottom > 0 ) {
|
|
38775
|
+
|
|
38776
|
+
indices.push( b, c, d );
|
|
38777
|
+
groupCount += 3;
|
|
38778
|
+
|
|
38779
|
+
}
|
|
38548
38780
|
|
|
38549
38781
|
}
|
|
38550
38782
|
|
|
@@ -46854,7 +47086,7 @@ class MaterialLoader extends Loader {
|
|
|
46854
47086
|
|
|
46855
47087
|
}
|
|
46856
47088
|
|
|
46857
|
-
const material =
|
|
47089
|
+
const material = this.createMaterialFromType( json.type );
|
|
46858
47090
|
|
|
46859
47091
|
if ( json.uuid !== undefined ) material.uuid = json.uuid;
|
|
46860
47092
|
if ( json.name !== undefined ) material.name = json.name;
|
|
@@ -47110,6 +47342,12 @@ class MaterialLoader extends Loader {
|
|
|
47110
47342
|
|
|
47111
47343
|
}
|
|
47112
47344
|
|
|
47345
|
+
createMaterialFromType( type ) {
|
|
47346
|
+
|
|
47347
|
+
return MaterialLoader.createMaterialFromType( type );
|
|
47348
|
+
|
|
47349
|
+
}
|
|
47350
|
+
|
|
47113
47351
|
static createMaterialFromType( type ) {
|
|
47114
47352
|
|
|
47115
47353
|
const materialLib = {
|
|
@@ -48955,7 +49193,7 @@ class Clock {
|
|
|
48955
49193
|
|
|
48956
49194
|
function now() {
|
|
48957
49195
|
|
|
48958
|
-
return
|
|
49196
|
+
return performance.now();
|
|
48959
49197
|
|
|
48960
49198
|
}
|
|
48961
49199
|
|
|
@@ -49247,7 +49485,7 @@ class Audio extends Object3D {
|
|
|
49247
49485
|
|
|
49248
49486
|
}
|
|
49249
49487
|
|
|
49250
|
-
stop() {
|
|
49488
|
+
stop( delay = 0 ) {
|
|
49251
49489
|
|
|
49252
49490
|
if ( this.hasPlaybackControl === false ) {
|
|
49253
49491
|
|
|
@@ -49260,7 +49498,7 @@ class Audio extends Object3D {
|
|
|
49260
49498
|
|
|
49261
49499
|
if ( this.source !== null ) {
|
|
49262
49500
|
|
|
49263
|
-
this.source.stop();
|
|
49501
|
+
this.source.stop( this.context.currentTime + delay );
|
|
49264
49502
|
this.source.onended = null;
|
|
49265
49503
|
|
|
49266
49504
|
}
|
|
@@ -54902,7 +55140,7 @@ class ShapePath {
|
|
|
54902
55140
|
|
|
54903
55141
|
class Controls extends EventDispatcher {
|
|
54904
55142
|
|
|
54905
|
-
constructor( object, domElement ) {
|
|
55143
|
+
constructor( object, domElement = null ) {
|
|
54906
55144
|
|
|
54907
55145
|
super();
|
|
54908
55146
|
|