@plastic-software/three 0.178.0 → 0.180.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/three.cjs +950 -230
- package/build/three.core.js +754 -138
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +197 -96
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +99 -25
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +4586 -1499
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +4544 -1499
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +2 -3
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +7 -7
- package/examples/jsm/controls/DragControls.js +6 -56
- package/examples/jsm/controls/FirstPersonControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +0 -8
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/GLTFExporter.js +30 -22
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +676 -299
- package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
- package/examples/jsm/interactive/HTMLMesh.js +5 -3
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +9 -5
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +112 -32
- package/examples/jsm/loaders/MaterialXLoader.js +212 -30
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/TTFLoader.js +13 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -892
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +2 -2
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/SkyMesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +14 -5
- package/examples/jsm/postprocessing/GTAOPass.js +10 -9
- package/examples/jsm/postprocessing/OutlinePass.js +17 -17
- package/examples/jsm/postprocessing/SSAOPass.js +10 -9
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +23 -20
- package/examples/jsm/transpiler/TSLEncoder.js +2 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +27 -4
- package/examples/jsm/tsl/display/BloomNode.js +7 -6
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +439 -90
- package/examples/jsm/tsl/display/GTAONode.js +8 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +51 -41
- package/examples/jsm/tsl/display/OutlineNode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +180 -65
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
- package/examples/jsm/tsl/display/boxBlur.js +64 -0
- package/examples/jsm/tsl/display/hashBlur.js +15 -18
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +2 -0
- package/src/Three.TSL.js +98 -24
- package/src/animation/AnimationClip.js +17 -2
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +11 -3
- package/src/core/BufferGeometry.js +2 -2
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/TextureUtils.js +2 -1
- package/src/extras/lib/earcut.js +1 -1
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +35 -6
- package/src/lights/LightShadow.js +21 -8
- package/src/lights/PointLightShadow.js +1 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/FileLoader.js +25 -2
- package/src/loaders/ImageBitmapLoader.js +23 -0
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/materials/Material.js +12 -0
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/NodeMaterial.js +1 -1
- package/src/materials/nodes/PointsNodeMaterial.js +86 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
- package/src/math/ColorManagement.js +7 -1
- package/src/math/Frustum.js +19 -8
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +4 -0
- package/src/nodes/TSL.js +4 -0
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +142 -16
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +2 -2
- package/src/nodes/accessors/InstanceNode.js +3 -1
- package/src/nodes/accessors/Normal.js +11 -11
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +19 -4
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +1 -1
- package/src/nodes/accessors/Texture3DNode.js +13 -0
- package/src/nodes/accessors/TextureNode.js +83 -19
- package/src/nodes/code/FunctionCallNode.js +19 -0
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +6 -2
- package/src/nodes/core/ContextNode.js +44 -1
- package/src/nodes/core/Node.js +30 -22
- package/src/nodes/core/NodeBuilder.js +71 -32
- package/src/nodes/core/NodeFrame.js +1 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +5 -3
- package/src/nodes/core/StackNode.js +71 -4
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformNode.js +79 -14
- package/src/nodes/core/VarNode.js +83 -15
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/PassNode.js +148 -2
- package/src/nodes/display/ScreenNode.js +42 -13
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +94 -4
- package/src/nodes/functions/PhysicalLightingModel.js +2 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +67 -23
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +430 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/LightsNode.js +1 -1
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +1 -1
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +19 -3
- package/src/nodes/math/MathNode.js +72 -60
- package/src/nodes/math/OperatorNode.js +26 -25
- package/src/nodes/tsl/TSLCore.js +477 -142
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/JoinNode.js +3 -1
- package/src/nodes/utils/MemberNode.js +58 -7
- package/src/nodes/utils/RTTNode.js +10 -1
- package/src/nodes/utils/ReflectorNode.js +51 -7
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/objects/BatchedMesh.js +6 -4
- package/src/objects/LOD.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +21 -31
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +19 -1
- package/src/renderers/common/Bindings.js +21 -18
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderObject.js +14 -2
- package/src/renderers/common/Renderer.js +55 -32
- package/src/renderers/common/SampledTexture.js +4 -72
- package/src/renderers/common/Sampler.js +91 -0
- package/src/renderers/common/Storage3DTexture.js +21 -0
- package/src/renderers/common/StorageArrayTexture.js +21 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +52 -14
- package/src/renderers/common/TimestampQueryPool.js +3 -3
- package/src/renderers/common/XRManager.js +51 -17
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +5 -5
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +21 -11
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +6 -6
- package/src/renderers/webgl/WebGLProgram.js +24 -18
- package/src/renderers/webgl/WebGLPrograms.js +4 -4
- package/src/renderers/webgl/WebGLShadowMap.js +11 -1
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +207 -146
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +112 -19
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -3
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -10
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +87 -44
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +169 -99
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +10 -19
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +120 -84
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +3 -3
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +86 -11
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +12 -2
- package/src/textures/VideoTexture.js +27 -2
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
package/build/three.module.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import { Matrix3, Vector2, Color, Matrix4, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, BackSide, cloneUniforms, Euler, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, IntType, HalfFloatType, UnsignedByteType, FloatType, RGBAFormat, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, OrthographicCamera, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, NoBlending, WebGLRenderTarget, BufferGeometry, BufferAttribute, LinearSRGBColorSpace, LinearFilter, warnOnce, Uint32BufferAttribute, Uint16BufferAttribute, arrayNeedsUint32, Vector4, DataArrayTexture, CubeTexture, Data3DTexture, LessEqualCompare, DepthTexture, Texture, TriPlanarMapping, CylindricalMapping, UVMapping, GLSL3, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, UniformsUtils, DoubleSide, NormalBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, ReverseSubtractEquation, SubtractEquation, AddEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcAlphaFactor, SrcColorFactor, OneFactor, ZeroFactor, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceNone, CullFaceBack, CullFaceFront, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, MinEquation, MaxEquation, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearMipmapLinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NotEqualCompare, GreaterCompare, GreaterEqualCompare, EqualCompare, LessCompare, AlwaysCompare, NeverCompare, NoColorSpace, DepthStencilFormat, getByteLength, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, createCanvasElement, SRGBColorSpace, REVISION,
|
|
7
|
-
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp } from './three.core.js';
|
|
6
|
+
import { Matrix3, Vector2, Color, Matrix4, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, BackSide, cloneUniforms, Euler, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, IntType, HalfFloatType, UnsignedByteType, FloatType, RGBAFormat, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, OrthographicCamera, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, NoBlending, WebGLRenderTarget, BufferGeometry, BufferAttribute, LinearSRGBColorSpace, LinearFilter, warnOnce, Uint32BufferAttribute, Uint16BufferAttribute, arrayNeedsUint32, Vector4, DataArrayTexture, CubeTexture, Data3DTexture, LessEqualCompare, DepthTexture, Texture, TriPlanarMapping, CylindricalMapping, UVMapping, GLSL3, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, UniformsUtils, DoubleSide, NormalBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, ReverseSubtractEquation, SubtractEquation, AddEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcAlphaFactor, SrcColorFactor, OneFactor, ZeroFactor, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceNone, CullFaceBack, CullFaceFront, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, MinEquation, MaxEquation, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearMipmapLinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NotEqualCompare, GreaterCompare, GreaterEqualCompare, EqualCompare, LessCompare, AlwaysCompare, NeverCompare, NoColorSpace, DepthStencilFormat, getByteLength, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, UnsignedInt101111Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, ExternalTexture, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, createCanvasElement, SRGBColorSpace, REVISION, WebGLCoordinateSystem, probeAsync } from './three.core.js';
|
|
7
|
+
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp } from './three.core.js';
|
|
8
8
|
|
|
9
9
|
function WebGLAnimation() {
|
|
10
10
|
|
|
@@ -405,13 +405,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
|
|
|
405
405
|
|
|
406
406
|
var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
|
|
407
407
|
|
|
408
|
-
var logdepthbuf_fragment = "#if defined(
|
|
408
|
+
var logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
409
409
|
|
|
410
|
-
var logdepthbuf_pars_fragment = "#if defined(
|
|
410
|
+
var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
411
411
|
|
|
412
|
-
var logdepthbuf_pars_vertex = "#ifdef
|
|
412
|
+
var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
413
413
|
|
|
414
|
-
var logdepthbuf_vertex = "#ifdef
|
|
414
|
+
var logdepthbuf_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
|
|
415
415
|
|
|
416
416
|
var map_fragment = "#ifdef USE_MAP\n\t#ifdef USE_MAP_TRIPLANAR\n\t\tvec4 sampledDiffuseColor = texture2DTriplanar( map, mapTransform, triplanarCoords, triplanarWeights );\n\t#else\n #if defined( USE_MAP_CYLINDRICAL )\n vec2 vMapUv = ( mapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\t\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#endif\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
417
417
|
|
|
@@ -473,7 +473,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
473
473
|
|
|
474
474
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
475
475
|
|
|
476
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\
|
|
476
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";
|
|
477
477
|
|
|
478
478
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
479
479
|
|
|
@@ -523,7 +523,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
523
523
|
|
|
524
524
|
const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <batching_vertex>\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
525
525
|
|
|
526
|
-
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <triplanar_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
526
|
+
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <triplanar_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
527
527
|
|
|
528
528
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
529
529
|
|
|
@@ -2361,7 +2361,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
2361
2361
|
}
|
|
2362
2362
|
|
|
2363
2363
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
2364
|
-
const
|
|
2364
|
+
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
2365
2365
|
|
|
2366
2366
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
2367
2367
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -2389,7 +2389,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
2389
2389
|
|
|
2390
2390
|
precision: precision,
|
|
2391
2391
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
2392
|
-
|
|
2392
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
2393
2393
|
|
|
2394
2394
|
maxTextures: maxTextures,
|
|
2395
2395
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -2994,6 +2994,17 @@ class PMREMGenerator {
|
|
|
2994
2994
|
renderer.toneMapping = NoToneMapping;
|
|
2995
2995
|
renderer.autoClear = false;
|
|
2996
2996
|
|
|
2997
|
+
// https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812
|
|
2998
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
2999
|
+
|
|
3000
|
+
if ( reversedDepthBuffer ) {
|
|
3001
|
+
|
|
3002
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
3003
|
+
renderer.clearDepth();
|
|
3004
|
+
renderer.setRenderTarget( null );
|
|
3005
|
+
|
|
3006
|
+
}
|
|
3007
|
+
|
|
2997
3008
|
const backgroundMaterial = new MeshBasicMaterial( {
|
|
2998
3009
|
name: 'PMREM.Background',
|
|
2999
3010
|
side: BackSide,
|
|
@@ -5625,7 +5636,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
5625
5636
|
function getShaderErrors( gl, shader, type ) {
|
|
5626
5637
|
|
|
5627
5638
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
5628
|
-
|
|
5639
|
+
|
|
5640
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
5641
|
+
const errors = shaderInfoLog.trim();
|
|
5629
5642
|
|
|
5630
5643
|
if ( status && errors === '' ) return '';
|
|
5631
5644
|
|
|
@@ -6129,8 +6142,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6129
6142
|
parameters.bumpMap ? '#define USE_BUMPMAP' : '',
|
|
6130
6143
|
parameters.normalMap ? '#define USE_NORMALMAP' : '',
|
|
6131
6144
|
parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
|
|
6132
|
-
parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
6133
|
-
parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
6145
|
+
parameters.normalMapObjectSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
6146
|
+
parameters.normalMapTangentSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
6134
6147
|
parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
|
|
6135
6148
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
6136
6149
|
|
|
@@ -6140,9 +6153,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6140
6153
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
6141
6154
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
6142
6155
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
6143
|
-
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
6144
|
-
|
|
6145
|
-
|
|
6156
|
+
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
6157
|
+
: parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
|
|
6158
|
+
: parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
|
|
6146
6159
|
|
|
6147
6160
|
parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',
|
|
6148
6161
|
parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',
|
|
@@ -6229,8 +6242,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6229
6242
|
|
|
6230
6243
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
6231
6244
|
|
|
6232
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
6233
|
-
parameters.
|
|
6245
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
6246
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
6234
6247
|
|
|
6235
6248
|
'uniform mat4 modelMatrix;',
|
|
6236
6249
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -6336,8 +6349,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6336
6349
|
parameters.bumpMap ? '#define USE_BUMPMAP' : '',
|
|
6337
6350
|
parameters.normalMap ? '#define USE_NORMALMAP' : '',
|
|
6338
6351
|
parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
|
|
6339
|
-
parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
6340
|
-
parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
6352
|
+
parameters.normalMapObjectSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
6353
|
+
parameters.normalMapTangentSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
6341
6354
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
6342
6355
|
|
|
6343
6356
|
parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
|
|
@@ -6347,9 +6360,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6347
6360
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
6348
6361
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
6349
6362
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
6350
|
-
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
6351
|
-
|
|
6352
|
-
|
|
6363
|
+
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
6364
|
+
: parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
|
|
6365
|
+
: parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
|
|
6353
6366
|
|
|
6354
6367
|
parameters.dispersion ? '#define USE_DISPERSION' : '',
|
|
6355
6368
|
|
|
@@ -6405,8 +6418,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6405
6418
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
6406
6419
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
6407
6420
|
|
|
6408
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
6409
|
-
parameters.
|
|
6421
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
6422
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
6410
6423
|
|
|
6411
6424
|
'uniform mat4 modelViewMatrix;',
|
|
6412
6425
|
'uniform mat4 viewMatrix;',
|
|
@@ -6507,9 +6520,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6507
6520
|
// check for link errors
|
|
6508
6521
|
if ( renderer.debug.checkShaderErrors ) {
|
|
6509
6522
|
|
|
6510
|
-
const
|
|
6511
|
-
const
|
|
6512
|
-
const
|
|
6523
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
6524
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
6525
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
6526
|
+
|
|
6527
|
+
const programLog = programInfoLog.trim();
|
|
6528
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
6529
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
6513
6530
|
|
|
6514
6531
|
let runnable = true;
|
|
6515
6532
|
let haveDiagnostics = true;
|
|
@@ -6895,7 +6912,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
6895
6912
|
}
|
|
6896
6913
|
|
|
6897
6914
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
6898
|
-
const
|
|
6915
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
6899
6916
|
|
|
6900
6917
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
6901
6918
|
const IS_BATCHEDMESH = object.isBatchedMesh === true;
|
|
@@ -7101,7 +7118,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7101
7118
|
|
|
7102
7119
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
7103
7120
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
7104
|
-
|
|
7121
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
7105
7122
|
|
|
7106
7123
|
skinning: object.isSkinnedMesh === true,
|
|
7107
7124
|
|
|
@@ -7234,7 +7251,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7234
7251
|
array.push( parameters.anisotropyMapUv );
|
|
7235
7252
|
array.push( parameters.clearcoatMapUv );
|
|
7236
7253
|
array.push( parameters.clearcoatNormalMapUv );
|
|
7237
|
-
array.push( parameters.clearcoatNormalMapMode);
|
|
7254
|
+
array.push( parameters.clearcoatNormalMapMode );
|
|
7238
7255
|
array.push( parameters.clearcoatRoughnessMapUv );
|
|
7239
7256
|
array.push( parameters.iridescenceMapUv );
|
|
7240
7257
|
array.push( parameters.iridescenceThicknessMapUv );
|
|
@@ -7333,7 +7350,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7333
7350
|
_programLayers.enable( 2 );
|
|
7334
7351
|
if ( parameters.logarithmicDepthBuffer )
|
|
7335
7352
|
_programLayers.enable( 3 );
|
|
7336
|
-
if ( parameters.
|
|
7353
|
+
if ( parameters.reversedDepthBuffer )
|
|
7337
7354
|
_programLayers.enable( 4 );
|
|
7338
7355
|
if ( parameters.skinning )
|
|
7339
7356
|
_programLayers.enable( 5 );
|
|
@@ -8500,7 +8517,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
8500
8517
|
|
|
8501
8518
|
// Set GL state for depth map.
|
|
8502
8519
|
_state.setBlending( NoBlending );
|
|
8503
|
-
|
|
8520
|
+
|
|
8521
|
+
if ( _state.buffers.depth.getReversed() === true ) {
|
|
8522
|
+
|
|
8523
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
8524
|
+
|
|
8525
|
+
} else {
|
|
8526
|
+
|
|
8527
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
8528
|
+
|
|
8529
|
+
}
|
|
8530
|
+
|
|
8504
8531
|
_state.buffers.depth.setTest( true );
|
|
8505
8532
|
_state.setScissorTest( false );
|
|
8506
8533
|
|
|
@@ -10360,6 +10387,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10360
10387
|
if ( glFormat === _gl.RGB ) {
|
|
10361
10388
|
|
|
10362
10389
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
10390
|
+
if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
|
|
10363
10391
|
|
|
10364
10392
|
}
|
|
10365
10393
|
|
|
@@ -10674,7 +10702,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10674
10702
|
|
|
10675
10703
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
10676
10704
|
|
|
10677
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10705
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10678
10706
|
|
|
10679
10707
|
const image = texture.image;
|
|
10680
10708
|
|
|
@@ -10693,6 +10721,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10693
10721
|
|
|
10694
10722
|
}
|
|
10695
10723
|
|
|
10724
|
+
} else if ( texture.isExternalTexture ) {
|
|
10725
|
+
|
|
10726
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
10727
|
+
|
|
10696
10728
|
}
|
|
10697
10729
|
|
|
10698
10730
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -10703,7 +10735,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10703
10735
|
|
|
10704
10736
|
const textureProperties = properties.get( texture );
|
|
10705
10737
|
|
|
10706
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10738
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10707
10739
|
|
|
10708
10740
|
uploadTexture( textureProperties, texture, slot );
|
|
10709
10741
|
return;
|
|
@@ -10718,7 +10750,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10718
10750
|
|
|
10719
10751
|
const textureProperties = properties.get( texture );
|
|
10720
10752
|
|
|
10721
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10753
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10722
10754
|
|
|
10723
10755
|
uploadTexture( textureProperties, texture, slot );
|
|
10724
10756
|
return;
|
|
@@ -12161,13 +12193,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12161
12193
|
const attachment = textures[ i ];
|
|
12162
12194
|
const attachmentProperties = properties.get( attachment );
|
|
12163
12195
|
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12196
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
12197
|
+
|
|
12198
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
12199
|
+
|
|
12200
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
12201
|
+
|
|
12202
|
+
}
|
|
12203
|
+
|
|
12204
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
12205
|
+
setTextureParameters( glTextureType, attachment );
|
|
12206
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
12167
12207
|
|
|
12168
12208
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
12169
12209
|
|
|
12170
|
-
generateMipmap(
|
|
12210
|
+
generateMipmap( glTextureType );
|
|
12171
12211
|
|
|
12172
12212
|
}
|
|
12173
12213
|
|
|
@@ -12493,6 +12533,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
12493
12533
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
12494
12534
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
12495
12535
|
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
12536
|
+
if ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;
|
|
12496
12537
|
|
|
12497
12538
|
if ( p === ByteType ) return gl.BYTE;
|
|
12498
12539
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -12661,7 +12702,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
12661
12702
|
|
|
12662
12703
|
if ( extension !== null ) {
|
|
12663
12704
|
|
|
12664
|
-
if ( p ===
|
|
12705
|
+
if ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
|
|
12665
12706
|
if ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;
|
|
12666
12707
|
if ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;
|
|
12667
12708
|
if ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
|
|
@@ -12727,9 +12768,9 @@ class WebXRDepthSensing {
|
|
|
12727
12768
|
constructor() {
|
|
12728
12769
|
|
|
12729
12770
|
/**
|
|
12730
|
-
*
|
|
12771
|
+
* An opaque texture representing the depth of the user's environment.
|
|
12731
12772
|
*
|
|
12732
|
-
* @type {?
|
|
12773
|
+
* @type {?ExternalTexture}
|
|
12733
12774
|
*/
|
|
12734
12775
|
this.texture = null;
|
|
12735
12776
|
|
|
@@ -12759,18 +12800,14 @@ class WebXRDepthSensing {
|
|
|
12759
12800
|
/**
|
|
12760
12801
|
* Inits the depth sensing module
|
|
12761
12802
|
*
|
|
12762
|
-
* @param {WebGLRenderer} renderer - The renderer.
|
|
12763
12803
|
* @param {XRWebGLDepthInformation} depthData - The XR depth data.
|
|
12764
12804
|
* @param {XRRenderState} renderState - The XR render state.
|
|
12765
12805
|
*/
|
|
12766
|
-
init(
|
|
12806
|
+
init( depthData, renderState ) {
|
|
12767
12807
|
|
|
12768
12808
|
if ( this.texture === null ) {
|
|
12769
12809
|
|
|
12770
|
-
const texture = new
|
|
12771
|
-
|
|
12772
|
-
const texProps = renderer.properties.get( texture );
|
|
12773
|
-
texProps.__webglTexture = depthData.texture;
|
|
12810
|
+
const texture = new ExternalTexture( depthData.texture );
|
|
12774
12811
|
|
|
12775
12812
|
if ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {
|
|
12776
12813
|
|
|
@@ -12831,7 +12868,7 @@ class WebXRDepthSensing {
|
|
|
12831
12868
|
/**
|
|
12832
12869
|
* Returns a texture representing the depth of the user's environment.
|
|
12833
12870
|
*
|
|
12834
|
-
* @return {?
|
|
12871
|
+
* @return {?ExternalTexture} The depth texture.
|
|
12835
12872
|
*/
|
|
12836
12873
|
getDepthTexture() {
|
|
12837
12874
|
|
|
@@ -12880,7 +12917,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
12880
12917
|
let glBaseLayer = null;
|
|
12881
12918
|
let xrFrame = null;
|
|
12882
12919
|
|
|
12920
|
+
const supportsGlBinding = typeof XRWebGLBinding !== 'undefined';
|
|
12921
|
+
|
|
12883
12922
|
const depthSensing = new WebXRDepthSensing();
|
|
12923
|
+
const cameraAccessTextures = {};
|
|
12884
12924
|
const attributes = gl.getContextAttributes();
|
|
12885
12925
|
|
|
12886
12926
|
let initialRenderTarget = null;
|
|
@@ -13061,6 +13101,11 @@ class WebXRManager extends EventDispatcher {
|
|
|
13061
13101
|
_currentDepthFar = null;
|
|
13062
13102
|
|
|
13063
13103
|
depthSensing.reset();
|
|
13104
|
+
for ( const key in cameraAccessTextures ) {
|
|
13105
|
+
|
|
13106
|
+
delete cameraAccessTextures[ key ];
|
|
13107
|
+
|
|
13108
|
+
}
|
|
13064
13109
|
|
|
13065
13110
|
// restore framebuffer/rendering state
|
|
13066
13111
|
|
|
@@ -13151,6 +13196,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
13151
13196
|
/**
|
|
13152
13197
|
* Returns the current base layer.
|
|
13153
13198
|
*
|
|
13199
|
+
* This is an `XRProjectionLayer` when the targeted XR device supports the
|
|
13200
|
+
* WebXR Layers API, or an `XRWebGLLayer` otherwise.
|
|
13201
|
+
*
|
|
13154
13202
|
* @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
|
|
13155
13203
|
*/
|
|
13156
13204
|
this.getBaseLayer = function () {
|
|
@@ -13162,10 +13210,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
13162
13210
|
/**
|
|
13163
13211
|
* Returns the current XR binding.
|
|
13164
13212
|
*
|
|
13165
|
-
*
|
|
13213
|
+
* Creates a new binding if needed and the browser is
|
|
13214
|
+
* capable of doing so.
|
|
13215
|
+
*
|
|
13216
|
+
* @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created.
|
|
13166
13217
|
*/
|
|
13167
13218
|
this.getBinding = function () {
|
|
13168
13219
|
|
|
13220
|
+
if ( glBinding === null && supportsGlBinding ) {
|
|
13221
|
+
|
|
13222
|
+
glBinding = new XRWebGLBinding( session, gl );
|
|
13223
|
+
|
|
13224
|
+
}
|
|
13225
|
+
|
|
13169
13226
|
return glBinding;
|
|
13170
13227
|
|
|
13171
13228
|
};
|
|
@@ -13227,11 +13284,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
13227
13284
|
currentPixelRatio = renderer.getPixelRatio();
|
|
13228
13285
|
renderer.getSize( currentSize );
|
|
13229
13286
|
|
|
13287
|
+
|
|
13230
13288
|
// Check that the browser implements the necessary APIs to use an
|
|
13231
13289
|
// XRProjectionLayer rather than an XRWebGLLayer
|
|
13232
|
-
const
|
|
13290
|
+
const supportsLayers = supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype;
|
|
13233
13291
|
|
|
13234
|
-
if ( !
|
|
13292
|
+
if ( ! supportsLayers ) {
|
|
13235
13293
|
|
|
13236
13294
|
const layerInit = {
|
|
13237
13295
|
antialias: attributes.antialias,
|
|
@@ -13282,7 +13340,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13282
13340
|
scaleFactor: framebufferScaleFactor
|
|
13283
13341
|
};
|
|
13284
13342
|
|
|
13285
|
-
glBinding =
|
|
13343
|
+
glBinding = this.getBinding();
|
|
13286
13344
|
|
|
13287
13345
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
13288
13346
|
|
|
@@ -13343,6 +13401,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
13343
13401
|
/**
|
|
13344
13402
|
* Returns the current depth texture computed via depth sensing.
|
|
13345
13403
|
*
|
|
13404
|
+
* See {@link WebXRDepthSensing#getDepthTexture}.
|
|
13405
|
+
*
|
|
13346
13406
|
* @return {?Texture} The depth texture.
|
|
13347
13407
|
*/
|
|
13348
13408
|
this.getDepthTexture = function () {
|
|
@@ -13513,7 +13573,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13513
13573
|
|
|
13514
13574
|
/**
|
|
13515
13575
|
* Updates the state of the XR camera. Use this method on app level if you
|
|
13516
|
-
* set cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
13576
|
+
* set `cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
13517
13577
|
* camera of the scene as a parameter. The passed in camera's transformation
|
|
13518
13578
|
* is automatically adjusted to the position of the XR camera when calling
|
|
13519
13579
|
* this method.
|
|
@@ -13551,9 +13611,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
13551
13611
|
|
|
13552
13612
|
}
|
|
13553
13613
|
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13614
|
+
// inherit camera layers and enable eye layers (1 = left, 2 = right)
|
|
13615
|
+
cameraXR.layers.mask = camera.layers.mask | 0b110;
|
|
13616
|
+
cameraL.layers.mask = cameraXR.layers.mask & 0b011;
|
|
13617
|
+
cameraR.layers.mask = cameraXR.layers.mask & 0b101;
|
|
13557
13618
|
|
|
13558
13619
|
const parent = camera.parent;
|
|
13559
13620
|
const cameras = cameraXR.cameras;
|
|
@@ -13634,7 +13695,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13634
13695
|
/**
|
|
13635
13696
|
* Returns the amount of foveation used by the XR compositor for the projection layer.
|
|
13636
13697
|
*
|
|
13637
|
-
* @return {number} The amount of foveation.
|
|
13698
|
+
* @return {number|undefined} The amount of foveation.
|
|
13638
13699
|
*/
|
|
13639
13700
|
this.getFoveation = function () {
|
|
13640
13701
|
|
|
@@ -13689,6 +13750,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
13689
13750
|
/**
|
|
13690
13751
|
* Returns the depth sensing mesh.
|
|
13691
13752
|
*
|
|
13753
|
+
* See {@link WebXRDepthSensing#getMesh}.
|
|
13754
|
+
*
|
|
13692
13755
|
* @return {Mesh} The depth sensing mesh.
|
|
13693
13756
|
*/
|
|
13694
13757
|
this.getDepthSensingMesh = function () {
|
|
@@ -13697,6 +13760,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
13697
13760
|
|
|
13698
13761
|
};
|
|
13699
13762
|
|
|
13763
|
+
/**
|
|
13764
|
+
* Retrieves an opaque texture from the view-aligned {@link XRCamera}.
|
|
13765
|
+
* Only available during the current animation loop.
|
|
13766
|
+
*
|
|
13767
|
+
* @param {XRCamera} xrCamera - The camera to query.
|
|
13768
|
+
* @return {?Texture} An opaque texture representing the current raw camera frame.
|
|
13769
|
+
*/
|
|
13770
|
+
this.getCameraTexture = function ( xrCamera ) {
|
|
13771
|
+
|
|
13772
|
+
return cameraAccessTextures[ xrCamera ];
|
|
13773
|
+
|
|
13774
|
+
};
|
|
13775
|
+
|
|
13700
13776
|
// Animation Loop
|
|
13701
13777
|
|
|
13702
13778
|
let onAnimationFrameCallback = null;
|
|
@@ -13796,13 +13872,48 @@ class WebXRManager extends EventDispatcher {
|
|
|
13796
13872
|
enabledFeatures.includes( 'depth-sensing' ) &&
|
|
13797
13873
|
session.depthUsage == 'gpu-optimized';
|
|
13798
13874
|
|
|
13799
|
-
if ( gpuDepthSensingEnabled &&
|
|
13875
|
+
if ( gpuDepthSensingEnabled && supportsGlBinding ) {
|
|
13876
|
+
|
|
13877
|
+
glBinding = scope.getBinding();
|
|
13800
13878
|
|
|
13801
13879
|
const depthData = glBinding.getDepthInformation( views[ 0 ] );
|
|
13802
13880
|
|
|
13803
13881
|
if ( depthData && depthData.isValid && depthData.texture ) {
|
|
13804
13882
|
|
|
13805
|
-
depthSensing.init(
|
|
13883
|
+
depthSensing.init( depthData, session.renderState );
|
|
13884
|
+
|
|
13885
|
+
}
|
|
13886
|
+
|
|
13887
|
+
}
|
|
13888
|
+
|
|
13889
|
+
const cameraAccessEnabled = enabledFeatures &&
|
|
13890
|
+
enabledFeatures.includes( 'camera-access' );
|
|
13891
|
+
|
|
13892
|
+
if ( cameraAccessEnabled && supportsGlBinding ) {
|
|
13893
|
+
|
|
13894
|
+
renderer.state.unbindTexture();
|
|
13895
|
+
|
|
13896
|
+
glBinding = scope.getBinding();
|
|
13897
|
+
|
|
13898
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
13899
|
+
|
|
13900
|
+
const camera = views[ i ].camera;
|
|
13901
|
+
|
|
13902
|
+
if ( camera ) {
|
|
13903
|
+
|
|
13904
|
+
let cameraTex = cameraAccessTextures[ camera ];
|
|
13905
|
+
|
|
13906
|
+
if ( ! cameraTex ) {
|
|
13907
|
+
|
|
13908
|
+
cameraTex = new ExternalTexture();
|
|
13909
|
+
cameraAccessTextures[ camera ] = cameraTex;
|
|
13910
|
+
|
|
13911
|
+
}
|
|
13912
|
+
|
|
13913
|
+
const glTexture = glBinding.getCameraImage( camera );
|
|
13914
|
+
cameraTex.sourceTexture = glTexture;
|
|
13915
|
+
|
|
13916
|
+
}
|
|
13806
13917
|
|
|
13807
13918
|
}
|
|
13808
13919
|
|
|
@@ -13991,17 +14102,17 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
13991
14102
|
|
|
13992
14103
|
}
|
|
13993
14104
|
|
|
13994
|
-
|
|
14105
|
+
if ( material.texture3DMatrix ) {
|
|
13995
14106
|
|
|
13996
|
-
|
|
14107
|
+
uniforms.texture3DMatrix.value.copy( material.texture3DMatrix );
|
|
13997
14108
|
|
|
13998
|
-
|
|
14109
|
+
}
|
|
13999
14110
|
|
|
14000
|
-
|
|
14111
|
+
if ( material.triplanarHardness ) {
|
|
14001
14112
|
|
|
14002
|
-
|
|
14113
|
+
uniforms.triplanarHardness.value = material.triplanarHardness;
|
|
14003
14114
|
|
|
14004
|
-
|
|
14115
|
+
}
|
|
14005
14116
|
|
|
14006
14117
|
if ( material.alphaMap ) {
|
|
14007
14118
|
|
|
@@ -14865,7 +14976,7 @@ class WebGLRenderer {
|
|
|
14865
14976
|
preserveDrawingBuffer = false,
|
|
14866
14977
|
powerPreference = 'default',
|
|
14867
14978
|
failIfMajorPerformanceCaveat = false,
|
|
14868
|
-
|
|
14979
|
+
reversedDepthBuffer = false,
|
|
14869
14980
|
} = parameters;
|
|
14870
14981
|
|
|
14871
14982
|
/**
|
|
@@ -15098,7 +15209,6 @@ class WebGLRenderer {
|
|
|
15098
15209
|
|
|
15099
15210
|
// camera matrices cache
|
|
15100
15211
|
|
|
15101
|
-
const _currentProjectionMatrix = new Matrix4();
|
|
15102
15212
|
const _projScreenMatrix = new Matrix4();
|
|
15103
15213
|
|
|
15104
15214
|
const _vector3 = new Vector3();
|
|
@@ -15194,7 +15304,7 @@ class WebGLRenderer {
|
|
|
15194
15304
|
|
|
15195
15305
|
state = new WebGLState( _gl, extensions );
|
|
15196
15306
|
|
|
15197
|
-
if ( capabilities.
|
|
15307
|
+
if ( capabilities.reversedDepthBuffer && reversedDepthBuffer ) {
|
|
15198
15308
|
|
|
15199
15309
|
state.buffers.depth.setReversed( true );
|
|
15200
15310
|
|
|
@@ -16342,7 +16452,7 @@ class WebGLRenderer {
|
|
|
16342
16452
|
renderStateStack.push( currentRenderState );
|
|
16343
16453
|
|
|
16344
16454
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
16345
|
-
_frustum.setFromProjectionMatrix( _projScreenMatrix );
|
|
16455
|
+
_frustum.setFromProjectionMatrix( _projScreenMatrix, WebGLCoordinateSystem, camera.reversedDepth );
|
|
16346
16456
|
|
|
16347
16457
|
_localClippingEnabled = this.localClippingEnabled;
|
|
16348
16458
|
_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );
|
|
@@ -17173,23 +17283,17 @@ class WebGLRenderer {
|
|
|
17173
17283
|
|
|
17174
17284
|
// common camera uniforms
|
|
17175
17285
|
|
|
17176
|
-
const
|
|
17177
|
-
|
|
17178
|
-
if ( reverseDepthBuffer ) {
|
|
17286
|
+
const reversedDepthBuffer = state.buffers.depth.getReversed();
|
|
17179
17287
|
|
|
17180
|
-
|
|
17288
|
+
if ( reversedDepthBuffer && camera.reversedDepth !== true ) {
|
|
17181
17289
|
|
|
17182
|
-
|
|
17183
|
-
|
|
17184
|
-
|
|
17185
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
17186
|
-
|
|
17187
|
-
} else {
|
|
17188
|
-
|
|
17189
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
17290
|
+
camera._reversedDepth = true;
|
|
17291
|
+
camera.updateProjectionMatrix();
|
|
17190
17292
|
|
|
17191
17293
|
}
|
|
17192
17294
|
|
|
17295
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
17296
|
+
|
|
17193
17297
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
17194
17298
|
|
|
17195
17299
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
@@ -17619,9 +17723,15 @@ class WebGLRenderer {
|
|
|
17619
17723
|
|
|
17620
17724
|
} else if ( isRenderTarget3D ) {
|
|
17621
17725
|
|
|
17622
|
-
const textureProperties = properties.get( renderTarget.texture );
|
|
17623
17726
|
const layer = activeCubeFace;
|
|
17624
|
-
|
|
17727
|
+
|
|
17728
|
+
for ( let i = 0; i < renderTarget.textures.length; i ++ ) {
|
|
17729
|
+
|
|
17730
|
+
const textureProperties = properties.get( renderTarget.textures[ i ] );
|
|
17731
|
+
|
|
17732
|
+
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, textureProperties.__webglTexture, activeMipmapLevel, layer );
|
|
17733
|
+
|
|
17734
|
+
}
|
|
17625
17735
|
|
|
17626
17736
|
} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {
|
|
17627
17737
|
|
|
@@ -17773,7 +17883,7 @@ class WebGLRenderer {
|
|
|
17773
17883
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
17774
17884
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
17775
17885
|
|
|
17776
|
-
// when using MRT, select the
|
|
17886
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
17777
17887
|
|
|
17778
17888
|
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
17779
17889
|
|
|
@@ -18100,15 +18210,6 @@ class WebGLRenderer {
|
|
|
18100
18210
|
|
|
18101
18211
|
};
|
|
18102
18212
|
|
|
18103
|
-
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
18104
|
-
|
|
18105
|
-
// @deprecated, r170
|
|
18106
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
|
|
18107
|
-
|
|
18108
|
-
return this.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
18109
|
-
|
|
18110
|
-
};
|
|
18111
|
-
|
|
18112
18213
|
/**
|
|
18113
18214
|
* Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
|
|
18114
18215
|
* can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
|
|
@@ -18219,4 +18320,4 @@ class WebGLRenderer {
|
|
|
18219
18320
|
|
|
18220
18321
|
}
|
|
18221
18322
|
|
|
18222
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, CylindricalMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, TriPlanarMapping, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement };
|
|
18323
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, CylindricalMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, TriPlanarMapping, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement };
|