@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
package/src/core/Object3D.js
CHANGED
|
@@ -242,7 +242,8 @@ class Object3D extends EventDispatcher {
|
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
244
|
* When set to `true`, the engine automatically computes the local matrix from position,
|
|
245
|
-
* rotation and scale every frame.
|
|
245
|
+
* rotation and scale every frame. If set to `false`, the app is responsible for recomputing
|
|
246
|
+
* the local matrix by calling `updateMatrix()`.
|
|
246
247
|
*
|
|
247
248
|
* The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_AUTO_UPDATE`.
|
|
248
249
|
*
|
|
@@ -253,7 +254,8 @@ class Object3D extends EventDispatcher {
|
|
|
253
254
|
|
|
254
255
|
/**
|
|
255
256
|
* When set to `true`, the engine automatically computes the world matrix from the current local
|
|
256
|
-
* matrix and the object's transformation hierarchy.
|
|
257
|
+
* matrix and the object's transformation hierarchy. If set to `false`, the app is responsible for
|
|
258
|
+
* recomputing the world matrix by directly updating the `matrixWorld` property.
|
|
257
259
|
*
|
|
258
260
|
* The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE`.
|
|
259
261
|
*
|
|
@@ -354,6 +356,19 @@ class Object3D extends EventDispatcher {
|
|
|
354
356
|
*/
|
|
355
357
|
this.customDistanceMaterial = undefined;
|
|
356
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Whether the 3D object is supposed to be static or not. If set to `true`, it means
|
|
361
|
+
* the 3D object is not going to be changed after the initial renderer. This includes
|
|
362
|
+
* geometry and material settings. A static 3D object can be processed by the renderer
|
|
363
|
+
* slightly faster since certain state checks can be bypassed.
|
|
364
|
+
*
|
|
365
|
+
* Only relevant in context of {@link WebGPURenderer}.
|
|
366
|
+
*
|
|
367
|
+
* @type {boolean}
|
|
368
|
+
* @default false
|
|
369
|
+
*/
|
|
370
|
+
this.static = false;
|
|
371
|
+
|
|
357
372
|
/**
|
|
358
373
|
* An object that can be used to store custom data about the 3D object. It
|
|
359
374
|
* should not hold references to functions as these will not be cloned.
|
|
@@ -362,6 +377,16 @@ class Object3D extends EventDispatcher {
|
|
|
362
377
|
*/
|
|
363
378
|
this.userData = {};
|
|
364
379
|
|
|
380
|
+
/**
|
|
381
|
+
* The pivot point for rotation and scale transformations.
|
|
382
|
+
* When set, rotation and scale are applied around this point
|
|
383
|
+
* instead of the object's origin.
|
|
384
|
+
*
|
|
385
|
+
* @type {?Vector3}
|
|
386
|
+
* @default null
|
|
387
|
+
*/
|
|
388
|
+
this.pivot = null;
|
|
389
|
+
|
|
365
390
|
}
|
|
366
391
|
|
|
367
392
|
/**
|
|
@@ -644,7 +669,7 @@ class Object3D extends EventDispatcher {
|
|
|
644
669
|
}
|
|
645
670
|
|
|
646
671
|
/**
|
|
647
|
-
* Converts the given vector from this 3D object's
|
|
672
|
+
* Converts the given vector from this 3D object's world space to local space.
|
|
648
673
|
*
|
|
649
674
|
* @param {Vector3} vector - The vector to convert.
|
|
650
675
|
* @return {Vector3} The converted vector.
|
|
@@ -1109,6 +1134,19 @@ class Object3D extends EventDispatcher {
|
|
|
1109
1134
|
|
|
1110
1135
|
this.matrix.compose( this.position, this.quaternion, this.scale );
|
|
1111
1136
|
|
|
1137
|
+
const pivot = this.pivot;
|
|
1138
|
+
|
|
1139
|
+
if ( pivot !== null ) {
|
|
1140
|
+
|
|
1141
|
+
const px = pivot.x, py = pivot.y, pz = pivot.z;
|
|
1142
|
+
const te = this.matrix.elements;
|
|
1143
|
+
|
|
1144
|
+
te[ 12 ] += px - te[ 0 ] * px - te[ 4 ] * py - te[ 8 ] * pz;
|
|
1145
|
+
te[ 13 ] += py - te[ 1 ] * px - te[ 5 ] * py - te[ 9 ] * pz;
|
|
1146
|
+
te[ 14 ] += pz - te[ 2 ] * px - te[ 6 ] * py - te[ 10 ] * pz;
|
|
1147
|
+
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1112
1150
|
this.matrixWorldNeedsUpdate = true;
|
|
1113
1151
|
|
|
1114
1152
|
}
|
|
@@ -1122,7 +1160,7 @@ class Object3D extends EventDispatcher {
|
|
|
1122
1160
|
* `true` by default. Set these flags to `false` if you need more control over the update matrix process.
|
|
1123
1161
|
*
|
|
1124
1162
|
* @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even
|
|
1125
|
-
* when {@link Object3D#
|
|
1163
|
+
* when {@link Object3D#matrixWorldNeedsUpdate} is `false`.
|
|
1126
1164
|
*/
|
|
1127
1165
|
updateMatrixWorld( force ) {
|
|
1128
1166
|
|
|
@@ -1267,14 +1305,20 @@ class Object3D extends EventDispatcher {
|
|
|
1267
1305
|
if ( this.visible === false ) object.visible = false;
|
|
1268
1306
|
if ( this.frustumCulled === false ) object.frustumCulled = false;
|
|
1269
1307
|
if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
|
|
1308
|
+
if ( this.static !== false ) object.static = this.static;
|
|
1270
1309
|
if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;
|
|
1271
1310
|
|
|
1272
1311
|
object.layers = this.layers.mask;
|
|
1273
1312
|
object.matrix = this.matrix.toArray();
|
|
1274
1313
|
object.up = this.up.toArray();
|
|
1275
1314
|
|
|
1315
|
+
if ( this.pivot !== null ) object.pivot = this.pivot.toArray();
|
|
1316
|
+
|
|
1276
1317
|
if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
|
|
1277
1318
|
|
|
1319
|
+
if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
|
|
1320
|
+
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();
|
|
1321
|
+
|
|
1278
1322
|
// object specific properties
|
|
1279
1323
|
|
|
1280
1324
|
if ( this.isInstancedMesh ) {
|
|
@@ -1548,6 +1592,12 @@ class Object3D extends EventDispatcher {
|
|
|
1548
1592
|
this.quaternion.copy( source.quaternion );
|
|
1549
1593
|
this.scale.copy( source.scale );
|
|
1550
1594
|
|
|
1595
|
+
if ( source.pivot !== null ) {
|
|
1596
|
+
|
|
1597
|
+
this.pivot = source.pivot.clone();
|
|
1598
|
+
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1551
1601
|
this.matrix.copy( source.matrix );
|
|
1552
1602
|
this.matrixWorld.copy( source.matrixWorld );
|
|
1553
1603
|
|
|
@@ -1565,6 +1615,8 @@ class Object3D extends EventDispatcher {
|
|
|
1565
1615
|
this.frustumCulled = source.frustumCulled;
|
|
1566
1616
|
this.renderOrder = source.renderOrder;
|
|
1567
1617
|
|
|
1618
|
+
this.static = source.static;
|
|
1619
|
+
|
|
1568
1620
|
this.animations = source.animations.slice();
|
|
1569
1621
|
|
|
1570
1622
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
package/src/core/RenderTarget.js
CHANGED
|
@@ -124,10 +124,6 @@ class RenderTarget extends EventDispatcher {
|
|
|
124
124
|
*/
|
|
125
125
|
this.viewport = new Vector4( 0, 0, width, height );
|
|
126
126
|
|
|
127
|
-
const image = { width: width, height: height, depth: options.depth };
|
|
128
|
-
|
|
129
|
-
const texture = new Texture( image );
|
|
130
|
-
|
|
131
127
|
/**
|
|
132
128
|
* An array of textures. Each color attachment is represented as a separate texture.
|
|
133
129
|
* Has at least a single entry for the default color attachment.
|
|
@@ -136,6 +132,9 @@ class RenderTarget extends EventDispatcher {
|
|
|
136
132
|
*/
|
|
137
133
|
this.textures = [];
|
|
138
134
|
|
|
135
|
+
const image = { width: width, height: height, depth: options.depth };
|
|
136
|
+
const texture = new Texture( image );
|
|
137
|
+
|
|
139
138
|
const count = options.count;
|
|
140
139
|
for ( let i = 0; i < count; i ++ ) {
|
|
141
140
|
|
|
@@ -845,24 +845,20 @@ function _getGGXShader( lodMax, width, height ) {
|
|
|
845
845
|
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
846
846
|
float alpha = roughness * roughness;
|
|
847
847
|
|
|
848
|
-
// Section 3.2: Transform view direction to hemisphere configuration
|
|
849
|
-
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
850
|
-
|
|
851
848
|
// Section 4.1: Orthonormal basis
|
|
852
|
-
|
|
853
|
-
vec3
|
|
854
|
-
vec3 T2 = cross(Vh, T1);
|
|
849
|
+
vec3 T1 = vec3(1.0, 0.0, 0.0);
|
|
850
|
+
vec3 T2 = cross(V, T1);
|
|
855
851
|
|
|
856
852
|
// Section 4.2: Parameterization of projected area
|
|
857
853
|
float r = sqrt(Xi.x);
|
|
858
854
|
float phi = 2.0 * PI * Xi.y;
|
|
859
855
|
float t1 = r * cos(phi);
|
|
860
856
|
float t2 = r * sin(phi);
|
|
861
|
-
float s = 0.5 * (1.0 +
|
|
857
|
+
float s = 0.5 * (1.0 + V.z);
|
|
862
858
|
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
863
859
|
|
|
864
860
|
// Section 4.3: Reprojection onto hemisphere
|
|
865
|
-
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) *
|
|
861
|
+
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
|
|
866
862
|
|
|
867
863
|
// Section 3.4: Transform back to ellipsoid configuration
|
|
868
864
|
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
@@ -25,8 +25,10 @@ class TorusGeometry extends BufferGeometry {
|
|
|
25
25
|
* @param {number} [radialSegments=12] - The number of radial segments.
|
|
26
26
|
* @param {number} [tubularSegments=48] - The number of tubular segments.
|
|
27
27
|
* @param {number} [arc=Math.PI*2] - Central angle in radians.
|
|
28
|
+
* @param {number} [thetaStart=0] - Start of the tubular sweep in radians.
|
|
29
|
+
* @param {number} [thetaLength=Math.PI*2] - Length of the tubular sweep in radians.
|
|
28
30
|
*/
|
|
29
|
-
constructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {
|
|
31
|
+
constructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI * 2 ) {
|
|
30
32
|
|
|
31
33
|
super();
|
|
32
34
|
|
|
@@ -44,7 +46,9 @@ class TorusGeometry extends BufferGeometry {
|
|
|
44
46
|
tube: tube,
|
|
45
47
|
radialSegments: radialSegments,
|
|
46
48
|
tubularSegments: tubularSegments,
|
|
47
|
-
arc: arc
|
|
49
|
+
arc: arc,
|
|
50
|
+
thetaStart: thetaStart,
|
|
51
|
+
thetaLength: thetaLength,
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
radialSegments = Math.floor( radialSegments );
|
|
@@ -67,10 +71,11 @@ class TorusGeometry extends BufferGeometry {
|
|
|
67
71
|
|
|
68
72
|
for ( let j = 0; j <= radialSegments; j ++ ) {
|
|
69
73
|
|
|
74
|
+
const v = thetaStart + ( j / radialSegments ) * thetaLength;
|
|
75
|
+
|
|
70
76
|
for ( let i = 0; i <= tubularSegments; i ++ ) {
|
|
71
77
|
|
|
72
78
|
const u = i / tubularSegments * arc;
|
|
73
|
-
const v = j / radialSegments * Math.PI * 2;
|
|
74
79
|
|
|
75
80
|
// vertex
|
|
76
81
|
|
|
@@ -18,6 +18,9 @@ const _camera = /*@__PURE__*/ new Camera();
|
|
|
18
18
|
*
|
|
19
19
|
* `CameraHelper` must be a child of the scene.
|
|
20
20
|
*
|
|
21
|
+
* When the camera is transformed or its projection matrix is changed, it's necessary
|
|
22
|
+
* to call the `update()` method of the respective helper.
|
|
23
|
+
*
|
|
21
24
|
* ```js
|
|
22
25
|
* const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
|
|
23
26
|
* const helper = new THREE.CameraHelper( camera );
|
|
@@ -11,9 +11,12 @@ const _v3 = /*@__PURE__*/ new Vector3();
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Helper object to assist with visualizing a {@link DirectionalLight}'s
|
|
14
|
-
* effect on the scene. This consists of plane and a line representing the
|
|
14
|
+
* effect on the scene. This consists of a plane and a line representing the
|
|
15
15
|
* light's position and direction.
|
|
16
16
|
*
|
|
17
|
+
* When the directional light or its target are transformed or light properties
|
|
18
|
+
* are changed, it's necessary to call the `update()` method of the respective helper.
|
|
19
|
+
*
|
|
17
20
|
* ```js
|
|
18
21
|
* const light = new THREE.DirectionalLight( 0xFFFFFF );
|
|
19
22
|
* scene.add( light );
|
|
@@ -14,6 +14,9 @@ const _color2 = /*@__PURE__*/ new Color();
|
|
|
14
14
|
* Creates a visual aid consisting of a spherical mesh for a
|
|
15
15
|
* given {@link HemisphereLight}.
|
|
16
16
|
*
|
|
17
|
+
* When the hemisphere light is transformed or its light properties are changed,
|
|
18
|
+
* it's necessary to call the `update()` method of the respective helper.
|
|
19
|
+
*
|
|
17
20
|
* ```js
|
|
18
21
|
* const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
|
|
19
22
|
* const helper = new THREE.HemisphereLightHelper( light, 5 );
|
|
@@ -57,30 +57,6 @@ class PointLightHelper extends Mesh {
|
|
|
57
57
|
|
|
58
58
|
this.update();
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
// TODO: delete this comment?
|
|
63
|
-
const distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
|
|
64
|
-
const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
|
|
65
|
-
|
|
66
|
-
this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
|
|
67
|
-
this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
|
|
68
|
-
|
|
69
|
-
const d = light.distance;
|
|
70
|
-
|
|
71
|
-
if ( d === 0.0 ) {
|
|
72
|
-
|
|
73
|
-
this.lightDistance.visible = false;
|
|
74
|
-
|
|
75
|
-
} else {
|
|
76
|
-
|
|
77
|
-
this.lightDistance.scale.set( d, d, d );
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
this.add( this.lightDistance );
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
60
|
}
|
|
85
61
|
|
|
86
62
|
/**
|
|
@@ -10,6 +10,9 @@ const _vector = /*@__PURE__*/ new Vector3();
|
|
|
10
10
|
/**
|
|
11
11
|
* This displays a cone shaped helper object for a {@link SpotLight}.
|
|
12
12
|
*
|
|
13
|
+
* When the spot light or its target are transformed or light properties are
|
|
14
|
+
* changed, it's necessary to call the `update()` method of the respective helper.
|
|
15
|
+
*
|
|
13
16
|
* ```js
|
|
14
17
|
* const spotLight = new THREE.SpotLight( 0xffffff );
|
|
15
18
|
* spotLight.position.set( 10, 10, 10 );
|
|
@@ -3,7 +3,7 @@ import { Vector2 } from '../math/Vector2.js';
|
|
|
3
3
|
import { Vector3 } from '../math/Vector3.js';
|
|
4
4
|
import { Vector4 } from '../math/Vector4.js';
|
|
5
5
|
import { Frustum } from '../math/Frustum.js';
|
|
6
|
-
import { UnsignedByteType } from '../constants.js';
|
|
6
|
+
import { UnsignedByteType, WebGPUCoordinateSystem } from '../constants.js';
|
|
7
7
|
|
|
8
8
|
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
9
9
|
const _lightPositionWorld = /*@__PURE__*/ new Vector3();
|
|
@@ -52,6 +52,16 @@ class LightShadow {
|
|
|
52
52
|
*/
|
|
53
53
|
this.bias = 0;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* A node version of `bias`. Only supported with `WebGPURenderer`.
|
|
57
|
+
*
|
|
58
|
+
* If a bias node is defined, `bias` has no effect.
|
|
59
|
+
*
|
|
60
|
+
* @type {?Node<float>}
|
|
61
|
+
* @default null
|
|
62
|
+
*/
|
|
63
|
+
this.biasNode = null;
|
|
64
|
+
|
|
55
65
|
/**
|
|
56
66
|
* Defines how much the position used to query the shadow map is offset along
|
|
57
67
|
* the object normal. The default is `0`. Increasing this value can be used to
|
|
@@ -203,12 +213,12 @@ class LightShadow {
|
|
|
203
213
|
_projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
|
|
204
214
|
this._frustum.setFromProjectionMatrix( _projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth );
|
|
205
215
|
|
|
206
|
-
if ( shadowCamera.reversedDepth ) {
|
|
216
|
+
if ( shadowCamera.coordinateSystem === WebGPUCoordinateSystem || shadowCamera.reversedDepth ) {
|
|
207
217
|
|
|
208
218
|
shadowMatrix.set(
|
|
209
219
|
0.5, 0.0, 0.0, 0.5,
|
|
210
220
|
0.0, 0.5, 0.0, 0.5,
|
|
211
|
-
0.0, 0.0, 1.0, 0.0,
|
|
221
|
+
0.0, 0.0, 1.0, 0.0, // Identity Z (preserving the correct [0, 1] range from the projection matrix)
|
|
212
222
|
0.0, 0.0, 0.0, 1.0
|
|
213
223
|
);
|
|
214
224
|
|
|
@@ -292,6 +302,8 @@ class LightShadow {
|
|
|
292
302
|
|
|
293
303
|
this.mapSize.copy( source.mapSize );
|
|
294
304
|
|
|
305
|
+
this.biasNode = source.biasNode;
|
|
306
|
+
|
|
295
307
|
return this;
|
|
296
308
|
|
|
297
309
|
}
|
|
@@ -22,7 +22,8 @@ class IESSpotLight extends SpotLight {
|
|
|
22
22
|
super( color, intensity, distance, angle, penumbra, decay );
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* The IES map. It's a lookup table that stores normalized attenuation factors
|
|
26
|
+
* (0.0 to 1.0) that represent the light's intensity at a specific angle.
|
|
26
27
|
*
|
|
27
28
|
* @type {?Texture}
|
|
28
29
|
* @default null
|
package/src/loaders/Cache.js
CHANGED
|
@@ -35,6 +35,8 @@ const Cache = {
|
|
|
35
35
|
|
|
36
36
|
if ( this.enabled === false ) return;
|
|
37
37
|
|
|
38
|
+
if ( isBlobURL( key ) ) return;
|
|
39
|
+
|
|
38
40
|
// log( 'Cache', 'Adding key:', key );
|
|
39
41
|
|
|
40
42
|
this.files[ key ] = file;
|
|
@@ -52,6 +54,8 @@ const Cache = {
|
|
|
52
54
|
|
|
53
55
|
if ( this.enabled === false ) return;
|
|
54
56
|
|
|
57
|
+
if ( isBlobURL( key ) ) return;
|
|
58
|
+
|
|
55
59
|
// log( 'Cache', 'Checking key:', key );
|
|
56
60
|
|
|
57
61
|
return this.files[ key ];
|
|
@@ -83,5 +87,29 @@ const Cache = {
|
|
|
83
87
|
|
|
84
88
|
};
|
|
85
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Returns true if the given cache key contains the blob: scheme.
|
|
92
|
+
*
|
|
93
|
+
* @private
|
|
94
|
+
* @param {string} key - The cache key.
|
|
95
|
+
* @return {boolean} Whether the given cache key contains the blob: scheme or not.
|
|
96
|
+
*/
|
|
97
|
+
function isBlobURL( key ) {
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
|
|
101
|
+
const urlString = key.slice( key.indexOf( ':' ) + 1 ); // remove type identifier
|
|
102
|
+
|
|
103
|
+
const url = new URL( urlString );
|
|
104
|
+
return url.protocol === 'blob:';
|
|
105
|
+
|
|
106
|
+
} catch ( e ) {
|
|
107
|
+
|
|
108
|
+
// If the string is not a valid URL, it throws an error
|
|
109
|
+
return false;
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
86
114
|
|
|
87
115
|
export { Cache };
|
|
@@ -43,7 +43,7 @@ class FileLoader extends Loader {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* The expected mime type. Valid values can be found
|
|
46
|
-
* [here](
|
|
46
|
+
* [here](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)
|
|
47
47
|
*
|
|
48
48
|
* @type {string}
|
|
49
49
|
*/
|
|
@@ -10,11 +10,16 @@ const _errorMap = new WeakMap();
|
|
|
10
10
|
* textures for rendering.
|
|
11
11
|
*
|
|
12
12
|
* Note that {@link Texture#flipY} and {@link Texture#premultiplyAlpha} are ignored with image bitmaps.
|
|
13
|
-
*
|
|
13
|
+
* These options need to be configured via {@link ImageBitmapLoader#setOptions} prior to loading,
|
|
14
|
+
* unlike regular images which can be configured on the Texture to set these options on GPU upload instead.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
+
* To match the default behaviour of {@link Texture}, the following options are needed:
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
+
* ```js
|
|
19
|
+
* { imageOrientation: 'flipY', premultiplyAlpha: 'none' }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Also note that unlike {@link FileLoader}, this loader will only avoid multiple concurrent requests to the same URL if {@link Cache} is enabled.
|
|
18
23
|
*
|
|
19
24
|
* ```js
|
|
20
25
|
* const loader = new THREE.ImageBitmapLoader();
|
package/src/loaders/Loader.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from '../constants.js';
|
|
22
22
|
import { InstancedBufferAttribute } from '../core/InstancedBufferAttribute.js';
|
|
23
23
|
import { Color } from '../math/Color.js';
|
|
24
|
+
import { Vector3 } from '../math/Vector3.js';
|
|
24
25
|
import { Object3D } from '../core/Object3D.js';
|
|
25
26
|
import { Group } from '../objects/Group.js';
|
|
26
27
|
import { InstancedMesh } from '../objects/InstancedMesh.js';
|
|
@@ -171,7 +172,17 @@ class ObjectLoader extends Loader {
|
|
|
171
172
|
|
|
172
173
|
const text = await loader.loadAsync( url, onProgress );
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
let json;
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
|
|
179
|
+
json = JSON.parse( text );
|
|
180
|
+
|
|
181
|
+
} catch ( e ) {
|
|
182
|
+
|
|
183
|
+
throw new Error( 'ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
|
|
184
|
+
|
|
185
|
+
}
|
|
175
186
|
|
|
176
187
|
const metadata = json.metadata;
|
|
177
188
|
|
|
@@ -1116,6 +1127,11 @@ class ObjectLoader extends Loader {
|
|
|
1116
1127
|
|
|
1117
1128
|
if ( data.up !== undefined ) object.up.fromArray( data.up );
|
|
1118
1129
|
|
|
1130
|
+
if ( data.pivot !== undefined ) object.pivot = new Vector3().fromArray( data.pivot );
|
|
1131
|
+
|
|
1132
|
+
if ( data.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, data.morphTargetDictionary );
|
|
1133
|
+
if ( data.morphTargetInfluences !== undefined ) object.morphTargetInfluences = data.morphTargetInfluences.slice();
|
|
1134
|
+
|
|
1119
1135
|
if ( data.castShadow !== undefined ) object.castShadow = data.castShadow;
|
|
1120
1136
|
if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;
|
|
1121
1137
|
|
|
@@ -1133,6 +1149,7 @@ class ObjectLoader extends Loader {
|
|
|
1133
1149
|
if ( data.visible !== undefined ) object.visible = data.visible;
|
|
1134
1150
|
if ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;
|
|
1135
1151
|
if ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;
|
|
1152
|
+
if ( data.static !== undefined ) object.static = data.static;
|
|
1136
1153
|
if ( data.userData !== undefined ) object.userData = data.userData;
|
|
1137
1154
|
if ( data.layers !== undefined ) object.layers.mask = data.layers;
|
|
1138
1155
|
|
|
@@ -267,6 +267,14 @@ class MeshLambertMaterial extends Material {
|
|
|
267
267
|
*/
|
|
268
268
|
this.reflectivity = 1;
|
|
269
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Scales the effect of the environment map by multiplying its color.
|
|
272
|
+
*
|
|
273
|
+
* @type {number}
|
|
274
|
+
* @default 1
|
|
275
|
+
*/
|
|
276
|
+
this.envMapIntensity = 1.0;
|
|
277
|
+
|
|
270
278
|
/**
|
|
271
279
|
* The index of refraction (IOR) of air (approximately 1) divided by the
|
|
272
280
|
* index of refraction of the material. It is used with environment mapping
|
|
@@ -373,6 +381,7 @@ class MeshLambertMaterial extends Material {
|
|
|
373
381
|
this.envMapRotation.copy( source.envMapRotation );
|
|
374
382
|
this.combine = source.combine;
|
|
375
383
|
this.reflectivity = source.reflectivity;
|
|
384
|
+
this.envMapIntensity = source.envMapIntensity;
|
|
376
385
|
this.refractionRatio = source.refractionRatio;
|
|
377
386
|
|
|
378
387
|
this.wireframe = source.wireframe;
|
|
@@ -284,6 +284,14 @@ class MeshPhongMaterial extends Material {
|
|
|
284
284
|
*/
|
|
285
285
|
this.reflectivity = 1;
|
|
286
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Scales the effect of the environment map by multiplying its color.
|
|
289
|
+
*
|
|
290
|
+
* @type {number}
|
|
291
|
+
* @default 1
|
|
292
|
+
*/
|
|
293
|
+
this.envMapIntensity = 1.0;
|
|
294
|
+
|
|
287
295
|
/**
|
|
288
296
|
* The index of refraction (IOR) of air (approximately 1) divided by the
|
|
289
297
|
* index of refraction of the material. It is used with environment mapping
|
|
@@ -392,6 +400,7 @@ class MeshPhongMaterial extends Material {
|
|
|
392
400
|
this.envMapRotation.copy( source.envMapRotation );
|
|
393
401
|
this.combine = source.combine;
|
|
394
402
|
this.reflectivity = source.reflectivity;
|
|
403
|
+
this.envMapIntensity = source.envMapIntensity;
|
|
395
404
|
this.refractionRatio = source.refractionRatio;
|
|
396
405
|
|
|
397
406
|
this.wireframe = source.wireframe;
|
|
@@ -9,7 +9,7 @@ import { mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
|
9
9
|
import { Fn, float, vec2, vec3, vec4, If } from '../../nodes/tsl/TSLBase.js';
|
|
10
10
|
import { uv } from '../../nodes/accessors/UV.js';
|
|
11
11
|
import { screenDPR, viewport } from '../../nodes/display/ScreenNode.js';
|
|
12
|
-
import {
|
|
12
|
+
import { viewportOpaqueMipTexture } from '../../nodes/display/ViewportTextureNode.js';
|
|
13
13
|
|
|
14
14
|
import { LineDashedMaterial } from '../LineDashedMaterial.js';
|
|
15
15
|
import { NoBlending } from '../../constants.js';
|
|
@@ -56,7 +56,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
56
56
|
* @type {boolean}
|
|
57
57
|
* @default false
|
|
58
58
|
*/
|
|
59
|
-
this.
|
|
59
|
+
this.vertexColors = parameters.vertexColors;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* The dash offset.
|
|
@@ -133,7 +133,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
133
133
|
const { renderer } = builder;
|
|
134
134
|
|
|
135
135
|
const useAlphaToCoverage = this._useAlphaToCoverage;
|
|
136
|
-
const
|
|
136
|
+
const vertexColors = this.vertexColors;
|
|
137
137
|
const useDash = this._useDash;
|
|
138
138
|
const useWorldUnits = this._useWorldUnits;
|
|
139
139
|
|
|
@@ -434,7 +434,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
434
434
|
|
|
435
435
|
} else {
|
|
436
436
|
|
|
437
|
-
if (
|
|
437
|
+
if ( vertexColors ) {
|
|
438
438
|
|
|
439
439
|
const instanceColorStart = attribute( 'instanceColorStart' );
|
|
440
440
|
const instanceColorEnd = attribute( 'instanceColorEnd' );
|
|
@@ -459,7 +459,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
459
459
|
|
|
460
460
|
const opacityNode = this.opacityNode ? float( this.opacityNode ) : materialOpacity;
|
|
461
461
|
|
|
462
|
-
this.outputNode = vec4( this.colorNode.rgb.mul( opacityNode ).add(
|
|
462
|
+
this.outputNode = vec4( this.colorNode.rgb.mul( opacityNode ).add( viewportOpaqueMipTexture().rgb.mul( opacityNode.oneMinus() ) ), this.colorNode.a );
|
|
463
463
|
|
|
464
464
|
}
|
|
465
465
|
|
|
@@ -502,6 +502,8 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
502
502
|
this.specularIntensityNode = source.specularIntensityNode;
|
|
503
503
|
this.specularColorNode = source.specularColorNode;
|
|
504
504
|
|
|
505
|
+
this.iorNode = source.iorNode;
|
|
506
|
+
|
|
505
507
|
this.transmissionNode = source.transmissionNode;
|
|
506
508
|
this.thicknessNode = source.thicknessNode;
|
|
507
509
|
this.attenuationDistanceNode = source.attenuationDistanceNode;
|