@plastic-software/three 0.180.0 → 0.181.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +943 -486
- package/build/three.core.js +506 -327
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +435 -163
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +8 -2
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3753 -1177
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3752 -1176
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/animation/CCDIKSolver.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +1 -1
- package/examples/jsm/controls/DragControls.js +1 -1
- package/examples/jsm/controls/FirstPersonControls.js +1 -1
- package/examples/jsm/controls/FlyControls.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +2 -2
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +3 -3
- package/examples/jsm/exporters/USDZExporter.js +9 -2
- package/examples/jsm/geometries/DecalGeometry.js +2 -2
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +3 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/ViewHelper.js +43 -5
- package/examples/jsm/inspector/Inspector.js +427 -0
- package/examples/jsm/inspector/RendererInspector.js +415 -0
- package/examples/jsm/inspector/tabs/Console.js +204 -0
- package/examples/jsm/inspector/tabs/Parameters.js +332 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +170 -0
- package/examples/jsm/inspector/ui/Style.js +654 -0
- package/examples/jsm/inspector/ui/Tab.js +46 -0
- package/examples/jsm/inspector/ui/Values.js +423 -0
- package/examples/jsm/inspector/ui/utils.js +56 -0
- package/examples/jsm/interactive/HTMLMesh.js +6 -10
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/jsm/interactive/SelectionBox.js +30 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +2 -2
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GLTFLoader.js +5 -3
- package/examples/jsm/loaders/KTX2Loader.js +28 -21
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +22 -5
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/math/SimplexNoise.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
- package/examples/jsm/misc/TubePainter.js +383 -40
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/SkyMesh.js +1 -1
- package/examples/jsm/objects/Water.js +3 -3
- package/examples/jsm/objects/WaterMesh.js +6 -6
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
- package/examples/jsm/renderers/SVGRenderer.js +1 -1
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/examples/jsm/shaders/AfterimageShader.js +1 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -1
- package/examples/jsm/shaders/BokehShader.js +1 -1
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/DotScreenShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +1 -1
- package/examples/jsm/shaders/GTAOShader.js +2 -2
- package/examples/jsm/shaders/GodRaysShader.js +1 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SepiaShader.js +1 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +7 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
- package/examples/jsm/tsl/display/AnamorphicNode.js +2 -1
- package/examples/jsm/tsl/display/BloomNode.js +4 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +7 -0
- package/examples/jsm/tsl/display/GTAONode.js +45 -5
- package/examples/jsm/tsl/display/GaussianBlurNode.js +5 -3
- package/examples/jsm/tsl/display/OutlineNode.js +11 -0
- package/examples/jsm/tsl/display/SSGINode.js +654 -0
- package/examples/jsm/tsl/display/SSRNode.js +2 -0
- package/examples/jsm/tsl/display/SSSNode.js +488 -0
- package/examples/jsm/tsl/display/TRAANode.js +123 -6
- package/examples/jsm/tsl/display/boxBlur.js +1 -0
- package/examples/jsm/tsl/display/hashBlur.js +1 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
- package/package.json +5 -10
- package/src/Three.Core.js +3 -2
- package/src/Three.TSL.js +7 -1
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +2 -0
- package/src/animation/AnimationClip.js +3 -2
- package/src/animation/AnimationMixer.js +3 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/KeyframeTrack.js +7 -6
- package/src/animation/PropertyBinding.js +12 -11
- package/src/audio/Audio.js +10 -9
- package/src/audio/PositionalAudio.js +1 -1
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +8 -8
- package/src/core/EventDispatcher.js +1 -1
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +3 -2
- package/src/core/Object3D.js +3 -2
- package/src/core/Raycaster.js +2 -1
- package/src/core/RenderTarget.js +10 -1
- package/src/extras/Controls.js +5 -4
- package/src/extras/DataUtils.js +2 -1
- package/src/extras/Earcut.js +6 -0
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +268 -55
- package/src/extras/core/Curve.js +2 -1
- package/src/extras/core/Interpolations.js +7 -1
- package/src/extras/core/ShapePath.js +4 -4
- package/src/extras/lib/earcut.js +7 -7
- package/src/geometries/BoxGeometry.js +1 -0
- package/src/geometries/CapsuleGeometry.js +1 -0
- package/src/geometries/CircleGeometry.js +1 -0
- package/src/geometries/ConeGeometry.js +1 -0
- package/src/geometries/CylinderGeometry.js +1 -0
- package/src/geometries/DodecahedronGeometry.js +1 -0
- package/src/geometries/ExtrudeGeometry.js +8 -6
- package/src/geometries/IcosahedronGeometry.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -0
- package/src/geometries/OctahedronGeometry.js +1 -0
- package/src/geometries/PlaneGeometry.js +1 -0
- package/src/geometries/RingGeometry.js +1 -0
- package/src/geometries/ShapeGeometry.js +1 -0
- package/src/geometries/SphereGeometry.js +1 -0
- package/src/geometries/TetrahedronGeometry.js +1 -0
- package/src/geometries/TorusGeometry.js +1 -0
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +2 -1
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +2 -2
- package/src/loaders/DataTextureLoader.js +1 -1
- package/src/loaders/FileLoader.js +3 -2
- package/src/loaders/ImageBitmapLoader.js +5 -4
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/Loader.js +3 -3
- package/src/loaders/LoadingManager.js +25 -3
- package/src/loaders/MaterialLoader.js +3 -2
- package/src/loaders/ObjectLoader.js +13 -13
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +3 -2
- package/src/materials/Material.js +4 -3
- package/src/materials/MeshBasicMaterial.js +1 -0
- package/src/materials/MeshDepthMaterial.js +1 -0
- package/src/materials/MeshLambertMaterial.js +2 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +2 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +1 -0
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +2 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/NodeMaterial.js +62 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +2 -1
- package/src/math/Color.js +6 -5
- package/src/math/ColorManagement.js +2 -2
- package/src/math/Cylindrical.js +1 -1
- package/src/math/Euler.js +2 -1
- package/src/math/MathUtils.js +13 -11
- package/src/math/Matrix2.js +1 -1
- package/src/math/Matrix3.js +2 -2
- package/src/math/Matrix4.js +7 -7
- package/src/math/Plane.js +1 -1
- package/src/math/Quaternion.js +68 -66
- package/src/math/Spherical.js +1 -1
- package/src/nodes/Nodes.js +1 -1
- package/src/nodes/TSL.js +1 -1
- package/src/nodes/accessors/CubeTextureNode.js +3 -2
- package/src/nodes/accessors/InstanceNode.js +22 -4
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/Normal.js +5 -4
- package/src/nodes/accessors/Position.js +18 -2
- package/src/nodes/accessors/ReferenceNode.js +2 -1
- package/src/nodes/accessors/SceneNode.js +2 -1
- package/src/nodes/accessors/StorageBufferNode.js +2 -1
- package/src/nodes/accessors/StorageTextureNode.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +61 -27
- package/src/nodes/code/FunctionCallNode.js +5 -4
- package/src/nodes/core/ArrayNode.js +1 -0
- package/src/nodes/core/AttributeNode.js +2 -1
- package/src/nodes/core/ContextNode.js +5 -10
- package/src/nodes/core/IndexNode.js +2 -2
- package/src/nodes/core/InputNode.js +2 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +40 -7
- package/src/nodes/core/Node.js +137 -12
- package/src/nodes/core/NodeBuilder.js +135 -21
- package/src/nodes/core/NodeFrame.js +20 -20
- package/src/nodes/core/NodeFunction.js +2 -1
- package/src/nodes/core/NodeParser.js +2 -1
- package/src/nodes/core/NodeUtils.js +17 -90
- package/src/nodes/core/ParameterNode.js +31 -0
- package/src/nodes/core/PropertyNode.js +7 -0
- package/src/nodes/core/StackNode.js +16 -14
- package/src/nodes/core/UniformNode.js +2 -1
- package/src/nodes/core/VarNode.js +70 -12
- package/src/nodes/core/VaryingNode.js +3 -2
- package/src/nodes/display/BlendModes.js +5 -4
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +1 -1
- package/src/nodes/display/NormalMapNode.js +2 -1
- package/src/nodes/display/PassNode.js +51 -10
- package/src/nodes/display/RenderOutputNode.js +28 -2
- package/src/nodes/display/ScreenNode.js +2 -1
- package/src/nodes/display/ToneMappingNode.js +31 -4
- package/src/nodes/display/ToonOutlinePassNode.js +8 -0
- package/src/nodes/fog/Fog.js +3 -2
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhysicalLightingModel.js +3 -2
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/geometry/RangeNode.js +40 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
- package/src/nodes/gpgpu/ComputeNode.js +17 -5
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +25 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
- package/src/nodes/lighting/EnvironmentNode.js +6 -6
- package/src/nodes/lighting/LightsNode.js +2 -3
- package/src/nodes/lighting/PointShadowNode.js +6 -0
- package/src/nodes/lighting/ShadowFilterNode.js +2 -0
- package/src/nodes/lighting/ShadowNode.js +75 -8
- package/src/nodes/math/ConditionalNode.js +6 -5
- package/src/nodes/math/MathNode.js +22 -4
- package/src/nodes/math/OperatorNode.js +3 -2
- package/src/nodes/pmrem/PMREMUtils.js +117 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +5 -2
- package/src/nodes/tsl/TSLCore.js +36 -15
- package/src/nodes/utils/DebugNode.js +2 -1
- package/src/nodes/utils/EventNode.js +36 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +3 -2
- package/src/nodes/utils/LoopNode.js +20 -24
- package/src/nodes/utils/MemberNode.js +2 -1
- package/src/nodes/utils/PostProcessingUtils.js +28 -1
- package/src/nodes/utils/RTTNode.js +12 -2
- package/src/nodes/utils/ReflectorNode.js +10 -3
- package/src/objects/Line.js +2 -1
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Skeleton.js +3 -2
- package/src/objects/SkinnedMesh.js +3 -1
- package/src/objects/Sprite.js +2 -1
- package/src/renderers/WebGLRenderer.js +48 -32
- package/src/renderers/common/Animation.js +13 -1
- package/src/renderers/common/Backend.js +93 -30
- package/src/renderers/common/Background.js +2 -1
- package/src/renderers/common/Bindings.js +56 -2
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/Geometries.js +26 -0
- package/src/renderers/common/Info.js +4 -2
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/PostProcessing.js +6 -25
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderObject.js +3 -1
- package/src/renderers/common/RenderObjects.js +1 -1
- package/src/renderers/common/Renderer.js +436 -228
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +8 -0
- package/src/renderers/common/Sampler.js +37 -11
- package/src/renderers/common/StorageTexture.js +9 -1
- package/src/renderers/common/Textures.js +89 -35
- package/src/renderers/common/TimestampQueryPool.js +63 -1
- package/src/renderers/common/UniformsGroup.js +2 -1
- package/src/renderers/common/XRManager.js +7 -3
- package/src/renderers/common/extras/PMREMGenerator.js +160 -65
- package/src/renderers/common/nodes/NodeLibrary.js +4 -2
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/Nodes.js +38 -16
- package/src/renderers/shaders/DFGLUTData.js +64 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
- package/src/renderers/shaders/UniformsLib.js +1 -0
- package/src/renderers/shaders/UniformsUtils.js +25 -4
- package/src/renderers/webgl/WebGLCapabilities.js +2 -1
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +11 -10
- package/src/renderers/webgl/WebGLPrograms.js +2 -1
- package/src/renderers/webgl/WebGLShadowMap.js +2 -1
- package/src/renderers/webgl/WebGLState.js +15 -14
- package/src/renderers/webgl/WebGLTextures.js +18 -14
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +22 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +74 -11
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +6 -5
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +117 -16
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +42 -12
- package/src/renderers/webgpu/WebGPUBackend.js +134 -108
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +3 -2
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +21 -19
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +5 -3
- package/src/renderers/webgpu/utils/WebGPUConstants.js +5 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +44 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +146 -74
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +29 -6
- package/src/renderers/webgpu/utils/WebGPUUtils.js +22 -2
- package/src/renderers/webxr/WebXRManager.js +3 -2
- package/src/textures/Source.js +2 -1
- package/src/textures/Texture.js +3 -2
- package/src/textures/VideoTexture.js +2 -0
- package/src/utils.js +67 -3
|
@@ -61,12 +61,12 @@ import { BufferGeometryLoader } from './BufferGeometryLoader.js';
|
|
|
61
61
|
import { Loader } from './Loader.js';
|
|
62
62
|
import { FileLoader } from './FileLoader.js';
|
|
63
63
|
import * as Geometries from '../geometries/Geometries.js';
|
|
64
|
-
import { getTypedArray } from '../utils.js';
|
|
64
|
+
import { getTypedArray, error, warn } from '../utils.js';
|
|
65
65
|
import { Box3 } from '../math/Box3.js';
|
|
66
66
|
import { Sphere } from '../math/Sphere.js';
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* A loader for loading a JSON resource in the [JSON Object/Scene format]
|
|
69
|
+
* A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
|
|
70
70
|
* The files are internally loaded via {@link FileLoader}.
|
|
71
71
|
*
|
|
72
72
|
* ```js
|
|
@@ -125,7 +125,7 @@ class ObjectLoader extends Loader {
|
|
|
125
125
|
|
|
126
126
|
if ( onError !== undefined ) onError( error );
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
error( 'ObjectLoader: Can\'t parse ' + url + '.', error.message );
|
|
129
129
|
|
|
130
130
|
return;
|
|
131
131
|
|
|
@@ -137,7 +137,7 @@ class ObjectLoader extends Loader {
|
|
|
137
137
|
|
|
138
138
|
if ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\'t load ' + url ) );
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
error( 'ObjectLoader: Can\'t load ' + url );
|
|
141
141
|
return;
|
|
142
142
|
|
|
143
143
|
}
|
|
@@ -347,7 +347,7 @@ class ObjectLoader extends Loader {
|
|
|
347
347
|
|
|
348
348
|
} else {
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
warn( `ObjectLoader: Unsupported geometry type "${ data.type }"` );
|
|
351
351
|
|
|
352
352
|
}
|
|
353
353
|
|
|
@@ -638,7 +638,7 @@ class ObjectLoader extends Loader {
|
|
|
638
638
|
|
|
639
639
|
if ( typeof value === 'number' ) return value;
|
|
640
640
|
|
|
641
|
-
|
|
641
|
+
warn( 'ObjectLoader.parseTexture: Constant should be in numeric form.', value );
|
|
642
642
|
|
|
643
643
|
return type[ value ];
|
|
644
644
|
|
|
@@ -654,13 +654,13 @@ class ObjectLoader extends Loader {
|
|
|
654
654
|
|
|
655
655
|
if ( data.image === undefined ) {
|
|
656
656
|
|
|
657
|
-
|
|
657
|
+
warn( 'ObjectLoader: No "image" specified for', data.uuid );
|
|
658
658
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
if ( images[ data.image ] === undefined ) {
|
|
662
662
|
|
|
663
|
-
|
|
663
|
+
warn( 'ObjectLoader: Undefined image', data.image );
|
|
664
664
|
|
|
665
665
|
}
|
|
666
666
|
|
|
@@ -748,7 +748,7 @@ class ObjectLoader extends Loader {
|
|
|
748
748
|
|
|
749
749
|
if ( geometries[ name ] === undefined ) {
|
|
750
750
|
|
|
751
|
-
|
|
751
|
+
warn( 'ObjectLoader: Undefined geometry', name );
|
|
752
752
|
|
|
753
753
|
}
|
|
754
754
|
|
|
@@ -770,7 +770,7 @@ class ObjectLoader extends Loader {
|
|
|
770
770
|
|
|
771
771
|
if ( materials[ uuid ] === undefined ) {
|
|
772
772
|
|
|
773
|
-
|
|
773
|
+
warn( 'ObjectLoader: Undefined material', uuid );
|
|
774
774
|
|
|
775
775
|
}
|
|
776
776
|
|
|
@@ -784,7 +784,7 @@ class ObjectLoader extends Loader {
|
|
|
784
784
|
|
|
785
785
|
if ( materials[ name ] === undefined ) {
|
|
786
786
|
|
|
787
|
-
|
|
787
|
+
warn( 'ObjectLoader: Undefined material', name );
|
|
788
788
|
|
|
789
789
|
}
|
|
790
790
|
|
|
@@ -796,7 +796,7 @@ class ObjectLoader extends Loader {
|
|
|
796
796
|
|
|
797
797
|
if ( textures[ uuid ] === undefined ) {
|
|
798
798
|
|
|
799
|
-
|
|
799
|
+
warn( 'ObjectLoader: Undefined texture', uuid );
|
|
800
800
|
|
|
801
801
|
}
|
|
802
802
|
|
|
@@ -1197,7 +1197,7 @@ class ObjectLoader extends Loader {
|
|
|
1197
1197
|
|
|
1198
1198
|
if ( skeleton === undefined ) {
|
|
1199
1199
|
|
|
1200
|
-
|
|
1200
|
+
warn( 'ObjectLoader: No skeleton found with UUID:', child.skeleton );
|
|
1201
1201
|
|
|
1202
1202
|
} else {
|
|
1203
1203
|
|
|
@@ -14,7 +14,7 @@ import { Loader } from './Loader.js';
|
|
|
14
14
|
* ```
|
|
15
15
|
* Please note that `TextureLoader` has dropped support for progress
|
|
16
16
|
* events in `r84`. For a `TextureLoader` that supports progress events, see
|
|
17
|
-
* [this thread]
|
|
17
|
+
* [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145).
|
|
18
18
|
*
|
|
19
19
|
* @augments Loader
|
|
20
20
|
*/
|
|
@@ -2,6 +2,7 @@ import { nodeObject, float } from '../../nodes/tsl/TSLBase.js';
|
|
|
2
2
|
|
|
3
3
|
import { Loader } from '../Loader.js';
|
|
4
4
|
import { FileLoader } from '../../loaders/FileLoader.js';
|
|
5
|
+
import { error } from '../../utils.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A loader for loading node objects in the three.js JSON Object/Scene format.
|
|
@@ -63,7 +64,7 @@ class NodeLoader extends Loader {
|
|
|
63
64
|
|
|
64
65
|
} else {
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
error( e );
|
|
67
68
|
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -179,7 +180,7 @@ class NodeLoader extends Loader {
|
|
|
179
180
|
|
|
180
181
|
if ( this.nodes[ type ] === undefined ) {
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
error( 'NodeLoader: Node type not found:', type );
|
|
183
184
|
return float();
|
|
184
185
|
|
|
185
186
|
}
|
|
@@ -2,6 +2,7 @@ import { Color } from '../math/Color.js';
|
|
|
2
2
|
import { EventDispatcher } from '../core/EventDispatcher.js';
|
|
3
3
|
import { FrontSide, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';
|
|
4
4
|
import { generateUUID } from '../math/MathUtils.js';
|
|
5
|
+
import { warn } from '../utils.js';
|
|
5
6
|
|
|
6
7
|
let _materialId = 0;
|
|
7
8
|
|
|
@@ -522,7 +523,7 @@ class Material extends EventDispatcher {
|
|
|
522
523
|
*
|
|
523
524
|
* This method can only be used when rendering with {@link WebGLRenderer}. The
|
|
524
525
|
* recommended approach when customizing materials is to use `WebGPURenderer` with the new
|
|
525
|
-
* Node Material system and [TSL]
|
|
526
|
+
* Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).
|
|
526
527
|
*
|
|
527
528
|
* @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.
|
|
528
529
|
* @param {WebGLRenderer} renderer - A reference to the renderer.
|
|
@@ -561,7 +562,7 @@ class Material extends EventDispatcher {
|
|
|
561
562
|
|
|
562
563
|
if ( newValue === undefined ) {
|
|
563
564
|
|
|
564
|
-
|
|
565
|
+
warn( `Material: parameter '${ key }' has value of undefined.` );
|
|
565
566
|
continue;
|
|
566
567
|
|
|
567
568
|
}
|
|
@@ -570,7 +571,7 @@ class Material extends EventDispatcher {
|
|
|
570
571
|
|
|
571
572
|
if ( currentValue === undefined ) {
|
|
572
573
|
|
|
573
|
-
|
|
574
|
+
warn( `Material: '${ key }' is not a property of THREE.${ this.type }.` );
|
|
574
575
|
continue;
|
|
575
576
|
|
|
576
577
|
}
|
|
@@ -7,7 +7,7 @@ import { Euler } from '../math/Euler.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* A material for non-shiny surfaces, without specular highlights.
|
|
9
9
|
*
|
|
10
|
-
* The material uses a non-physically based [Lambertian]
|
|
10
|
+
* The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance)
|
|
11
11
|
* model for calculating reflectance. This can simulate some surfaces (such
|
|
12
12
|
* as untreated wood or stone) well, but cannot simulate shiny surfaces with
|
|
13
13
|
* specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment
|
|
@@ -19,6 +19,7 @@ import { Euler } from '../math/Euler.js';
|
|
|
19
19
|
* {@link MeshPhysicalMaterial}, at the cost of some graphical accuracy.
|
|
20
20
|
*
|
|
21
21
|
* @augments Material
|
|
22
|
+
* @demo scenes/material-browser.html#MeshLambertMaterial
|
|
22
23
|
*/
|
|
23
24
|
class MeshLambertMaterial extends Material {
|
|
24
25
|
|
|
@@ -13,6 +13,7 @@ import { Color } from '../math/Color.js';
|
|
|
13
13
|
* shadows.
|
|
14
14
|
*
|
|
15
15
|
* @augments Material
|
|
16
|
+
* @demo scenes/material-browser.html#MeshMatcapMaterial
|
|
16
17
|
*/
|
|
17
18
|
class MeshMatcapMaterial extends Material {
|
|
18
19
|
|
|
@@ -164,6 +165,24 @@ class MeshMatcapMaterial extends Material {
|
|
|
164
165
|
*/
|
|
165
166
|
this.alphaMap = null;
|
|
166
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Renders the geometry as a wireframe.
|
|
170
|
+
*
|
|
171
|
+
* @type {boolean}
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
this.wireframe = false;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Controls the thickness of the wireframe.
|
|
178
|
+
*
|
|
179
|
+
* Can only be used with {@link SVGRenderer}.
|
|
180
|
+
*
|
|
181
|
+
* @type {number}
|
|
182
|
+
* @default 1
|
|
183
|
+
*/
|
|
184
|
+
this.wireframeLinewidth = 1;
|
|
185
|
+
|
|
167
186
|
/**
|
|
168
187
|
* Whether the material is rendered with flat shading or not.
|
|
169
188
|
*
|
|
@@ -210,6 +229,9 @@ class MeshMatcapMaterial extends Material {
|
|
|
210
229
|
|
|
211
230
|
this.alphaMap = source.alphaMap;
|
|
212
231
|
|
|
232
|
+
this.wireframe = source.wireframe;
|
|
233
|
+
this.wireframeLinewidth = source.wireframeLinewidth;
|
|
234
|
+
|
|
213
235
|
this.flatShading = source.flatShading;
|
|
214
236
|
|
|
215
237
|
this.fog = source.fog;
|
|
@@ -7,7 +7,7 @@ import { Euler } from '../math/Euler.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* A material for shiny surfaces with specular highlights.
|
|
9
9
|
*
|
|
10
|
-
* The material uses a non-physically based [Blinn-Phong]
|
|
10
|
+
* The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model)
|
|
11
11
|
* model for calculating reflectance. Unlike the Lambertian model used in the
|
|
12
12
|
* {@link MeshLambertMaterial} this can simulate shiny surfaces with specular
|
|
13
13
|
* highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading.
|
|
@@ -17,6 +17,7 @@ import { Euler } from '../math/Euler.js';
|
|
|
17
17
|
* some graphical accuracy.
|
|
18
18
|
*
|
|
19
19
|
* @augments Material
|
|
20
|
+
* @demo scenes/material-browser.html#MeshPhongMaterial
|
|
20
21
|
*/
|
|
21
22
|
class MeshPhongMaterial extends Material {
|
|
22
23
|
|
|
@@ -27,6 +27,7 @@ import { clamp } from '../math/MathUtils.js';
|
|
|
27
27
|
* best results, always specify an environment map when using this material.
|
|
28
28
|
*
|
|
29
29
|
* @augments MeshStandardMaterial
|
|
30
|
+
* @demo scenes/material-browser.html#MeshPhysicalMaterial
|
|
30
31
|
*/
|
|
31
32
|
class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
32
33
|
|
|
@@ -323,7 +324,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
323
324
|
}
|
|
324
325
|
|
|
325
326
|
/**
|
|
326
|
-
* The anisotropy strength.
|
|
327
|
+
* The anisotropy strength, from `0.0` to `1.0`.
|
|
327
328
|
*
|
|
328
329
|
* @type {number}
|
|
329
330
|
* @default 0
|
|
@@ -8,9 +8,9 @@ import { Euler } from '../math/Euler.js';
|
|
|
8
8
|
* A standard physically based material, using Metallic-Roughness workflow.
|
|
9
9
|
*
|
|
10
10
|
* Physically based rendering (PBR) has recently become the standard in many
|
|
11
|
-
* 3D applications, such as [Unity]
|
|
12
|
-
* [Unreal]
|
|
13
|
-
* [3D Studio Max]
|
|
11
|
+
* 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/),
|
|
12
|
+
* [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and
|
|
13
|
+
* [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017).
|
|
14
14
|
*
|
|
15
15
|
* This approach differs from older approaches in that instead of using
|
|
16
16
|
* approximations for the way in which light interacts with a surface, a
|
|
@@ -26,16 +26,17 @@ import { Euler } from '../math/Euler.js';
|
|
|
26
26
|
* Note that for best results you should always specify an environment map when using this material.
|
|
27
27
|
*
|
|
28
28
|
* For a non-technical introduction to the concept of PBR and how to set up a
|
|
29
|
-
* PBR material, check out these articles by the people at [marmoset]
|
|
29
|
+
* PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co):
|
|
30
30
|
*
|
|
31
|
-
* - [Basic Theory of Physically Based Rendering]
|
|
32
|
-
* - [Physically Based Rendering and You Can Too]
|
|
31
|
+
* - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)
|
|
32
|
+
* - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)
|
|
33
33
|
*
|
|
34
34
|
* Technical details of the approach used in three.js (and most other PBR systems) can be found is this
|
|
35
|
-
* [paper from Disney]
|
|
35
|
+
* [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf)
|
|
36
36
|
* (pdf), by Brent Burley.
|
|
37
37
|
*
|
|
38
38
|
* @augments Material
|
|
39
|
+
* @demo scenes/material-browser.html#MeshStandardMaterial
|
|
39
40
|
*/
|
|
40
41
|
class MeshStandardMaterial extends Material {
|
|
41
42
|
|
|
@@ -88,7 +88,7 @@ class PointsMaterial extends Material {
|
|
|
88
88
|
/**
|
|
89
89
|
* Defines the size of the points in pixels.
|
|
90
90
|
*
|
|
91
|
-
* Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE]
|
|
91
|
+
* Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete).
|
|
92
92
|
*
|
|
93
93
|
* @type {number}
|
|
94
94
|
* @default 1
|
|
@@ -17,7 +17,7 @@ import default_fragment from '../renderers/shaders/ShaderChunk/default_fragment.
|
|
|
17
17
|
* - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end`
|
|
18
18
|
* in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has
|
|
19
19
|
* to be placed right above the loop. The loop formatting has to correspond to a defined standard.
|
|
20
|
-
* - The loop has to be [normalized]
|
|
20
|
+
* - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop).
|
|
21
21
|
* - The loop variable has to be *i*.
|
|
22
22
|
* - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly
|
|
23
23
|
* value of *i* for the given iteration and can be used in preprocessor
|
|
@@ -223,7 +223,7 @@ class ShaderMaterial extends Material {
|
|
|
223
223
|
};
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
|
-
* If set, this calls [gl.bindAttribLocation]
|
|
226
|
+
* If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation)
|
|
227
227
|
* to bind a generic vertex index to an attribute variable.
|
|
228
228
|
*
|
|
229
229
|
* @type {string|undefined}
|
|
@@ -378,7 +378,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
378
378
|
|
|
379
379
|
if ( ! useDash ) {
|
|
380
380
|
|
|
381
|
-
if ( useAlphaToCoverage && renderer.
|
|
381
|
+
if ( useAlphaToCoverage && renderer.currentSamples > 0 ) {
|
|
382
382
|
|
|
383
383
|
const dnorm = norm.fwidth();
|
|
384
384
|
alpha.assign( smoothstep( dnorm.negate().add( 0.5 ), dnorm.add( 0.5 ), norm ).oneMinus() );
|
|
@@ -395,7 +395,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
395
395
|
|
|
396
396
|
// round endcaps
|
|
397
397
|
|
|
398
|
-
if ( useAlphaToCoverage && renderer.
|
|
398
|
+
if ( useAlphaToCoverage && renderer.currentSamples > 0 ) {
|
|
399
399
|
|
|
400
400
|
const a = vUv.x;
|
|
401
401
|
const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
@@ -39,7 +39,7 @@ class SSSLightingModel extends PhysicalLightingModel {
|
|
|
39
39
|
/**
|
|
40
40
|
* Extends the default implementation with a SSS term.
|
|
41
41
|
*
|
|
42
|
-
* Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look]
|
|
42
|
+
* Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/)
|
|
43
43
|
*
|
|
44
44
|
* @param {Object} input - The input data.
|
|
45
45
|
* @param {NodeBuilder} builder - The current node builder.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Material } from '../Material.js';
|
|
2
|
-
import { NormalBlending } from '../../constants.js';
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { hashArray, hashString } from '../../nodes/core/NodeUtils.js';
|
|
5
4
|
import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js';
|
|
6
5
|
import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAO } from '../../nodes/accessors/MaterialNode.js';
|
|
7
6
|
import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
|
|
@@ -12,7 +11,7 @@ import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.j
|
|
|
12
11
|
import { positionLocal, positionView } from '../../nodes/accessors/Position.js';
|
|
13
12
|
import { skinning } from '../../nodes/accessors/SkinningNode.js';
|
|
14
13
|
import { morphReference } from '../../nodes/accessors/MorphNode.js';
|
|
15
|
-
import { mix } from '../../nodes/math/MathNode.js';
|
|
14
|
+
import { fwidth, mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
16
15
|
import { float, vec3, vec4, bool } from '../../nodes/tsl/TSLBase.js';
|
|
17
16
|
import AONode from '../../nodes/lighting/AONode.js';
|
|
18
17
|
import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
|
|
@@ -26,6 +25,7 @@ import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
|
26
25
|
import { vertexColor } from '../../nodes/accessors/VertexColorNode.js';
|
|
27
26
|
import { premultiplyAlpha } from '../../nodes/display/BlendModes.js';
|
|
28
27
|
import { subBuild } from '../../nodes/core/SubBuildNode.js';
|
|
28
|
+
import { warn } from '../../utils.js';
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Base class for all node materials.
|
|
@@ -181,7 +181,7 @@ class NodeMaterial extends Material {
|
|
|
181
181
|
* and `alphaMap` properties. This node property allows to overwrite the default
|
|
182
182
|
* and define the opacity with a node instead.
|
|
183
183
|
*
|
|
184
|
-
* If you don't want to overwrite the
|
|
184
|
+
* If you don't want to overwrite the opacity but modify the existing
|
|
185
185
|
* value instead, use {@link materialOpacity}.
|
|
186
186
|
*
|
|
187
187
|
* @type {?Node<float>}
|
|
@@ -394,7 +394,7 @@ class NodeMaterial extends Material {
|
|
|
394
394
|
|
|
395
395
|
set: ( value ) => {
|
|
396
396
|
|
|
397
|
-
|
|
397
|
+
warn( 'NodeMaterial: ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".' );
|
|
398
398
|
|
|
399
399
|
this.receivedShadowPositionNode = value;
|
|
400
400
|
|
|
@@ -404,6 +404,34 @@ class NodeMaterial extends Material {
|
|
|
404
404
|
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
/**
|
|
408
|
+
* Returns an array of child nodes for this material.
|
|
409
|
+
*
|
|
410
|
+
* @private
|
|
411
|
+
* @returns {Array<{property: string, childNode: Node}>}
|
|
412
|
+
*/
|
|
413
|
+
_getNodeChildren() {
|
|
414
|
+
|
|
415
|
+
const children = [];
|
|
416
|
+
|
|
417
|
+
for ( const property of Object.getOwnPropertyNames( this ) ) {
|
|
418
|
+
|
|
419
|
+
if ( property.startsWith( '_' ) === true ) continue;
|
|
420
|
+
|
|
421
|
+
const object = this[ property ];
|
|
422
|
+
|
|
423
|
+
if ( object && object.isNode === true ) {
|
|
424
|
+
|
|
425
|
+
children.push( { property, childNode: object } );
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return children;
|
|
432
|
+
|
|
433
|
+
}
|
|
434
|
+
|
|
407
435
|
/**
|
|
408
436
|
* Allows to define a custom cache key that influence the material key computation
|
|
409
437
|
* for render objects.
|
|
@@ -412,7 +440,15 @@ class NodeMaterial extends Material {
|
|
|
412
440
|
*/
|
|
413
441
|
customProgramCacheKey() {
|
|
414
442
|
|
|
415
|
-
|
|
443
|
+
const values = [];
|
|
444
|
+
|
|
445
|
+
for ( const { property, childNode } of this._getNodeChildren() ) {
|
|
446
|
+
|
|
447
|
+
values.push( hashString( property.slice( 0, - 4 ) ), childNode.getCacheKey() );
|
|
448
|
+
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return this.type + hashArray( values );
|
|
416
452
|
|
|
417
453
|
}
|
|
418
454
|
|
|
@@ -504,7 +540,7 @@ class NodeMaterial extends Material {
|
|
|
504
540
|
|
|
505
541
|
const outgoingLightNode = this.setupLighting( builder );
|
|
506
542
|
|
|
507
|
-
if ( clippingNode !== null ) builder.stack.
|
|
543
|
+
if ( clippingNode !== null ) builder.stack.addToStack( clippingNode );
|
|
508
544
|
|
|
509
545
|
// force unsigned floats - useful for RenderTargets
|
|
510
546
|
|
|
@@ -589,7 +625,7 @@ class NodeMaterial extends Material {
|
|
|
589
625
|
|
|
590
626
|
if ( unionPlanes.length > 0 || intersectionPlanes.length > 0 ) {
|
|
591
627
|
|
|
592
|
-
const samples = builder.renderer.
|
|
628
|
+
const samples = builder.renderer.currentSamples;
|
|
593
629
|
|
|
594
630
|
if ( this.alphaToCoverage && samples > 1 ) {
|
|
595
631
|
|
|
@@ -598,7 +634,7 @@ class NodeMaterial extends Material {
|
|
|
598
634
|
|
|
599
635
|
} else {
|
|
600
636
|
|
|
601
|
-
builder.stack.
|
|
637
|
+
builder.stack.addToStack( clipping() );
|
|
602
638
|
|
|
603
639
|
}
|
|
604
640
|
|
|
@@ -625,7 +661,7 @@ class NodeMaterial extends Material {
|
|
|
625
661
|
|
|
626
662
|
if ( candidateCount > 0 && candidateCount <= 8 && builder.isAvailable( 'clipDistance' ) ) {
|
|
627
663
|
|
|
628
|
-
builder.stack.
|
|
664
|
+
builder.stack.addToStack( hardwareClipping() );
|
|
629
665
|
|
|
630
666
|
this.hardwareClipping = true;
|
|
631
667
|
|
|
@@ -783,7 +819,9 @@ class NodeMaterial extends Material {
|
|
|
783
819
|
* @param {NodeBuilder} builder - The current node builder.
|
|
784
820
|
* @param {BufferGeometry} geometry - The geometry.
|
|
785
821
|
*/
|
|
786
|
-
setupDiffuseColor(
|
|
822
|
+
setupDiffuseColor( builder ) {
|
|
823
|
+
|
|
824
|
+
const { object, geometry } = builder;
|
|
787
825
|
|
|
788
826
|
// MASK
|
|
789
827
|
|
|
@@ -842,7 +880,16 @@ class NodeMaterial extends Material {
|
|
|
842
880
|
|
|
843
881
|
alphaTestNode = this.alphaTestNode !== null ? float( this.alphaTestNode ) : materialAlphaTest;
|
|
844
882
|
|
|
845
|
-
|
|
883
|
+
if ( this.alphaToCoverage === true ) {
|
|
884
|
+
|
|
885
|
+
diffuseColor.a = smoothstep( alphaTestNode, alphaTestNode.add( fwidth( diffuseColor.a ) ), diffuseColor.a );
|
|
886
|
+
diffuseColor.a.lessThanEqual( 0 ).discard();
|
|
887
|
+
|
|
888
|
+
} else {
|
|
889
|
+
|
|
890
|
+
diffuseColor.a.lessThanEqual( alphaTestNode ).discard();
|
|
891
|
+
|
|
892
|
+
}
|
|
846
893
|
|
|
847
894
|
}
|
|
848
895
|
|
|
@@ -856,16 +903,10 @@ class NodeMaterial extends Material {
|
|
|
856
903
|
|
|
857
904
|
// OPAQUE
|
|
858
905
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
if ( isOpaque ) {
|
|
906
|
+
if ( builder.isOpaque() ) {
|
|
862
907
|
|
|
863
908
|
diffuseColor.a.assign( 1.0 );
|
|
864
909
|
|
|
865
|
-
} else if ( alphaTestNode === null ) {
|
|
866
|
-
|
|
867
|
-
diffuseColor.a.lessThanEqual( 0 ).discard();
|
|
868
|
-
|
|
869
910
|
}
|
|
870
911
|
|
|
871
912
|
}
|
|
@@ -1183,11 +1224,9 @@ class NodeMaterial extends Material {
|
|
|
1183
1224
|
}
|
|
1184
1225
|
|
|
1185
1226
|
const data = Material.prototype.toJSON.call( this, meta );
|
|
1186
|
-
const nodeChildren = getNodeChildren( this );
|
|
1187
|
-
|
|
1188
1227
|
data.inputNodes = {};
|
|
1189
1228
|
|
|
1190
|
-
for ( const { property, childNode } of
|
|
1229
|
+
for ( const { property, childNode } of this._getNodeChildren() ) {
|
|
1191
1230
|
|
|
1192
1231
|
data.inputNodes[ property ] = childNode.toJSON( meta ).uuid;
|
|
1193
1232
|
|
|
@@ -1237,6 +1276,7 @@ class NodeMaterial extends Material {
|
|
|
1237
1276
|
|
|
1238
1277
|
this.lightsNode = source.lightsNode;
|
|
1239
1278
|
this.envNode = source.envNode;
|
|
1279
|
+
this.aoNode = source.aoNode;
|
|
1240
1280
|
|
|
1241
1281
|
this.colorNode = source.colorNode;
|
|
1242
1282
|
this.normalNode = source.normalNode;
|
|
@@ -465,13 +465,14 @@ class NodeMaterialObserver {
|
|
|
465
465
|
|
|
466
466
|
if ( renderObjectData.morphTargetInfluences[ i ] !== object.morphTargetInfluences[ i ] ) {
|
|
467
467
|
|
|
468
|
+
renderObjectData.morphTargetInfluences[ i ] = object.morphTargetInfluences[ i ];
|
|
468
469
|
morphChanged = true;
|
|
469
470
|
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
}
|
|
473
474
|
|
|
474
|
-
if ( morphChanged ) return
|
|
475
|
+
if ( morphChanged ) return false;
|
|
475
476
|
|
|
476
477
|
}
|
|
477
478
|
|