@plastic-software/three 0.182.0 → 0.183.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/LICENSE +1 -1
- package/build/three.cjs +11520 -10877
- package/build/three.core.js +11732 -11340
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +509 -262
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +7 -11
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +3072 -2607
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +3071 -2607
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/jsm/Addons.js +0 -3
- package/examples/jsm/animation/CCDIKSolver.js +2 -2
- package/examples/jsm/controls/ArcballControls.js +3 -3
- package/examples/jsm/controls/OrbitControls.js +103 -0
- package/examples/jsm/effects/AnaglyphEffect.js +102 -7
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/RoomEnvironment.js +1 -0
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +131 -4
- package/examples/jsm/exporters/USDZExporter.js +22 -3
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/ViewHelper.js +67 -8
- package/examples/jsm/inspector/Inspector.js +21 -5
- package/examples/jsm/inspector/tabs/Console.js +39 -5
- package/examples/jsm/inspector/tabs/Parameters.js +16 -0
- package/examples/jsm/inspector/ui/Style.js +25 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +6 -5
- package/examples/jsm/lines/LineMaterial.js +6 -0
- package/examples/jsm/loaders/3MFLoader.js +2 -2
- package/examples/jsm/loaders/AMFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +24 -4026
- package/examples/jsm/loaders/EXRLoader.js +5 -5
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/GCodeLoader.js +34 -8
- package/examples/jsm/loaders/GLTFLoader.js +122 -171
- package/examples/jsm/loaders/KMZLoader.js +5 -5
- package/examples/jsm/loaders/KTX2Loader.js +5 -5
- package/examples/jsm/loaders/LWOLoader.js +7 -39
- package/examples/jsm/loaders/NRRDLoader.js +2 -2
- package/examples/jsm/loaders/PCDLoader.js +3 -2
- package/examples/jsm/loaders/USDLoader.js +100 -40
- package/examples/jsm/loaders/UltraHDRLoader.js +182 -30
- package/examples/jsm/loaders/VRMLLoader.js +77 -0
- package/examples/jsm/loaders/VTKLoader.js +37 -24
- package/examples/jsm/loaders/collada/ColladaComposer.js +2950 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1962 -0
- package/examples/jsm/loaders/usd/USDAParser.js +447 -366
- package/examples/jsm/loaders/usd/USDCParser.js +1841 -6
- package/examples/jsm/loaders/usd/USDComposer.js +4041 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +2 -2
- package/examples/jsm/objects/LensflareMesh.js +1 -1
- package/examples/jsm/objects/Sky.js +76 -4
- package/examples/jsm/objects/SkyMesh.js +114 -7
- package/examples/jsm/objects/Water.js +4 -3
- package/examples/jsm/objects/Water2.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +5 -7
- package/examples/jsm/physics/JoltPhysics.js +7 -5
- package/examples/jsm/physics/RapierPhysics.js +6 -4
- package/examples/jsm/postprocessing/EffectComposer.js +7 -5
- package/examples/jsm/postprocessing/RenderTransitionPass.js +1 -1
- package/examples/jsm/renderers/CSS3DRenderer.js +1 -1
- package/examples/jsm/renderers/SVGRenderer.js +2 -2
- package/examples/jsm/shaders/GTAOShader.js +19 -6
- package/examples/jsm/shaders/HalftoneShader.js +12 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +6 -2
- package/examples/jsm/shaders/SAOShader.js +17 -4
- package/examples/jsm/shaders/SSAOShader.js +11 -1
- package/examples/jsm/shaders/SSRShader.js +6 -5
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/tsl/display/AfterImageNode.js +1 -1
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +456 -16
- package/examples/jsm/tsl/display/AnamorphicNode.js +1 -1
- package/examples/jsm/tsl/display/BilateralBlurNode.js +364 -0
- package/examples/jsm/tsl/display/BloomNode.js +5 -5
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +1 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -1
- package/examples/jsm/tsl/display/FXAANode.js +2 -2
- package/examples/jsm/tsl/display/GTAONode.js +2 -2
- package/examples/jsm/tsl/display/GaussianBlurNode.js +11 -2
- package/examples/jsm/tsl/display/GodraysNode.js +624 -0
- package/examples/jsm/tsl/display/LensflareNode.js +1 -1
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -1
- package/examples/jsm/tsl/display/OutlineNode.js +3 -3
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +5 -5
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -2
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +2 -2
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSGINode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +7 -7
- package/examples/jsm/tsl/display/SSSNode.js +2 -2
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +2 -2
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -2
- package/examples/jsm/tsl/display/TRAANode.js +9 -12
- package/examples/jsm/tsl/display/TransitionNode.js +1 -1
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/math/Bayer.js +40 -1
- package/examples/jsm/utils/LDrawUtils.js +1 -1
- package/package.json +11 -19
- package/src/Three.Core.js +1 -1
- package/src/Three.TSL.js +5 -9
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +3 -0
- package/src/Three.js +1 -0
- package/src/animation/AnimationAction.js +1 -1
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/AnimationMixer.js +6 -0
- package/src/animation/KeyframeTrack.js +46 -7
- package/src/animation/PropertyMixer.js +4 -4
- package/src/audio/Audio.js +1 -1
- package/src/audio/AudioListener.js +5 -3
- package/src/cameras/Camera.js +32 -2
- package/src/cameras/CubeCamera.js +20 -0
- package/src/constants.js +30 -1
- package/src/core/Clock.js +7 -0
- package/src/core/Object3D.js +56 -4
- package/src/core/RenderTarget.js +3 -4
- package/src/extras/PMREMGenerator.js +4 -8
- package/src/geometries/TorusGeometry.js +8 -3
- package/src/helpers/CameraHelper.js +3 -0
- package/src/helpers/DirectionalLightHelper.js +4 -1
- package/src/helpers/HemisphereLightHelper.js +3 -0
- package/src/helpers/PointLightHelper.js +0 -24
- package/src/helpers/SpotLightHelper.js +3 -0
- package/src/lights/LightShadow.js +15 -3
- package/src/lights/webgpu/IESSpotLight.js +2 -1
- package/src/loaders/Cache.js +28 -0
- package/src/loaders/FileLoader.js +1 -1
- package/src/loaders/ImageBitmapLoader.js +8 -3
- package/src/loaders/Loader.js +6 -0
- package/src/loaders/ObjectLoader.js +18 -1
- package/src/materials/MeshLambertMaterial.js +9 -0
- package/src/materials/MeshPhongMaterial.js +9 -0
- package/src/materials/nodes/Line2NodeMaterial.js +5 -5
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -0
- package/src/materials/nodes/NodeMaterial.js +15 -24
- package/src/materials/nodes/manager/NodeMaterialObserver.js +9 -3
- package/src/math/Line3.js +3 -5
- package/src/math/MathUtils.js +10 -10
- package/src/math/Matrix4.js +35 -26
- package/src/math/Quaternion.js +3 -29
- package/src/math/Vector3.js +3 -3
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/nodes/Nodes.js +87 -68
- package/src/nodes/TSL.js +2 -5
- package/src/nodes/accessors/Arrays.js +1 -1
- package/src/nodes/accessors/Bitangent.js +5 -5
- package/src/nodes/accessors/BufferAttributeNode.js +1 -1
- package/src/nodes/accessors/Camera.js +149 -28
- package/src/nodes/accessors/InstanceNode.js +105 -40
- package/src/nodes/accessors/Normal.js +9 -9
- package/src/nodes/accessors/Position.js +34 -2
- package/src/nodes/accessors/SceneProperties.js +53 -0
- package/src/nodes/accessors/SkinningNode.js +12 -24
- package/src/nodes/accessors/StorageBufferNode.js +0 -19
- package/src/nodes/accessors/StorageTextureNode.js +37 -1
- package/src/nodes/accessors/Tangent.js +3 -3
- package/src/nodes/accessors/Texture3DNode.js +6 -34
- package/src/nodes/accessors/TextureNode.js +58 -22
- package/src/nodes/accessors/UniformArrayNode.js +2 -0
- package/src/nodes/core/MRTNode.js +48 -2
- package/src/nodes/core/Node.js +29 -3
- package/src/nodes/core/NodeBuilder.js +115 -40
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeUtils.js +5 -3
- package/src/nodes/core/OutputStructNode.js +12 -10
- package/src/nodes/core/ParameterNode.js +2 -1
- package/src/nodes/core/StackNode.js +9 -8
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +15 -0
- package/src/nodes/core/SubBuildNode.js +1 -1
- package/src/nodes/core/UniformNode.js +2 -1
- package/src/nodes/core/VarNode.js +1 -1
- package/src/nodes/core/VaryingNode.js +1 -18
- package/src/nodes/display/BlendModes.js +0 -64
- package/src/nodes/display/ColorAdjustment.js +17 -0
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +21 -2
- package/src/nodes/display/RenderOutputNode.js +3 -3
- package/src/nodes/display/ScreenNode.js +2 -1
- package/src/nodes/display/ToneMappingNode.js +1 -1
- package/src/nodes/display/ToonOutlinePassNode.js +2 -2
- package/src/nodes/display/ViewportDepthNode.js +52 -4
- package/src/nodes/display/ViewportTextureNode.js +21 -4
- package/src/nodes/fog/Fog.js +18 -35
- package/src/nodes/functions/PhysicalLightingModel.js +25 -3
- package/src/nodes/geometry/RangeNode.js +4 -2
- package/src/nodes/gpgpu/ComputeNode.js +5 -4
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
- package/src/nodes/lighting/EnvironmentNode.js +28 -3
- package/src/nodes/lighting/PointShadowNode.js +24 -12
- package/src/nodes/lighting/ShadowFilterNode.js +15 -43
- package/src/nodes/lighting/ShadowNode.js +54 -32
- package/src/nodes/math/ConditionalNode.js +2 -2
- package/src/nodes/math/MathNode.js +3 -40
- package/src/nodes/math/OperatorNode.js +2 -1
- package/src/nodes/pmrem/PMREMUtils.js +9 -15
- package/src/nodes/tsl/TSLCore.js +13 -10
- package/src/nodes/utils/DebugNode.js +11 -11
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +1 -1
- package/src/nodes/utils/MemberNode.js +1 -1
- package/src/nodes/utils/RTTNode.js +1 -1
- package/src/nodes/utils/ReflectorNode.js +2 -3
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/UVUtils.js +4 -2
- package/src/objects/BatchedMesh.js +22 -12
- package/src/objects/InstancedMesh.js +11 -0
- package/src/renderers/WebGLRenderer.js +34 -60
- package/src/renderers/common/Backend.js +21 -0
- package/src/renderers/common/Background.js +7 -4
- package/src/renderers/common/BindGroup.js +1 -9
- package/src/renderers/common/Bindings.js +20 -5
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +50 -6
- package/src/renderers/common/Geometries.js +17 -3
- package/src/renderers/common/Lighting.js +5 -21
- package/src/renderers/common/Pipelines.js +4 -4
- package/src/renderers/common/PostProcessing.js +8 -206
- package/src/renderers/common/RenderBundles.js +2 -1
- package/src/renderers/common/RenderContext.js +16 -0
- package/src/renderers/common/RenderContexts.js +33 -56
- package/src/renderers/common/RenderLists.js +2 -1
- package/src/renderers/common/RenderObject.js +2 -3
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +18 -2
- package/src/renderers/common/RenderPipeline.js +203 -17
- package/src/renderers/common/Renderer.js +207 -40
- package/src/renderers/common/Sampler.js +4 -4
- package/src/renderers/common/StorageBuffer.js +13 -1
- package/src/renderers/common/Textures.js +16 -0
- package/src/renderers/common/TimestampQueryPool.js +5 -3
- package/src/renderers/common/Uniform.js +8 -0
- package/src/renderers/common/UniformsGroup.js +60 -0
- package/src/renderers/common/XRManager.js +2 -2
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/{Nodes.js → NodeManager.js} +18 -6
- package/src/renderers/common/nodes/NodeStorageBuffer.js +13 -2
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +7 -11
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +23 -1
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +55 -24
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib.js +4 -2
- package/src/renderers/shaders/UniformsLib.js +0 -3
- package/src/renderers/webgl/WebGLBackground.js +2 -2
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLGeometries.js +10 -7
- package/src/renderers/webgl/WebGLMaterials.js +12 -0
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +2 -2
- package/src/renderers/webgl/WebGLPrograms.js +10 -4
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLShadowMap.js +5 -4
- package/src/renderers/webgl/WebGLState.js +12 -17
- package/src/renderers/webgl-fallback/WebGLBackend.js +71 -7
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +98 -29
- package/src/renderers/webgl-fallback/utils/WebGLState.js +168 -7
- package/src/renderers/webgpu/WebGPUBackend.js +58 -9
- package/src/renderers/webgpu/WebGPURenderer.js +1 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +257 -45
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +8 -19
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +56 -31
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +152 -200
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +25 -25
- package/src/renderers/webgpu/utils/WebGPUUtils.js +10 -6
- package/src/renderers/webxr/WebXRManager.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/utils.js +246 -3
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -433
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -167
- package/examples/jsm/shaders/GodRaysShader.js +0 -333
- package/src/nodes/accessors/SceneNode.js +0 -145
- package/src/nodes/code/ScriptableNode.js +0 -726
- package/src/nodes/code/ScriptableValueNode.js +0 -253
- package/src/nodes/display/PosterizeNode.js +0 -65
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -90
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -134
|
@@ -47,6 +47,51 @@ class UniformsGroup extends UniformBuffer {
|
|
|
47
47
|
*/
|
|
48
48
|
this.uniforms = [];
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A cache for the uniform update ranges.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
* @type {Map<number, {start: number, count: number}>}
|
|
55
|
+
*/
|
|
56
|
+
this._updateRangeCache = new Map();
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Adds a uniform's update range to this buffer.
|
|
62
|
+
*
|
|
63
|
+
* @param {Uniform} uniform - The uniform.
|
|
64
|
+
*/
|
|
65
|
+
addUniformUpdateRange( uniform ) {
|
|
66
|
+
|
|
67
|
+
const index = uniform.index;
|
|
68
|
+
|
|
69
|
+
if ( this._updateRangeCache.has( index ) !== true ) {
|
|
70
|
+
|
|
71
|
+
const updateRanges = this.updateRanges;
|
|
72
|
+
|
|
73
|
+
const start = uniform.offset;
|
|
74
|
+
const count = uniform.itemSize;
|
|
75
|
+
|
|
76
|
+
const range = { start, count };
|
|
77
|
+
|
|
78
|
+
updateRanges.push( range );
|
|
79
|
+
|
|
80
|
+
this._updateRangeCache.set( index, range );
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Clears all update ranges of this buffer.
|
|
88
|
+
*/
|
|
89
|
+
clearUpdateRanges() {
|
|
90
|
+
|
|
91
|
+
this._updateRangeCache.clear();
|
|
92
|
+
|
|
93
|
+
super.clearUpdateRanges();
|
|
94
|
+
|
|
50
95
|
}
|
|
51
96
|
|
|
52
97
|
/**
|
|
@@ -156,6 +201,7 @@ class UniformsGroup extends UniformBuffer {
|
|
|
156
201
|
}
|
|
157
202
|
|
|
158
203
|
uniform.offset = offset / bytesPerElement;
|
|
204
|
+
uniform.index = i;
|
|
159
205
|
|
|
160
206
|
offset += itemSize;
|
|
161
207
|
|
|
@@ -235,6 +281,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
235
281
|
b[ offset ] = a[ offset ] = v;
|
|
236
282
|
updated = true;
|
|
237
283
|
|
|
284
|
+
this.addUniformUpdateRange( uniform );
|
|
285
|
+
|
|
238
286
|
}
|
|
239
287
|
|
|
240
288
|
return updated;
|
|
@@ -265,6 +313,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
265
313
|
|
|
266
314
|
updated = true;
|
|
267
315
|
|
|
316
|
+
this.addUniformUpdateRange( uniform );
|
|
317
|
+
|
|
268
318
|
}
|
|
269
319
|
|
|
270
320
|
return updated;
|
|
@@ -296,6 +346,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
296
346
|
|
|
297
347
|
updated = true;
|
|
298
348
|
|
|
349
|
+
this.addUniformUpdateRange( uniform );
|
|
350
|
+
|
|
299
351
|
}
|
|
300
352
|
|
|
301
353
|
return updated;
|
|
@@ -328,6 +380,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
328
380
|
|
|
329
381
|
updated = true;
|
|
330
382
|
|
|
383
|
+
this.addUniformUpdateRange( uniform );
|
|
384
|
+
|
|
331
385
|
}
|
|
332
386
|
|
|
333
387
|
return updated;
|
|
@@ -358,6 +412,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
358
412
|
|
|
359
413
|
updated = true;
|
|
360
414
|
|
|
415
|
+
this.addUniformUpdateRange( uniform );
|
|
416
|
+
|
|
361
417
|
}
|
|
362
418
|
|
|
363
419
|
return updated;
|
|
@@ -396,6 +452,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
396
452
|
|
|
397
453
|
updated = true;
|
|
398
454
|
|
|
455
|
+
this.addUniformUpdateRange( uniform );
|
|
456
|
+
|
|
399
457
|
}
|
|
400
458
|
|
|
401
459
|
return updated;
|
|
@@ -423,6 +481,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
423
481
|
setArray( a, e, offset );
|
|
424
482
|
updated = true;
|
|
425
483
|
|
|
484
|
+
this.addUniformUpdateRange( uniform );
|
|
485
|
+
|
|
426
486
|
}
|
|
427
487
|
|
|
428
488
|
return updated;
|
|
@@ -1131,8 +1131,8 @@ class XRManager extends EventDispatcher {
|
|
|
1131
1131
|
|
|
1132
1132
|
// inherit camera layers and enable eye layers (1 = left, 2 = right)
|
|
1133
1133
|
cameraXR.layers.mask = camera.layers.mask | 0b110;
|
|
1134
|
-
cameraL.layers.mask = cameraXR.layers.mask &
|
|
1135
|
-
cameraR.layers.mask = cameraXR.layers.mask &
|
|
1134
|
+
cameraL.layers.mask = cameraXR.layers.mask & ~ 0b100;
|
|
1135
|
+
cameraR.layers.mask = cameraXR.layers.mask & ~ 0b010;
|
|
1136
1136
|
|
|
1137
1137
|
|
|
1138
1138
|
const parent = camera.parent;
|
|
@@ -126,7 +126,7 @@ class NodeBuilderState {
|
|
|
126
126
|
|
|
127
127
|
if ( shared !== true ) {
|
|
128
128
|
|
|
129
|
-
const bindingsGroup = new BindGroup( instanceGroup.name, [], instanceGroup.index
|
|
129
|
+
const bindingsGroup = new BindGroup( instanceGroup.name, [], instanceGroup.index );
|
|
130
130
|
bindings.push( bindingsGroup );
|
|
131
131
|
|
|
132
132
|
for ( const instanceBinding of instanceGroup.bindings ) {
|
|
@@ -3,7 +3,7 @@ import ChainMap from '../ChainMap.js';
|
|
|
3
3
|
import NodeBuilderState from './NodeBuilderState.js';
|
|
4
4
|
import NodeMaterial from '../../../materials/nodes/NodeMaterial.js';
|
|
5
5
|
import { cubeMapNode } from '../../../nodes/utils/CubeMapNode.js';
|
|
6
|
-
import { NodeFrame } from '../../../nodes/Nodes.js';
|
|
6
|
+
import { NodeFrame, StackTrace } from '../../../nodes/Nodes.js';
|
|
7
7
|
import { objectGroup, renderGroup, frameGroup, cubeTexture, texture, texture3D, vec3, fog, rangeFogFactor, densityFogFactor, reference, pmremTexture, screenUV } from '../../../nodes/TSL.js';
|
|
8
8
|
import { builtin } from '../../../nodes/accessors/BuiltinNode.js';
|
|
9
9
|
|
|
@@ -22,7 +22,7 @@ const _cacheKeyValues = [];
|
|
|
22
22
|
* @private
|
|
23
23
|
* @augments DataMap
|
|
24
24
|
*/
|
|
25
|
-
class
|
|
25
|
+
class NodeManager extends DataMap {
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Constructs a new nodes management component.
|
|
@@ -147,7 +147,8 @@ class Nodes extends DataMap {
|
|
|
147
147
|
let groupData = this.groupsData.get( _chainKeys );
|
|
148
148
|
if ( groupData === undefined ) this.groupsData.set( _chainKeys, groupData = {} );
|
|
149
149
|
|
|
150
|
-
_chainKeys
|
|
150
|
+
_chainKeys[ 0 ] = null;
|
|
151
|
+
_chainKeys[ 1 ] = null;
|
|
151
152
|
|
|
152
153
|
if ( groupData.version !== groupNode.version ) {
|
|
153
154
|
|
|
@@ -227,7 +228,17 @@ class Nodes extends DataMap {
|
|
|
227
228
|
nodeBuilder = createNodeBuilder( new NodeMaterial() );
|
|
228
229
|
nodeBuilder.build();
|
|
229
230
|
|
|
230
|
-
|
|
231
|
+
let stackTrace = e.stackTrace;
|
|
232
|
+
|
|
233
|
+
if ( ! stackTrace && e.stack ) {
|
|
234
|
+
|
|
235
|
+
// Capture stack trace for JavaScript errors
|
|
236
|
+
|
|
237
|
+
stackTrace = new StackTrace( e.stack );
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
error( 'TSL: ' + e, stackTrace );
|
|
231
242
|
|
|
232
243
|
}
|
|
233
244
|
|
|
@@ -444,7 +455,8 @@ class Nodes extends DataMap {
|
|
|
444
455
|
|
|
445
456
|
}
|
|
446
457
|
|
|
447
|
-
_chainKeys
|
|
458
|
+
_chainKeys[ 0 ] = null;
|
|
459
|
+
_chainKeys[ 1 ] = null;
|
|
448
460
|
|
|
449
461
|
return cacheKeyData.cacheKey;
|
|
450
462
|
|
|
@@ -837,4 +849,4 @@ class Nodes extends DataMap {
|
|
|
837
849
|
|
|
838
850
|
}
|
|
839
851
|
|
|
840
|
-
export default
|
|
852
|
+
export default NodeManager;
|
|
@@ -45,14 +45,25 @@ class NodeStorageBuffer extends StorageBuffer {
|
|
|
45
45
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The storage buffer attribute node.
|
|
50
|
+
*
|
|
51
|
+
* @type {StorageBufferAttribute}
|
|
52
|
+
*/
|
|
53
|
+
get attribute() {
|
|
54
|
+
|
|
55
|
+
return this.nodeUniform.value;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
48
59
|
/**
|
|
49
60
|
* The storage buffer.
|
|
50
61
|
*
|
|
51
|
-
* @type {
|
|
62
|
+
* @type {Float32Array}
|
|
52
63
|
*/
|
|
53
64
|
get buffer() {
|
|
54
65
|
|
|
55
|
-
return this.nodeUniform.value;
|
|
66
|
+
return this.nodeUniform.value.array;
|
|
56
67
|
|
|
57
68
|
}
|
|
58
69
|
|
|
@@ -35,13 +35,13 @@ export default /* glsl */`
|
|
|
35
35
|
#ifdef USE_BATCHING_COLOR
|
|
36
36
|
|
|
37
37
|
uniform sampler2D batchingColorTexture;
|
|
38
|
-
|
|
38
|
+
vec4 getBatchingColor( const in float i ) {
|
|
39
39
|
|
|
40
40
|
int size = textureSize( batchingColorTexture, 0 ).x;
|
|
41
41
|
int j = int( i );
|
|
42
42
|
int x = j % size;
|
|
43
43
|
int y = j / size;
|
|
44
|
-
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 )
|
|
44
|
+
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
|
|
45
45
|
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
|
-
#if defined( USE_COLOR_ALPHA )
|
|
2
|
+
#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
3
3
|
|
|
4
4
|
varying vec4 vColor;
|
|
5
5
|
|
|
6
|
-
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
7
|
-
|
|
8
|
-
varying vec3 vColor;
|
|
9
|
-
|
|
10
6
|
#endif
|
|
11
7
|
`;
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
|
-
#if defined( USE_COLOR_ALPHA )
|
|
2
|
+
#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
3
3
|
|
|
4
4
|
vColor = vec4( 1.0 );
|
|
5
5
|
|
|
6
|
-
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
7
|
-
|
|
8
|
-
vColor = vec3( 1.0 );
|
|
9
|
-
|
|
10
6
|
#endif
|
|
11
7
|
|
|
12
|
-
#ifdef
|
|
8
|
+
#ifdef USE_COLOR_ALPHA
|
|
13
9
|
|
|
14
10
|
vColor *= color;
|
|
15
11
|
|
|
12
|
+
#elif defined( USE_COLOR )
|
|
13
|
+
|
|
14
|
+
vColor.rgb *= color;
|
|
15
|
+
|
|
16
16
|
#endif
|
|
17
17
|
|
|
18
18
|
#ifdef USE_INSTANCING_COLOR
|
|
19
19
|
|
|
20
|
-
vColor.
|
|
20
|
+
vColor.rgb *= instanceColor.rgb;
|
|
21
21
|
|
|
22
22
|
#endif
|
|
23
23
|
|
|
24
24
|
#ifdef USE_BATCHING_COLOR
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
vColor.xyz *= batchingColor.xyz;
|
|
26
|
+
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
29
27
|
|
|
30
28
|
#endif
|
|
31
29
|
`;
|
|
@@ -38,23 +38,19 @@ export default /* glsl */`
|
|
|
38
38
|
|
|
39
39
|
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
vec4 envColor = vec4( 0.0 );
|
|
41
|
+
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
#elif defined( ENVMAP_BLENDING_MIX )
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
#elif defined( ENVMAP_BLENDING_ADD )
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
53
|
+
#endif
|
|
58
54
|
|
|
59
55
|
#endif
|
|
60
56
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
2
|
#if defined( RE_IndirectDiffuse )
|
|
3
3
|
|
|
4
|
+
#if defined( LAMBERT ) || defined( PHONG )
|
|
5
|
+
|
|
6
|
+
irradiance += iblIrradiance;
|
|
7
|
+
|
|
8
|
+
#endif
|
|
9
|
+
|
|
4
10
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
5
11
|
|
|
6
12
|
#endif
|
|
@@ -10,9 +10,13 @@ export default /* glsl */`
|
|
|
10
10
|
|
|
11
11
|
#endif
|
|
12
12
|
|
|
13
|
-
#if defined( USE_ENVMAP ) && defined(
|
|
13
|
+
#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
|
|
16
|
+
|
|
17
|
+
iblIrradiance += getIBLIrradiance( geometryNormal );
|
|
18
|
+
|
|
19
|
+
#endif
|
|
16
20
|
|
|
17
21
|
#endif
|
|
18
22
|
|
|
@@ -494,12 +494,34 @@ vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const
|
|
|
494
494
|
|
|
495
495
|
// LTC Fresnel Approximation by Stephen Hill
|
|
496
496
|
// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf
|
|
497
|
-
vec3 fresnel = ( material.specularColorBlended * t2.x + (
|
|
497
|
+
vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
|
|
498
498
|
|
|
499
499
|
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
500
500
|
|
|
501
501
|
reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
502
502
|
|
|
503
|
+
#ifdef USE_CLEARCOAT
|
|
504
|
+
|
|
505
|
+
vec3 Ncc = geometryClearcoatNormal;
|
|
506
|
+
|
|
507
|
+
vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
|
|
508
|
+
|
|
509
|
+
vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
|
|
510
|
+
vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
|
|
511
|
+
|
|
512
|
+
mat3 mInvClearcoat = mat3(
|
|
513
|
+
vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
|
|
514
|
+
vec3( 0, 1, 0 ),
|
|
515
|
+
vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
|
|
516
|
+
);
|
|
517
|
+
|
|
518
|
+
// LTC Fresnel Approximation for clearcoat
|
|
519
|
+
vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
|
|
520
|
+
|
|
521
|
+
clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
|
|
522
|
+
|
|
523
|
+
#endif
|
|
524
|
+
|
|
503
525
|
}
|
|
504
526
|
|
|
505
527
|
#endif
|
|
@@ -82,8 +82,16 @@ float viewZToOrthographicDepth( const in float viewZ, const in float near, const
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
|
|
86
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
87
|
+
|
|
88
|
+
return depth * ( far - near ) - far;
|
|
89
|
+
|
|
90
|
+
#else
|
|
91
|
+
|
|
92
|
+
return depth * ( near - far ) - near;
|
|
93
|
+
|
|
94
|
+
#endif
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
// NOTE: https://twitter.com/gonnavis/status/1377183786949959682
|
|
@@ -94,7 +102,15 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
|
|
106
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
107
|
+
|
|
108
|
+
return ( near * far ) / ( ( near - far ) * depth - near );
|
|
109
|
+
|
|
110
|
+
#else
|
|
111
|
+
|
|
112
|
+
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
113
|
+
|
|
114
|
+
#endif
|
|
99
115
|
}
|
|
100
116
|
`;
|
|
@@ -132,7 +132,7 @@ export default /* glsl */`
|
|
|
132
132
|
float radius = shadowRadius * texelSize.x;
|
|
133
133
|
|
|
134
134
|
// Use IGN to rotate sampling pattern per pixel
|
|
135
|
-
float phi = interleavedGradientNoise( gl_FragCoord.xy ) *
|
|
135
|
+
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
|
|
136
136
|
|
|
137
137
|
shadow = (
|
|
138
138
|
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
@@ -155,7 +155,16 @@ export default /* glsl */`
|
|
|
155
155
|
float shadow = 1.0;
|
|
156
156
|
|
|
157
157
|
shadowCoord.xyz /= shadowCoord.w;
|
|
158
|
-
|
|
158
|
+
|
|
159
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
160
|
+
|
|
161
|
+
shadowCoord.z -= shadowBias;
|
|
162
|
+
|
|
163
|
+
#else
|
|
164
|
+
|
|
165
|
+
shadowCoord.z += shadowBias;
|
|
166
|
+
|
|
167
|
+
#endif
|
|
159
168
|
|
|
160
169
|
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
161
170
|
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
@@ -176,7 +185,7 @@ export default /* glsl */`
|
|
|
176
185
|
float hard_shadow = step( shadowCoord.z, mean );
|
|
177
186
|
|
|
178
187
|
#endif
|
|
179
|
-
|
|
188
|
+
|
|
180
189
|
// Early return if fully lit
|
|
181
190
|
if ( hard_shadow == 1.0 ) {
|
|
182
191
|
|
|
@@ -213,7 +222,16 @@ export default /* glsl */`
|
|
|
213
222
|
float shadow = 1.0;
|
|
214
223
|
|
|
215
224
|
shadowCoord.xyz /= shadowCoord.w;
|
|
216
|
-
|
|
225
|
+
|
|
226
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
227
|
+
|
|
228
|
+
shadowCoord.z -= shadowBias;
|
|
229
|
+
|
|
230
|
+
#else
|
|
231
|
+
|
|
232
|
+
shadowCoord.z += shadowBias;
|
|
233
|
+
|
|
234
|
+
#endif
|
|
217
235
|
|
|
218
236
|
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
219
237
|
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
@@ -262,10 +280,19 @@ export default /* glsl */`
|
|
|
262
280
|
|
|
263
281
|
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
|
264
282
|
|
|
265
|
-
//
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
283
|
+
// viewZ to perspective depth
|
|
284
|
+
|
|
285
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
286
|
+
|
|
287
|
+
float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
288
|
+
dp -= shadowBias;
|
|
289
|
+
|
|
290
|
+
#else
|
|
291
|
+
|
|
292
|
+
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
293
|
+
dp += shadowBias;
|
|
294
|
+
|
|
295
|
+
#endif
|
|
269
296
|
|
|
270
297
|
// Hardware PCF with LinearFilter gives us 4-tap filtering per sample
|
|
271
298
|
// Use Vogel disk + IGN sampling for better quality
|
|
@@ -278,14 +305,20 @@ export default /* glsl */`
|
|
|
278
305
|
vec3 bitangent = cross( bd3D, tangent );
|
|
279
306
|
|
|
280
307
|
// Use IGN to rotate sampling pattern per pixel
|
|
281
|
-
float phi = interleavedGradientNoise( gl_FragCoord.xy ) *
|
|
308
|
+
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
|
|
309
|
+
|
|
310
|
+
vec2 sample0 = vogelDiskSample( 0, 5, phi );
|
|
311
|
+
vec2 sample1 = vogelDiskSample( 1, 5, phi );
|
|
312
|
+
vec2 sample2 = vogelDiskSample( 2, 5, phi );
|
|
313
|
+
vec2 sample3 = vogelDiskSample( 3, 5, phi );
|
|
314
|
+
vec2 sample4 = vogelDiskSample( 4, 5, phi );
|
|
282
315
|
|
|
283
316
|
shadow = (
|
|
284
|
-
texture( shadowMap, vec4( bd3D + ( tangent *
|
|
285
|
-
texture( shadowMap, vec4( bd3D + ( tangent *
|
|
286
|
-
texture( shadowMap, vec4( bd3D + ( tangent *
|
|
287
|
-
texture( shadowMap, vec4( bd3D + ( tangent *
|
|
288
|
-
texture( shadowMap, vec4( bd3D + ( tangent *
|
|
317
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
|
|
318
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
|
|
319
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
|
|
320
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
|
|
321
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
|
|
289
322
|
) * 0.2;
|
|
290
323
|
|
|
291
324
|
}
|
|
@@ -304,9 +337,6 @@ export default /* glsl */`
|
|
|
304
337
|
// the vector from the light to the world-space position of the fragment.
|
|
305
338
|
vec3 lightToPosition = shadowCoord.xyz;
|
|
306
339
|
|
|
307
|
-
// Direction from light to fragment
|
|
308
|
-
vec3 bd3D = normalize( lightToPosition );
|
|
309
|
-
|
|
310
340
|
// For cube shadow maps, depth is stored as distance along each face's view axis, not radial distance
|
|
311
341
|
// The view-space depth is the maximum component of the direction vector (which face is sampled)
|
|
312
342
|
vec3 absVec = abs( lightToPosition );
|
|
@@ -314,23 +344,24 @@ export default /* glsl */`
|
|
|
314
344
|
|
|
315
345
|
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
|
316
346
|
|
|
317
|
-
//
|
|
318
|
-
|
|
347
|
+
// viewZ to perspective depth
|
|
348
|
+
|
|
319
349
|
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
320
350
|
dp += shadowBias;
|
|
321
351
|
|
|
352
|
+
// Direction from light to fragment
|
|
353
|
+
vec3 bd3D = normalize( lightToPosition );
|
|
354
|
+
|
|
322
355
|
float depth = textureCube( shadowMap, bd3D ).r;
|
|
323
356
|
|
|
324
357
|
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
325
358
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
#else
|
|
329
|
-
|
|
330
|
-
shadow = step( dp, depth );
|
|
359
|
+
depth = 1.0 - depth;
|
|
331
360
|
|
|
332
361
|
#endif
|
|
333
362
|
|
|
363
|
+
shadow = step( dp, depth );
|
|
364
|
+
|
|
334
365
|
}
|
|
335
366
|
|
|
336
367
|
return mix( 1.0, shadow, shadowIntensity );
|
|
@@ -68,8 +68,10 @@ uniform float opacity;
|
|
|
68
68
|
#include <aomap_pars_fragment>
|
|
69
69
|
#include <lightmap_pars_fragment>
|
|
70
70
|
#include <emissivemap_pars_fragment>
|
|
71
|
+
#include <cube_uv_reflection_fragment>
|
|
71
72
|
#include <envmap_common_pars_fragment>
|
|
72
73
|
#include <envmap_pars_fragment>
|
|
74
|
+
#include <envmap_physical_pars_fragment>
|
|
73
75
|
#include <fog_pars_fragment>
|
|
74
76
|
#include <bsdfs>
|
|
75
77
|
#include <lights_pars_begin>
|
|
@@ -70,8 +70,10 @@ uniform float opacity;
|
|
|
70
70
|
#include <aomap_pars_fragment>
|
|
71
71
|
#include <lightmap_pars_fragment>
|
|
72
72
|
#include <emissivemap_pars_fragment>
|
|
73
|
+
#include <cube_uv_reflection_fragment>
|
|
73
74
|
#include <envmap_common_pars_fragment>
|
|
74
75
|
#include <envmap_pars_fragment>
|
|
76
|
+
#include <envmap_physical_pars_fragment>
|
|
75
77
|
#include <fog_pars_fragment>
|
|
76
78
|
#include <bsdfs>
|
|
77
79
|
#include <lights_pars_begin>
|
|
@@ -39,7 +39,8 @@ const ShaderLib = {
|
|
|
39
39
|
UniformsLib.fog,
|
|
40
40
|
UniformsLib.lights,
|
|
41
41
|
{
|
|
42
|
-
emissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }
|
|
42
|
+
emissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },
|
|
43
|
+
envMapIntensity: { value: 1 }
|
|
43
44
|
}
|
|
44
45
|
] ),
|
|
45
46
|
|
|
@@ -65,7 +66,8 @@ const ShaderLib = {
|
|
|
65
66
|
{
|
|
66
67
|
emissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },
|
|
67
68
|
specular: { value: /*@__PURE__*/ new Color( 0x111111 ) },
|
|
68
|
-
shininess: { value: 30 }
|
|
69
|
+
shininess: { value: 30 },
|
|
70
|
+
envMapIntensity: { value: 1 }
|
|
69
71
|
}
|
|
70
72
|
] ),
|
|
71
73
|
|