@gnsx/three 0.184.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 +21 -0
- package/README.md +85 -0
- package/build/three.cjs +79695 -0
- package/build/three.core.js +59732 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +19552 -0
- package/build/three.module.min.js +6 -0
- package/build/three.tsl.js +654 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +83969 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +83702 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/fonts/LICENSE +13 -0
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/fonts/README.md +11 -0
- package/examples/fonts/droid/NOTICE +190 -0
- package/examples/fonts/droid/README.txt +18 -0
- package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
- package/examples/fonts/gentilis_bold.typeface.json +1 -0
- package/examples/fonts/gentilis_regular.typeface.json +1 -0
- package/examples/fonts/helvetiker_bold.typeface.json +1 -0
- package/examples/fonts/helvetiker_regular.typeface.json +1 -0
- package/examples/fonts/optimer_bold.typeface.json +1 -0
- package/examples/fonts/optimer_regular.typeface.json +1 -0
- package/examples/fonts/ttf/README.md +9 -0
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/Addons.js +293 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.js +595 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.js +3539 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.js +451 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.js +1963 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.js +1001 -0
- package/examples/jsm/controls/TransformControls.js +1950 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.js +209 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.js +307 -0
- package/examples/jsm/csm/CSMShadowNode.js +603 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.js +155 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.js +310 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.js +311 -0
- package/examples/jsm/exporters/EXRExporter.js +618 -0
- package/examples/jsm/exporters/GLTFExporter.js +3738 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.js +308 -0
- package/examples/jsm/exporters/PLYExporter.js +562 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.js +1254 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.js +165 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.js +519 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -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 +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +601 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/ammo.wasm.js +822 -0
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +46 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/draco/README.md +32 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/ecsy.module.js +1792 -0
- package/examples/jsm/libs/fflate.module.js +2672 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/lottie_canvas.module.js +14849 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/opentype.module.js +14506 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/libs/tween.module.js +876 -0
- package/examples/jsm/libs/utif.module.js +1665 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.js +703 -0
- package/examples/jsm/lines/LineSegments2.js +426 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +411 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +1836 -0
- package/examples/jsm/loaders/3MFLoader.js +1621 -0
- package/examples/jsm/loaders/AMFLoader.js +541 -0
- package/examples/jsm/loaders/BVHLoader.js +484 -0
- package/examples/jsm/loaders/ColladaLoader.js +153 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.js +739 -0
- package/examples/jsm/loaders/EXRLoader.js +3423 -0
- package/examples/jsm/loaders/FBXLoader.js +4580 -0
- package/examples/jsm/loaders/FontLoader.js +260 -0
- package/examples/jsm/loaders/GCodeLoader.js +318 -0
- package/examples/jsm/loaders/GLTFLoader.js +4860 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +379 -0
- package/examples/jsm/loaders/KMZLoader.js +163 -0
- package/examples/jsm/loaders/KTX2Loader.js +1257 -0
- package/examples/jsm/loaders/KTXLoader.js +197 -0
- package/examples/jsm/loaders/LDrawLoader.js +2510 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
- package/examples/jsm/loaders/LUTImageLoader.js +190 -0
- package/examples/jsm/loaders/LWOLoader.js +1047 -0
- package/examples/jsm/loaders/LottieLoader.js +130 -0
- package/examples/jsm/loaders/MD2Loader.js +435 -0
- package/examples/jsm/loaders/MDDLoader.js +147 -0
- package/examples/jsm/loaders/MTLLoader.js +593 -0
- package/examples/jsm/loaders/MaterialXLoader.js +1104 -0
- package/examples/jsm/loaders/NRRDLoader.js +718 -0
- package/examples/jsm/loaders/OBJLoader.js +955 -0
- package/examples/jsm/loaders/PCDLoader.js +620 -0
- package/examples/jsm/loaders/PDBLoader.js +272 -0
- package/examples/jsm/loaders/PLYLoader.js +805 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/STLLoader.js +421 -0
- package/examples/jsm/loaders/SVGLoader.js +3267 -0
- package/examples/jsm/loaders/TDSLoader.js +1142 -0
- package/examples/jsm/loaders/TGALoader.js +538 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.js +261 -0
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
- package/examples/jsm/loaders/VOXLoader.js +919 -0
- package/examples/jsm/loaders/VRMLLoader.js +3646 -0
- package/examples/jsm/loaders/VTKLoader.js +1293 -0
- package/examples/jsm/loaders/XYZLoader.js +143 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/loaders/usd/USDAParser.js +828 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1878 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/Capsule.js +159 -0
- package/examples/jsm/math/ColorConverter.js +58 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.js +822 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/TubePainter.js +599 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +632 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.js +386 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.js +321 -0
- package/examples/jsm/objects/SkyMesh.js +377 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.js +194 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.js +359 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.js +436 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +185 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.js +727 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.js +856 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +524 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +328 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.js +799 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +180 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.js +72 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.js +434 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.js +298 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.js +675 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1228 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +983 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +254 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +293 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- package/examples/jsm/tsl/display/BloomNode.js +534 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +174 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +334 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +554 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/FXAANode.js +365 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.js +572 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +399 -0
- package/examples/jsm/tsl/display/GodraysNode.js +615 -0
- package/examples/jsm/tsl/display/LensflareNode.js +279 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OutlineNode.js +812 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +89 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +768 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +358 -0
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +119 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +767 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +54 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1434 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +403 -0
- package/examples/jsm/webxr/XREstimatedLight.js +254 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/package.json +123 -0
- package/src/Three.Core.js +187 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.js +647 -0
- package/src/Three.WebGPU.Nodes.js +31 -0
- package/src/Three.WebGPU.js +37 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.js +942 -0
- package/src/animation/AnimationClip.js +628 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.js +411 -0
- package/src/animation/AnimationUtils.js +495 -0
- package/src/animation/KeyframeTrack.js +636 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.js +54 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.js +146 -0
- package/src/constants.js +1760 -0
- package/src/core/BufferAttribute.js +1056 -0
- package/src/core/BufferGeometry.js +1458 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.js +291 -0
- package/src/core/InterleavedBufferAttribute.js +549 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.js +1667 -0
- package/src/core/Raycaster.js +262 -0
- package/src/core/RenderTarget.js +392 -0
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.js +180 -0
- package/src/extras/Controls.js +120 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.js +1167 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.js +517 -0
- package/src/extras/core/CurvePath.js +296 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.js +367 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.js +180 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.js +230 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.js +175 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.js +171 -0
- package/src/helpers/AxesHelper.js +96 -0
- package/src/helpers/Box3Helper.js +83 -0
- package/src/helpers/BoxHelper.js +149 -0
- package/src/helpers/CameraHelper.js +345 -0
- package/src/helpers/DirectionalLightHelper.js +148 -0
- package/src/helpers/GridHelper.js +82 -0
- package/src/helpers/HemisphereLightHelper.js +130 -0
- package/src/helpers/PlaneHelper.js +96 -0
- package/src/helpers/PointLightHelper.js +111 -0
- package/src/helpers/PolarGridHelper.js +126 -0
- package/src/helpers/SkeletonHelper.js +194 -0
- package/src/helpers/SpotLightHelper.js +154 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.js +85 -0
- package/src/lights/LightProbe.js +75 -0
- package/src/lights/LightShadow.js +347 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.js +80 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +98 -0
- package/src/loaders/AudioLoader.js +108 -0
- package/src/loaders/BufferGeometryLoader.js +242 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.js +167 -0
- package/src/loaders/CubeTextureLoader.js +103 -0
- package/src/loaders/DataTextureLoader.js +174 -0
- package/src/loaders/FileLoader.js +367 -0
- package/src/loaders/ImageBitmapLoader.js +223 -0
- package/src/loaders/ImageLoader.js +168 -0
- package/src/loaders/Loader.js +222 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.js +329 -0
- package/src/loaders/MaterialLoader.js +439 -0
- package/src/loaders/ObjectLoader.js +1304 -0
- package/src/loaders/TextureLoader.js +74 -0
- package/src/loaders/nodes/NodeLoader.js +194 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.js +122 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.js +1017 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.js +250 -0
- package/src/materials/MeshDepthMaterial.js +148 -0
- package/src/materials/MeshDistanceMaterial.js +119 -0
- package/src/materials/MeshLambertMaterial.js +402 -0
- package/src/materials/MeshMatcapMaterial.js +245 -0
- package/src/materials/MeshNormalMaterial.js +175 -0
- package/src/materials/MeshPhongMaterial.js +421 -0
- package/src/materials/MeshPhysicalMaterial.js +536 -0
- package/src/materials/MeshStandardMaterial.js +425 -0
- package/src/materials/MeshToonMaterial.js +321 -0
- package/src/materials/PointsMaterial.js +139 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.js +413 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.js +136 -0
- package/src/materials/nodes/Line2NodeMaterial.js +569 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +141 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +521 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +175 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +187 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
- package/src/materials/nodes/NodeMaterial.js +1330 -0
- package/src/materials/nodes/NodeMaterials.js +21 -0
- package/src/materials/nodes/PointsNodeMaterial.js +211 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +186 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +718 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.js +805 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.js +215 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.js +285 -0
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.js +337 -0
- package/src/math/MathUtils.js +751 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.js +617 -0
- package/src/math/Matrix4.js +1314 -0
- package/src/math/Plane.js +368 -0
- package/src/math/Quaternion.js +918 -0
- package/src/math/Ray.js +655 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.js +539 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.js +1067 -0
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.js +173 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +163 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.js +432 -0
- package/src/nodes/accessors/BufferNode.js +128 -0
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +403 -0
- package/src/nodes/accessors/ClippingNode.js +255 -0
- package/src/nodes/accessors/CubeTextureNode.js +215 -0
- package/src/nodes/accessors/InstanceNode.js +349 -0
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +139 -0
- package/src/nodes/accessors/MaterialNode.js +783 -0
- package/src/nodes/accessors/MaterialProperties.js +56 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.js +184 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/MorphNode.js +310 -0
- package/src/nodes/accessors/Normal.js +243 -0
- package/src/nodes/accessors/Object3DNode.js +268 -0
- package/src/nodes/accessors/PointUVNode.js +55 -0
- package/src/nodes/accessors/Position.js +122 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +357 -0
- package/src/nodes/accessors/ReferenceNode.js +424 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +328 -0
- package/src/nodes/accessors/StorageBufferNode.js +405 -0
- package/src/nodes/accessors/StorageTextureNode.js +295 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.js +92 -0
- package/src/nodes/accessors/TextureNode.js +971 -0
- package/src/nodes/accessors/TextureSizeNode.js +77 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.js +350 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.js +224 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.js +181 -0
- package/src/nodes/code/ExpressionNode.js +68 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.js +182 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +202 -0
- package/src/nodes/core/AttributeNode.js +168 -0
- package/src/nodes/core/BypassNode.js +93 -0
- package/src/nodes/core/ConstNode.js +67 -0
- package/src/nodes/core/ContextNode.js +283 -0
- package/src/nodes/core/IndexNode.js +165 -0
- package/src/nodes/core/InputNode.js +136 -0
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.js +196 -0
- package/src/nodes/core/Node.js +1180 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.js +3299 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +314 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.js +408 -0
- package/src/nodes/core/NodeVar.js +60 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.js +105 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.js +367 -0
- package/src/nodes/core/StackNode.js +426 -0
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +134 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +148 -0
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +88 -0
- package/src/nodes/core/UniformGroupNode.js +167 -0
- package/src/nodes/core/UniformNode.js +259 -0
- package/src/nodes/core/VarNode.js +367 -0
- package/src/nodes/core/VaryingNode.js +210 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +117 -0
- package/src/nodes/display/ColorAdjustment.js +158 -0
- package/src/nodes/display/ColorSpaceFunctions.js +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.js +102 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.js +1055 -0
- package/src/nodes/display/RenderOutputNode.js +150 -0
- package/src/nodes/display/ScreenNode.js +292 -0
- package/src/nodes/display/ToneMappingFunctions.js +242 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.js +191 -0
- package/src/nodes/display/ViewportDepthNode.js +342 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/D_GGX.js +23 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.js +175 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.js +878 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/functions/material/getRoughness.js +18 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +210 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +274 -0
- package/src/nodes/gpgpu/BarrierNode.js +98 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
- package/src/nodes/gpgpu/ComputeNode.js +310 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +234 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.js +309 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.js +178 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.js +49 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.js +73 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.js +115 -0
- package/src/nodes/lighting/LightingNode.js +36 -0
- package/src/nodes/lighting/LightsNode.js +432 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +133 -0
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +889 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXNodes.js +197 -0
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/src/nodes/materialx/lib/mx_noise.js +1491 -0
- package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +245 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.js +1202 -0
- package/src/nodes/math/MathUtils.js +54 -0
- package/src/nodes/math/OperatorNode.js +752 -0
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +71 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.js +397 -0
- package/src/nodes/pmrem/PMREMUtils.js +397 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.js +1250 -0
- package/src/nodes/utils/ArrayElementNode.js +90 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +148 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.js +349 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +33 -0
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +289 -0
- package/src/nodes/utils/ReflectorNode.js +629 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +103 -0
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.js +179 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +63 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.js +1682 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.js +422 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.js +329 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.js +496 -0
- package/src/objects/Points.js +228 -0
- package/src/objects/Skeleton.js +392 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.js +245 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.js +3699 -0
- package/src/renderers/common/Animation.js +159 -0
- package/src/renderers/common/Attributes.js +132 -0
- package/src/renderers/common/Backend.js +769 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +46 -0
- package/src/renderers/common/Binding.js +71 -0
- package/src/renderers/common/Bindings.js +394 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +127 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.js +83 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.js +262 -0
- package/src/renderers/common/Color4.js +77 -0
- package/src/renderers/common/ComputePipeline.js +41 -0
- package/src/renderers/common/Constants.js +15 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/Geometries.js +396 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +501 -0
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +498 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +78 -0
- package/src/renderers/common/QuadMesh.js +112 -0
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +26 -0
- package/src/renderers/common/RenderBundles.js +71 -0
- package/src/renderers/common/RenderContext.js +281 -0
- package/src/renderers/common/RenderContexts.js +100 -0
- package/src/renderers/common/RenderList.js +404 -0
- package/src/renderers/common/RenderLists.js +78 -0
- package/src/renderers/common/RenderObject.js +915 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +218 -0
- package/src/renderers/common/RenderPipeline.js +255 -0
- package/src/renderers/common/Renderer.js +3654 -0
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +165 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.js +86 -0
- package/src/renderers/common/Textures.js +629 -0
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +548 -0
- package/src/renderers/common/XRManager.js +1684 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +1042 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +152 -0
- package/src/renderers/common/nodes/NodeLibrary.js +196 -0
- package/src/renderers/common/nodes/NodeManager.js +983 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
- package/src/renderers/common/nodes/NodeSampler.js +62 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +72 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +105 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +125 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
- package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
- package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +213 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +44 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +216 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +161 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +656 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +376 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
- package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.js +272 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +224 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
- package/src/renderers/shaders/ShaderLib.js +362 -0
- package/src/renderers/shaders/UniformsLib.js +234 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.js +666 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.js +150 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.js +186 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.js +584 -0
- package/src/renderers/webgl/WebGLMaterials.js +602 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +1031 -0
- package/src/renderers/webgl/WebGLPrograms.js +679 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.js +253 -0
- package/src/renderers/webgl/WebGLRenderStates.js +124 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +124 -0
- package/src/renderers/webgl/WebGLShadowMap.js +600 -0
- package/src/renderers/webgl/WebGLState.js +1370 -0
- package/src/renderers/webgl/WebGLTextures.js +2506 -0
- package/src/renderers/webgl/WebGLUniforms.js +1203 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +413 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2783 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1676 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +89 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1361 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1324 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +317 -0
- package/src/renderers/webgpu/WebGPUBackend.js +2602 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +100 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2523 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +187 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +522 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +642 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +846 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +389 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1673 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +269 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.js +1103 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.js +89 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.js +112 -0
- package/src/textures/DataArrayTexture.js +134 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +85 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +230 -0
- package/src/textures/Texture.js +812 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,1330 @@
|
|
|
1
|
+
import { Material } from '../Material.js';
|
|
2
|
+
|
|
3
|
+
import { hashArray, hashString } from '../../nodes/core/NodeUtils.js';
|
|
4
|
+
import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js';
|
|
5
|
+
import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAO } from '../../nodes/accessors/MaterialNode.js';
|
|
6
|
+
import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
|
|
7
|
+
import { normalLocal } from '../../nodes/accessors/Normal.js';
|
|
8
|
+
import { instancedMesh } from '../../nodes/accessors/InstancedMeshNode.js';
|
|
9
|
+
import { batch } from '../../nodes/accessors/BatchNode.js';
|
|
10
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
11
|
+
import { positionLocal, positionView } from '../../nodes/accessors/Position.js';
|
|
12
|
+
import { skinning } from '../../nodes/accessors/SkinningNode.js';
|
|
13
|
+
import { morphReference } from '../../nodes/accessors/MorphNode.js';
|
|
14
|
+
import { fwidth, mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
15
|
+
import { float, vec3, vec4, bool } from '../../nodes/tsl/TSLBase.js';
|
|
16
|
+
import AONode from '../../nodes/lighting/AONode.js';
|
|
17
|
+
import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
|
|
18
|
+
import IrradianceNode from '../../nodes/lighting/IrradianceNode.js';
|
|
19
|
+
import { depth, viewZToLogarithmicDepth, viewZToOrthographicDepth } from '../../nodes/display/ViewportDepthNode.js';
|
|
20
|
+
import { cameraFar, cameraNear, cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
21
|
+
import { clipping, clippingAlpha, hardwareClipping } from '../../nodes/accessors/ClippingNode.js';
|
|
22
|
+
import NodeMaterialObserver from './manager/NodeMaterialObserver.js';
|
|
23
|
+
import getAlphaHashThreshold from '../../nodes/functions/material/getAlphaHashThreshold.js';
|
|
24
|
+
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
25
|
+
import { vertexColor } from '../../nodes/accessors/VertexColorNode.js';
|
|
26
|
+
import { premultiplyAlpha } from '../../nodes/display/BlendModes.js';
|
|
27
|
+
import { subBuild } from '../../nodes/core/SubBuildNode.js';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Base class for all node materials.
|
|
31
|
+
*
|
|
32
|
+
* @augments Material
|
|
33
|
+
*/
|
|
34
|
+
class NodeMaterial extends Material {
|
|
35
|
+
|
|
36
|
+
static get type() {
|
|
37
|
+
|
|
38
|
+
return 'NodeMaterial';
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Represents the type of the node material.
|
|
44
|
+
*
|
|
45
|
+
* @type {string}
|
|
46
|
+
*/
|
|
47
|
+
get type() {
|
|
48
|
+
|
|
49
|
+
return this.constructor.type;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set type( _value ) { /* */ }
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Constructs a new node material.
|
|
57
|
+
*/
|
|
58
|
+
constructor() {
|
|
59
|
+
|
|
60
|
+
super();
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* This flag can be used for type testing.
|
|
64
|
+
*
|
|
65
|
+
* @type {boolean}
|
|
66
|
+
* @readonly
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
this.isNodeMaterial = true;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Whether this material is affected by fog or not.
|
|
73
|
+
*
|
|
74
|
+
* @type {boolean}
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
this.fog = true;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether this material is affected by lights or not.
|
|
81
|
+
*
|
|
82
|
+
* @type {boolean}
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
this.lights = false;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Whether this material uses hardware clipping or not.
|
|
89
|
+
* This property is managed by the engine and should not be
|
|
90
|
+
* modified by apps.
|
|
91
|
+
*
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
this.hardwareClipping = false;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Node materials which set their `lights` property to `true`
|
|
99
|
+
* are affected by all lights of the scene. Sometimes selective
|
|
100
|
+
* lighting is wanted which means only _some_ lights in the scene
|
|
101
|
+
* affect a material. This can be achieved by creating an instance
|
|
102
|
+
* of {@link LightsNode} with a list of selective
|
|
103
|
+
* lights and assign the node to this property.
|
|
104
|
+
*
|
|
105
|
+
* ```js
|
|
106
|
+
* const customLightsNode = lights( [ light1, light2 ] );
|
|
107
|
+
* material.lightsNode = customLightsNode;
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @type {?LightsNode}
|
|
111
|
+
* @default null
|
|
112
|
+
*/
|
|
113
|
+
this.lightsNode = null;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The environment of node materials can be defined by an environment
|
|
117
|
+
* map assigned to the `envMap` property or by `Scene.environment`
|
|
118
|
+
* if the node material is a PBR material. This node property allows to overwrite
|
|
119
|
+
* the default behavior and define the environment with a custom node.
|
|
120
|
+
*
|
|
121
|
+
* ```js
|
|
122
|
+
* material.envNode = pmremTexture( renderTarget.texture );
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @type {?Node<vec3>}
|
|
126
|
+
* @default null
|
|
127
|
+
*/
|
|
128
|
+
this.envNode = null;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The lighting of node materials might be influenced by ambient occlusion.
|
|
132
|
+
* The default AO is inferred from an ambient occlusion map assigned to `aoMap`
|
|
133
|
+
* and the respective `aoMapIntensity`. This node property allows to overwrite
|
|
134
|
+
* the default and define the ambient occlusion with a custom node instead.
|
|
135
|
+
*
|
|
136
|
+
* If you don't want to overwrite the diffuse color but modify the existing
|
|
137
|
+
* values instead, use {@link materialAO}.
|
|
138
|
+
*
|
|
139
|
+
* @type {?Node<float>}
|
|
140
|
+
* @default null
|
|
141
|
+
*/
|
|
142
|
+
this.aoNode = null;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The diffuse color of node materials is by default inferred from the
|
|
146
|
+
* `color` and `map` properties. This node property allows to overwrite the default
|
|
147
|
+
* and define the diffuse color with a node instead.
|
|
148
|
+
*
|
|
149
|
+
* ```js
|
|
150
|
+
* material.colorNode = color( 0xff0000 ); // define red color
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* If you don't want to overwrite the diffuse color but modify the existing
|
|
154
|
+
* values instead, use {@link materialColor}.
|
|
155
|
+
*
|
|
156
|
+
* ```js
|
|
157
|
+
* material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @type {?Node<vec3>}
|
|
161
|
+
* @default null
|
|
162
|
+
*/
|
|
163
|
+
this.colorNode = null;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The normals of node materials are by default inferred from the `normalMap`/`normalScale`
|
|
167
|
+
* or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default
|
|
168
|
+
* and define the normals with a node instead.
|
|
169
|
+
*
|
|
170
|
+
* If you don't want to overwrite the normals but modify the existing values instead,
|
|
171
|
+
* use {@link materialNormal}.
|
|
172
|
+
*
|
|
173
|
+
* @type {?Node<vec3>}
|
|
174
|
+
* @default null
|
|
175
|
+
*/
|
|
176
|
+
this.normalNode = null;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The opacity of node materials is by default inferred from the `opacity`
|
|
180
|
+
* and `alphaMap` properties. This node property allows to overwrite the default
|
|
181
|
+
* and define the opacity with a node instead.
|
|
182
|
+
*
|
|
183
|
+
* If you don't want to overwrite the opacity but modify the existing
|
|
184
|
+
* value instead, use {@link materialOpacity}.
|
|
185
|
+
*
|
|
186
|
+
* @type {?Node<float>}
|
|
187
|
+
* @default null
|
|
188
|
+
*/
|
|
189
|
+
this.opacityNode = null;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* This node can be used to implement a variety of filter-like effects. The idea is
|
|
193
|
+
* to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it
|
|
194
|
+
* to create an arbitrary effect and then assign the node composition to this property.
|
|
195
|
+
* Everything behind the object using this material will now be affected by a filter.
|
|
196
|
+
*
|
|
197
|
+
* ```js
|
|
198
|
+
* const material = new NodeMaterial()
|
|
199
|
+
* material.transparent = true;
|
|
200
|
+
*
|
|
201
|
+
* // everything behind the object will be monochromatic
|
|
202
|
+
* material.backdropNode = saturation( viewportSharedTexture().rgb, 0 );
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* Backdrop computations are part of the lighting so only lit materials can use this property.
|
|
206
|
+
*
|
|
207
|
+
* @type {?Node<vec3>}
|
|
208
|
+
* @default null
|
|
209
|
+
*/
|
|
210
|
+
this.backdropNode = null;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* This node allows to modulate the influence of `backdropNode` to the outgoing light.
|
|
214
|
+
*
|
|
215
|
+
* @type {?Node<float>}
|
|
216
|
+
* @default null
|
|
217
|
+
*/
|
|
218
|
+
this.backdropAlphaNode = null;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* The alpha test of node materials is by default inferred from the `alphaTest`
|
|
222
|
+
* property. This node property allows to overwrite the default and define the
|
|
223
|
+
* alpha test with a node instead.
|
|
224
|
+
*
|
|
225
|
+
* If you don't want to overwrite the alpha test but modify the existing
|
|
226
|
+
* value instead, use {@link materialAlphaTest}.
|
|
227
|
+
*
|
|
228
|
+
* @type {?Node<float>}
|
|
229
|
+
* @default null
|
|
230
|
+
*/
|
|
231
|
+
this.alphaTestNode = null;
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Discards the fragment if the mask value is `false`.
|
|
236
|
+
*
|
|
237
|
+
* @type {?Node<bool>}
|
|
238
|
+
* @default null
|
|
239
|
+
*/
|
|
240
|
+
this.maskNode = null;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* This node can be used to implement a shadow mask for the material.
|
|
244
|
+
*
|
|
245
|
+
* @type {?Node<bool>}
|
|
246
|
+
* @default null
|
|
247
|
+
*/
|
|
248
|
+
this.maskShadowNode = null;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The local vertex positions are computed based on multiple factors like the
|
|
252
|
+
* attribute data, morphing or skinning. This node property allows to overwrite
|
|
253
|
+
* the default and define local vertex positions with nodes instead.
|
|
254
|
+
*
|
|
255
|
+
* If you don't want to overwrite the vertex positions but modify the existing
|
|
256
|
+
* values instead, use {@link positionLocal}.
|
|
257
|
+
*
|
|
258
|
+
*```js
|
|
259
|
+
* material.positionNode = positionLocal.add( displace );
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @type {?Node<vec3>}
|
|
263
|
+
* @default null
|
|
264
|
+
*/
|
|
265
|
+
this.positionNode = null;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* This node property is intended for logic which modifies geometry data once or per animation step.
|
|
269
|
+
* Apps usually place such logic randomly in initialization routines or in the animation loop.
|
|
270
|
+
* `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications
|
|
271
|
+
* can be implemented.
|
|
272
|
+
*
|
|
273
|
+
* The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example
|
|
274
|
+
* would be a GPU based particle system that provides a node material for usage on app level. The particle
|
|
275
|
+
* simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is
|
|
276
|
+
* eventually assigned to `geometryNode`.
|
|
277
|
+
*
|
|
278
|
+
* @type {?Function}
|
|
279
|
+
* @default null
|
|
280
|
+
*/
|
|
281
|
+
this.geometryNode = null;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Allows to overwrite depth values in the fragment shader.
|
|
285
|
+
*
|
|
286
|
+
* @type {?Node<float>}
|
|
287
|
+
* @default null
|
|
288
|
+
*/
|
|
289
|
+
this.depthNode = null;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Allows to overwrite the position used for shadow map rendering which
|
|
293
|
+
* is by default {@link positionWorld}, the vertex position
|
|
294
|
+
* in world space.
|
|
295
|
+
*
|
|
296
|
+
* @type {?Node<float>}
|
|
297
|
+
* @default null
|
|
298
|
+
*/
|
|
299
|
+
this.receivedShadowPositionNode = null;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Allows to overwrite the geometry position used for shadow map projection which
|
|
303
|
+
* is by default {@link positionLocal}, the vertex position in local space.
|
|
304
|
+
*
|
|
305
|
+
* @type {?Node<float>}
|
|
306
|
+
* @default null
|
|
307
|
+
*/
|
|
308
|
+
this.castShadowPositionNode = null;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* This node can be used to influence how an object using this node material
|
|
312
|
+
* receive shadows.
|
|
313
|
+
*
|
|
314
|
+
* ```js
|
|
315
|
+
* const totalShadows = float( 1 ).toVar();
|
|
316
|
+
* material.receivedShadowNode = Fn( ( [ shadow ] ) => {
|
|
317
|
+
* totalShadows.mulAssign( shadow );
|
|
318
|
+
* //return float( 1 ); // bypass received shadows
|
|
319
|
+
* return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color
|
|
320
|
+
* } );
|
|
321
|
+
*
|
|
322
|
+
* @type {?(Function|FunctionNode<vec4>)}
|
|
323
|
+
* @default null
|
|
324
|
+
*/
|
|
325
|
+
this.receivedShadowNode = null;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* This node can be used to influence how an object using this node material
|
|
329
|
+
* casts shadows. To apply a color to shadows, you can simply do:
|
|
330
|
+
*
|
|
331
|
+
* ```js
|
|
332
|
+
* material.castShadowNode = vec4( 1, 0, 0, 1 );
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* Which can be nice to fake colored shadows of semi-transparent objects. It
|
|
336
|
+
* is also common to use the property with `Fn` function so checks are performed
|
|
337
|
+
* per fragment.
|
|
338
|
+
*
|
|
339
|
+
* ```js
|
|
340
|
+
* materialCustomShadow.castShadowNode = Fn( () => {
|
|
341
|
+
* hash( vertexIndex ).greaterThan( 0.5 ).discard();
|
|
342
|
+
* return materialColor;
|
|
343
|
+
* } )();
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* @type {?Node<vec4>}
|
|
347
|
+
* @default null
|
|
348
|
+
*/
|
|
349
|
+
this.castShadowNode = null;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* This node can be used to define the final output of the material.
|
|
353
|
+
*
|
|
354
|
+
* TODO: Explain the differences to `fragmentNode`.
|
|
355
|
+
*
|
|
356
|
+
* @type {?Node<vec4>}
|
|
357
|
+
* @default null
|
|
358
|
+
*/
|
|
359
|
+
this.outputNode = null;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* MRT configuration is done on renderer or pass level. This node allows to
|
|
363
|
+
* overwrite what values are written into MRT targets on material level. This
|
|
364
|
+
* can be useful for implementing selective FX features that should only affect
|
|
365
|
+
* specific objects.
|
|
366
|
+
*
|
|
367
|
+
* @type {?MRTNode}
|
|
368
|
+
* @default null
|
|
369
|
+
*/
|
|
370
|
+
this.mrtNode = null;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* This node property can be used if you need complete freedom in implementing
|
|
374
|
+
* the fragment shader. Assigning a node will replace the built-in material
|
|
375
|
+
* logic used in the fragment stage.
|
|
376
|
+
*
|
|
377
|
+
* @type {?Node<vec4>}
|
|
378
|
+
* @default null
|
|
379
|
+
*/
|
|
380
|
+
this.fragmentNode = null;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* This node property can be used if you need complete freedom in implementing
|
|
384
|
+
* the vertex shader. Assigning a node will replace the built-in material logic
|
|
385
|
+
* used in the vertex stage.
|
|
386
|
+
*
|
|
387
|
+
* @type {?Node<vec4>}
|
|
388
|
+
* @default null
|
|
389
|
+
*/
|
|
390
|
+
this.vertexNode = null;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* This node can be used as a global context management component for this material.
|
|
394
|
+
*
|
|
395
|
+
* @type {?ContextNode}
|
|
396
|
+
* @default null
|
|
397
|
+
*/
|
|
398
|
+
this.contextNode = null;
|
|
399
|
+
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Returns an array of child nodes for this material.
|
|
404
|
+
*
|
|
405
|
+
* @private
|
|
406
|
+
* @returns {Array<{property: string, childNode: Node}>}
|
|
407
|
+
*/
|
|
408
|
+
_getNodeChildren() {
|
|
409
|
+
|
|
410
|
+
const children = [];
|
|
411
|
+
|
|
412
|
+
for ( const property of Object.getOwnPropertyNames( this ) ) {
|
|
413
|
+
|
|
414
|
+
if ( property.startsWith( '_' ) === true ) continue;
|
|
415
|
+
|
|
416
|
+
const object = this[ property ];
|
|
417
|
+
|
|
418
|
+
if ( object && object.isNode === true ) {
|
|
419
|
+
|
|
420
|
+
children.push( { property, childNode: object } );
|
|
421
|
+
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return children;
|
|
427
|
+
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Allows to define a custom cache key that influence the material key computation
|
|
432
|
+
* for render objects.
|
|
433
|
+
*
|
|
434
|
+
* @return {string} The custom cache key.
|
|
435
|
+
*/
|
|
436
|
+
customProgramCacheKey() {
|
|
437
|
+
|
|
438
|
+
const values = [];
|
|
439
|
+
|
|
440
|
+
for ( const { property, childNode } of this._getNodeChildren() ) {
|
|
441
|
+
|
|
442
|
+
values.push( hashString( property.slice( 0, - 4 ) ), childNode.getCacheKey() );
|
|
443
|
+
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return this.type + hashArray( values );
|
|
447
|
+
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Builds this material with the given node builder.
|
|
452
|
+
*
|
|
453
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
454
|
+
*/
|
|
455
|
+
build( builder ) {
|
|
456
|
+
|
|
457
|
+
this.setup( builder );
|
|
458
|
+
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Setups a node material observer with the given builder.
|
|
463
|
+
*
|
|
464
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
465
|
+
* @return {NodeMaterialObserver} The node material observer.
|
|
466
|
+
*/
|
|
467
|
+
setupObserver( builder ) {
|
|
468
|
+
|
|
469
|
+
return new NodeMaterialObserver( builder );
|
|
470
|
+
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Setups the vertex and fragment stage of this node material.
|
|
475
|
+
*
|
|
476
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
477
|
+
*/
|
|
478
|
+
setup( builder ) {
|
|
479
|
+
|
|
480
|
+
builder.context.setupNormal = () => subBuild( this.setupNormal( builder ), 'NORMAL', 'vec3' );
|
|
481
|
+
builder.context.setupPositionView = () => this.setupPositionView( builder );
|
|
482
|
+
builder.context.setupModelViewProjection = () => this.setupModelViewProjection( builder );
|
|
483
|
+
|
|
484
|
+
const renderer = builder.renderer;
|
|
485
|
+
const renderTarget = renderer.getRenderTarget();
|
|
486
|
+
|
|
487
|
+
// < VERTEX STAGE >
|
|
488
|
+
|
|
489
|
+
builder.addStack();
|
|
490
|
+
|
|
491
|
+
const mvp = this.setupVertex( builder );
|
|
492
|
+
|
|
493
|
+
const vertexNode = subBuild( this.vertexNode || mvp, 'VERTEX' );
|
|
494
|
+
|
|
495
|
+
builder.context.clipSpace = vertexNode;
|
|
496
|
+
|
|
497
|
+
builder.stack.outputNode = vertexNode;
|
|
498
|
+
|
|
499
|
+
this.setupHardwareClipping( builder );
|
|
500
|
+
|
|
501
|
+
if ( this.geometryNode !== null ) {
|
|
502
|
+
|
|
503
|
+
builder.stack.outputNode = builder.stack.outputNode.bypass( this.geometryNode );
|
|
504
|
+
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
builder.addFlow( 'vertex', builder.removeStack() );
|
|
508
|
+
|
|
509
|
+
// < FRAGMENT STAGE >
|
|
510
|
+
|
|
511
|
+
builder.addStack();
|
|
512
|
+
|
|
513
|
+
let resultNode;
|
|
514
|
+
|
|
515
|
+
const clippingNode = this.setupClipping( builder );
|
|
516
|
+
|
|
517
|
+
if ( this.depthWrite === true || this.depthTest === true ) {
|
|
518
|
+
|
|
519
|
+
// only write depth if depth buffer is configured
|
|
520
|
+
|
|
521
|
+
if ( renderTarget !== null ) {
|
|
522
|
+
|
|
523
|
+
if ( renderTarget.depthBuffer === true ) this.setupDepth( builder );
|
|
524
|
+
|
|
525
|
+
} else {
|
|
526
|
+
|
|
527
|
+
if ( renderer.depth === true ) this.setupDepth( builder );
|
|
528
|
+
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if ( this.fragmentNode === null ) {
|
|
534
|
+
|
|
535
|
+
this.setupDiffuseColor( builder );
|
|
536
|
+
this.setupVariants( builder );
|
|
537
|
+
|
|
538
|
+
const outgoingLightNode = this.setupLighting( builder );
|
|
539
|
+
|
|
540
|
+
if ( clippingNode !== null ) builder.stack.addToStack( clippingNode );
|
|
541
|
+
|
|
542
|
+
// force unsigned floats - useful for RenderTargets
|
|
543
|
+
|
|
544
|
+
const basicOutput = vec4( outgoingLightNode, diffuseColor.a ).max( 0 );
|
|
545
|
+
|
|
546
|
+
resultNode = this.setupOutput( builder, basicOutput );
|
|
547
|
+
|
|
548
|
+
// OUTPUT NODE
|
|
549
|
+
|
|
550
|
+
output.assign( resultNode );
|
|
551
|
+
|
|
552
|
+
//
|
|
553
|
+
|
|
554
|
+
const isCustomOutput = this.outputNode !== null;
|
|
555
|
+
|
|
556
|
+
if ( isCustomOutput ) resultNode = this.outputNode;
|
|
557
|
+
|
|
558
|
+
//
|
|
559
|
+
|
|
560
|
+
if ( builder.context.getOutput ) {
|
|
561
|
+
|
|
562
|
+
resultNode = builder.context.getOutput( resultNode, builder );
|
|
563
|
+
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// MRT
|
|
567
|
+
|
|
568
|
+
if ( renderTarget !== null ) {
|
|
569
|
+
|
|
570
|
+
const mrt = renderer.getMRT();
|
|
571
|
+
const materialMRT = this.mrtNode;
|
|
572
|
+
|
|
573
|
+
if ( mrt !== null ) {
|
|
574
|
+
|
|
575
|
+
if ( isCustomOutput ) output.assign( resultNode );
|
|
576
|
+
|
|
577
|
+
resultNode = mrt;
|
|
578
|
+
|
|
579
|
+
if ( materialMRT !== null ) {
|
|
580
|
+
|
|
581
|
+
resultNode = mrt.merge( materialMRT );
|
|
582
|
+
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
} else if ( materialMRT !== null ) {
|
|
586
|
+
|
|
587
|
+
resultNode = materialMRT;
|
|
588
|
+
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
} else {
|
|
594
|
+
|
|
595
|
+
let fragmentNode = this.fragmentNode;
|
|
596
|
+
|
|
597
|
+
if ( fragmentNode.isOutputStructNode !== true ) {
|
|
598
|
+
|
|
599
|
+
fragmentNode = vec4( fragmentNode );
|
|
600
|
+
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
resultNode = this.setupOutput( builder, fragmentNode );
|
|
604
|
+
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
builder.stack.outputNode = resultNode;
|
|
608
|
+
|
|
609
|
+
builder.addFlow( 'fragment', builder.removeStack() );
|
|
610
|
+
|
|
611
|
+
// < OBSERVER >
|
|
612
|
+
|
|
613
|
+
builder.observer = this.setupObserver( builder );
|
|
614
|
+
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Setups the clipping node.
|
|
619
|
+
*
|
|
620
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
621
|
+
* @return {ClippingNode} The clipping node.
|
|
622
|
+
*/
|
|
623
|
+
setupClipping( builder ) {
|
|
624
|
+
|
|
625
|
+
if ( builder.clippingContext === null ) return null;
|
|
626
|
+
|
|
627
|
+
const { unionPlanes, intersectionPlanes } = builder.clippingContext;
|
|
628
|
+
|
|
629
|
+
let result = null;
|
|
630
|
+
|
|
631
|
+
if ( unionPlanes.length > 0 || intersectionPlanes.length > 0 ) {
|
|
632
|
+
|
|
633
|
+
const samples = builder.renderer.currentSamples;
|
|
634
|
+
|
|
635
|
+
if ( this.alphaToCoverage && samples > 1 ) {
|
|
636
|
+
|
|
637
|
+
// to be added to flow when the color/alpha value has been determined
|
|
638
|
+
result = clippingAlpha();
|
|
639
|
+
|
|
640
|
+
} else {
|
|
641
|
+
|
|
642
|
+
builder.stack.addToStack( clipping() );
|
|
643
|
+
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return result;
|
|
649
|
+
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Setups the hardware clipping if available on the current device.
|
|
654
|
+
*
|
|
655
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
656
|
+
*/
|
|
657
|
+
setupHardwareClipping( builder ) {
|
|
658
|
+
|
|
659
|
+
this.hardwareClipping = false;
|
|
660
|
+
|
|
661
|
+
if ( builder.clippingContext === null ) return;
|
|
662
|
+
|
|
663
|
+
const candidateCount = builder.clippingContext.unionPlanes.length;
|
|
664
|
+
|
|
665
|
+
// 8 planes supported by WebGL ANGLE_clip_cull_distance and WebGPU clip-distances
|
|
666
|
+
|
|
667
|
+
if ( candidateCount > 0 && candidateCount <= 8 && builder.isAvailable( 'clipDistance' ) ) {
|
|
668
|
+
|
|
669
|
+
builder.stack.addToStack( hardwareClipping() );
|
|
670
|
+
|
|
671
|
+
this.hardwareClipping = true;
|
|
672
|
+
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return;
|
|
676
|
+
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Setups the depth of this material.
|
|
681
|
+
*
|
|
682
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
683
|
+
*/
|
|
684
|
+
setupDepth( builder ) {
|
|
685
|
+
|
|
686
|
+
const { renderer, camera } = builder;
|
|
687
|
+
|
|
688
|
+
// Depth
|
|
689
|
+
|
|
690
|
+
let depthNode = this.depthNode;
|
|
691
|
+
|
|
692
|
+
if ( depthNode === null ) {
|
|
693
|
+
|
|
694
|
+
const mrt = renderer.getMRT();
|
|
695
|
+
|
|
696
|
+
if ( mrt && mrt.has( 'depth' ) ) {
|
|
697
|
+
|
|
698
|
+
depthNode = mrt.get( 'depth' );
|
|
699
|
+
|
|
700
|
+
} else if ( renderer.logarithmicDepthBuffer === true ) {
|
|
701
|
+
|
|
702
|
+
if ( camera.isPerspectiveCamera ) {
|
|
703
|
+
|
|
704
|
+
depthNode = viewZToLogarithmicDepth( positionView.z, cameraNear, cameraFar );
|
|
705
|
+
|
|
706
|
+
} else {
|
|
707
|
+
|
|
708
|
+
depthNode = viewZToOrthographicDepth( positionView.z, cameraNear, cameraFar );
|
|
709
|
+
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if ( depthNode !== null ) {
|
|
717
|
+
|
|
718
|
+
depth.assign( depthNode ).toStack();
|
|
719
|
+
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Setups the position node in view space. This method exists
|
|
726
|
+
* so derived node materials can modify the implementation e.g. sprite materials.
|
|
727
|
+
*
|
|
728
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
729
|
+
* @return {Node<vec3>} The position in view space.
|
|
730
|
+
*/
|
|
731
|
+
setupPositionView( /*builder*/ ) {
|
|
732
|
+
|
|
733
|
+
return modelViewMatrix.mul( positionLocal ).xyz;
|
|
734
|
+
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Setups the position in clip space.
|
|
739
|
+
*
|
|
740
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
741
|
+
* @return {Node<vec4>} The position in view space.
|
|
742
|
+
*/
|
|
743
|
+
setupModelViewProjection( /*builder*/ ) {
|
|
744
|
+
|
|
745
|
+
return cameraProjectionMatrix.mul( positionView );
|
|
746
|
+
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Setups the logic for the vertex stage.
|
|
751
|
+
*
|
|
752
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
753
|
+
* @return {Node<vec4>} The position in clip space.
|
|
754
|
+
*/
|
|
755
|
+
setupVertex( builder ) {
|
|
756
|
+
|
|
757
|
+
builder.addStack();
|
|
758
|
+
|
|
759
|
+
this.setupPosition( builder );
|
|
760
|
+
|
|
761
|
+
builder.context.position = builder.removeStack();
|
|
762
|
+
|
|
763
|
+
return modelViewProjection;
|
|
764
|
+
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Setups the computation of the position in local space.
|
|
769
|
+
*
|
|
770
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
771
|
+
* @return {Node<vec3>} The position in local space.
|
|
772
|
+
*/
|
|
773
|
+
setupPosition( builder ) {
|
|
774
|
+
|
|
775
|
+
const { object, geometry } = builder;
|
|
776
|
+
|
|
777
|
+
if ( geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color ) {
|
|
778
|
+
|
|
779
|
+
morphReference( object ).toStack();
|
|
780
|
+
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
if ( object.isSkinnedMesh === true ) {
|
|
784
|
+
|
|
785
|
+
skinning( object ).toStack();
|
|
786
|
+
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if ( this.displacementMap ) {
|
|
790
|
+
|
|
791
|
+
const displacementMap = materialReference( 'displacementMap', 'texture' );
|
|
792
|
+
const displacementScale = materialReference( 'displacementScale', 'float' );
|
|
793
|
+
const displacementBias = materialReference( 'displacementBias', 'float' );
|
|
794
|
+
|
|
795
|
+
positionLocal.addAssign( normalLocal.normalize().mul( ( displacementMap.x.mul( displacementScale ).add( displacementBias ) ) ) );
|
|
796
|
+
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
if ( object.isBatchedMesh ) {
|
|
800
|
+
|
|
801
|
+
batch( object ).toStack();
|
|
802
|
+
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
if ( ( object.isInstancedMesh && object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true ) ) {
|
|
806
|
+
|
|
807
|
+
instancedMesh( object ).toStack();
|
|
808
|
+
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
if ( this.positionNode !== null ) {
|
|
812
|
+
|
|
813
|
+
positionLocal.assign( subBuild( this.positionNode, 'POSITION', 'vec3' ) );
|
|
814
|
+
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return positionLocal;
|
|
818
|
+
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Setups the computation of the material's diffuse color.
|
|
823
|
+
*
|
|
824
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
825
|
+
* @param {BufferGeometry} geometry - The geometry.
|
|
826
|
+
*/
|
|
827
|
+
setupDiffuseColor( builder ) {
|
|
828
|
+
|
|
829
|
+
const { object, geometry } = builder;
|
|
830
|
+
|
|
831
|
+
// MASK
|
|
832
|
+
|
|
833
|
+
if ( this.maskNode !== null ) {
|
|
834
|
+
|
|
835
|
+
// Discard if the mask is `false`
|
|
836
|
+
|
|
837
|
+
bool( this.maskNode ).not().discard();
|
|
838
|
+
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// COLOR
|
|
842
|
+
|
|
843
|
+
let colorNode = this.colorNode ? vec4( this.colorNode ) : materialColor;
|
|
844
|
+
|
|
845
|
+
// VERTEX COLORS
|
|
846
|
+
|
|
847
|
+
if ( this.vertexColors === true && geometry.hasAttribute( 'color' ) ) {
|
|
848
|
+
|
|
849
|
+
colorNode = colorNode.mul( vertexColor() );
|
|
850
|
+
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// INSTANCED COLORS
|
|
854
|
+
|
|
855
|
+
if ( object.instanceColor ) {
|
|
856
|
+
|
|
857
|
+
const instanceColor = varyingProperty( 'vec3', 'vInstanceColor' );
|
|
858
|
+
|
|
859
|
+
colorNode = instanceColor.mul( colorNode );
|
|
860
|
+
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
if ( object.isBatchedMesh && object._colorsTexture ) {
|
|
864
|
+
|
|
865
|
+
const batchColor = varyingProperty( 'vec3', 'vBatchColor' );
|
|
866
|
+
|
|
867
|
+
colorNode = batchColor.mul( colorNode );
|
|
868
|
+
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// DIFFUSE COLOR
|
|
872
|
+
|
|
873
|
+
diffuseColor.assign( colorNode );
|
|
874
|
+
|
|
875
|
+
// OPACITY
|
|
876
|
+
|
|
877
|
+
const opacityNode = this.opacityNode ? float( this.opacityNode ) : materialOpacity;
|
|
878
|
+
diffuseColor.a.assign( diffuseColor.a.mul( opacityNode ) );
|
|
879
|
+
|
|
880
|
+
// ALPHA TEST
|
|
881
|
+
|
|
882
|
+
let alphaTestNode = null;
|
|
883
|
+
|
|
884
|
+
if ( this.alphaTestNode !== null || this.alphaTest > 0 ) {
|
|
885
|
+
|
|
886
|
+
alphaTestNode = this.alphaTestNode !== null ? float( this.alphaTestNode ) : materialAlphaTest;
|
|
887
|
+
|
|
888
|
+
if ( this.alphaToCoverage === true ) {
|
|
889
|
+
|
|
890
|
+
diffuseColor.a = smoothstep( alphaTestNode, alphaTestNode.add( fwidth( diffuseColor.a ) ), diffuseColor.a );
|
|
891
|
+
diffuseColor.a.lessThanEqual( 0 ).discard();
|
|
892
|
+
|
|
893
|
+
} else {
|
|
894
|
+
|
|
895
|
+
diffuseColor.a.lessThanEqual( alphaTestNode ).discard();
|
|
896
|
+
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// ALPHA HASH
|
|
902
|
+
|
|
903
|
+
if ( this.alphaHash === true ) {
|
|
904
|
+
|
|
905
|
+
diffuseColor.a.lessThan( getAlphaHashThreshold( positionLocal ) ).discard();
|
|
906
|
+
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// OPAQUE
|
|
910
|
+
|
|
911
|
+
if ( builder.isOpaque() ) {
|
|
912
|
+
|
|
913
|
+
diffuseColor.a.assign( 1.0 );
|
|
914
|
+
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Abstract interface method that can be implemented by derived materials
|
|
921
|
+
* to setup material-specific node variables.
|
|
922
|
+
*
|
|
923
|
+
* @abstract
|
|
924
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
925
|
+
*/
|
|
926
|
+
setupVariants( /*builder*/ ) {
|
|
927
|
+
|
|
928
|
+
// Interface function.
|
|
929
|
+
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Setups the outgoing light node variable
|
|
934
|
+
*
|
|
935
|
+
* @return {Node<vec3>} The outgoing light node.
|
|
936
|
+
*/
|
|
937
|
+
setupOutgoingLight() {
|
|
938
|
+
|
|
939
|
+
return ( this.lights === true ) ? vec3( 0 ) : diffuseColor.rgb;
|
|
940
|
+
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Setups the normal node from the material.
|
|
945
|
+
*
|
|
946
|
+
* @return {Node<vec3>} The normal node.
|
|
947
|
+
*/
|
|
948
|
+
setupNormal() {
|
|
949
|
+
|
|
950
|
+
return this.normalNode ? vec3( this.normalNode ) : materialNormal;
|
|
951
|
+
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Setups the environment node from the material.
|
|
956
|
+
*
|
|
957
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
958
|
+
* @return {Node<vec4>} The environment node.
|
|
959
|
+
*/
|
|
960
|
+
setupEnvironment( /*builder*/ ) {
|
|
961
|
+
|
|
962
|
+
let node = null;
|
|
963
|
+
|
|
964
|
+
if ( this.envNode ) {
|
|
965
|
+
|
|
966
|
+
node = this.envNode;
|
|
967
|
+
|
|
968
|
+
} else if ( this.envMap ) {
|
|
969
|
+
|
|
970
|
+
node = this.envMap.isCubeTexture ? materialReference( 'envMap', 'cubeTexture' ) : materialReference( 'envMap', 'texture' );
|
|
971
|
+
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
return node;
|
|
975
|
+
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Setups the light map node from the material.
|
|
980
|
+
*
|
|
981
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
982
|
+
* @return {Node<vec3>} The light map node.
|
|
983
|
+
*/
|
|
984
|
+
setupLightMap( builder ) {
|
|
985
|
+
|
|
986
|
+
let node = null;
|
|
987
|
+
|
|
988
|
+
if ( builder.material.lightMap ) {
|
|
989
|
+
|
|
990
|
+
node = new IrradianceNode( materialLightMap );
|
|
991
|
+
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
return node;
|
|
995
|
+
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Setups the lights node based on the scene, environment and material.
|
|
1000
|
+
*
|
|
1001
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1002
|
+
* @return {LightsNode} The lights node.
|
|
1003
|
+
*/
|
|
1004
|
+
setupLights( builder ) {
|
|
1005
|
+
|
|
1006
|
+
const materialLightsNode = [];
|
|
1007
|
+
|
|
1008
|
+
//
|
|
1009
|
+
|
|
1010
|
+
const envNode = this.setupEnvironment( builder );
|
|
1011
|
+
|
|
1012
|
+
if ( envNode && envNode.isLightingNode ) {
|
|
1013
|
+
|
|
1014
|
+
materialLightsNode.push( envNode );
|
|
1015
|
+
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
const lightMapNode = this.setupLightMap( builder );
|
|
1019
|
+
|
|
1020
|
+
if ( lightMapNode && lightMapNode.isLightingNode ) {
|
|
1021
|
+
|
|
1022
|
+
materialLightsNode.push( lightMapNode );
|
|
1023
|
+
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
let aoNode = this.aoNode;
|
|
1027
|
+
|
|
1028
|
+
if ( aoNode === null && builder.material.aoMap ) {
|
|
1029
|
+
|
|
1030
|
+
aoNode = materialAO;
|
|
1031
|
+
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
if ( builder.context.getAO ) {
|
|
1035
|
+
|
|
1036
|
+
aoNode = builder.context.getAO( aoNode, builder );
|
|
1037
|
+
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
if ( aoNode ) {
|
|
1041
|
+
|
|
1042
|
+
materialLightsNode.push( new AONode( aoNode ) );
|
|
1043
|
+
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
let lightsN = this.lightsNode || builder.lightsNode;
|
|
1047
|
+
|
|
1048
|
+
if ( materialLightsNode.length > 0 ) {
|
|
1049
|
+
|
|
1050
|
+
lightsN = builder.renderer.lighting.createNode( [ ...lightsN.getLights(), ...materialLightsNode ] );
|
|
1051
|
+
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
return lightsN;
|
|
1055
|
+
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* This method should be implemented by most derived materials
|
|
1060
|
+
* since it defines the material's lighting model.
|
|
1061
|
+
*
|
|
1062
|
+
* @abstract
|
|
1063
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1064
|
+
* @return {LightingModel} The lighting model.
|
|
1065
|
+
*/
|
|
1066
|
+
setupLightingModel( /*builder*/ ) {
|
|
1067
|
+
|
|
1068
|
+
// Interface function.
|
|
1069
|
+
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Setups the outgoing light node.
|
|
1074
|
+
*
|
|
1075
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1076
|
+
* @return {Node<vec3>} The outgoing light node.
|
|
1077
|
+
*/
|
|
1078
|
+
setupLighting( builder ) {
|
|
1079
|
+
|
|
1080
|
+
const { material } = builder;
|
|
1081
|
+
const { backdropNode, backdropAlphaNode, emissiveNode } = this;
|
|
1082
|
+
|
|
1083
|
+
// OUTGOING LIGHT
|
|
1084
|
+
|
|
1085
|
+
const lights = this.lights === true || this.lightsNode !== null;
|
|
1086
|
+
|
|
1087
|
+
const lightsNode = lights ? this.setupLights( builder ) : null;
|
|
1088
|
+
|
|
1089
|
+
let outgoingLightNode = this.setupOutgoingLight( builder );
|
|
1090
|
+
|
|
1091
|
+
if ( lightsNode && lightsNode.getScope().hasLights ) {
|
|
1092
|
+
|
|
1093
|
+
const lightingModel = this.setupLightingModel( builder ) || null;
|
|
1094
|
+
|
|
1095
|
+
outgoingLightNode = lightingContext( lightsNode, lightingModel, backdropNode, backdropAlphaNode );
|
|
1096
|
+
|
|
1097
|
+
} else if ( backdropNode !== null ) {
|
|
1098
|
+
|
|
1099
|
+
outgoingLightNode = vec3( backdropAlphaNode !== null ? mix( outgoingLightNode, backdropNode, backdropAlphaNode ) : backdropNode );
|
|
1100
|
+
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// EMISSIVE
|
|
1104
|
+
|
|
1105
|
+
if ( ( emissiveNode && emissiveNode.isNode === true ) || ( material.emissive && material.emissive.isColor === true ) ) {
|
|
1106
|
+
|
|
1107
|
+
emissive.assign( vec3( emissiveNode ? emissiveNode : materialEmissive ) );
|
|
1108
|
+
|
|
1109
|
+
outgoingLightNode = outgoingLightNode.add( emissive );
|
|
1110
|
+
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
return outgoingLightNode;
|
|
1114
|
+
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Setup the fog.
|
|
1119
|
+
*
|
|
1120
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1121
|
+
* @param {Node<vec4>} outputNode - The existing output node.
|
|
1122
|
+
* @return {Node<vec4>} The output node.
|
|
1123
|
+
*/
|
|
1124
|
+
setupFog( builder, outputNode ) {
|
|
1125
|
+
|
|
1126
|
+
const fogNode = builder.fogNode;
|
|
1127
|
+
|
|
1128
|
+
if ( fogNode ) {
|
|
1129
|
+
|
|
1130
|
+
output.assign( outputNode );
|
|
1131
|
+
|
|
1132
|
+
outputNode = vec4( fogNode.toVar() );
|
|
1133
|
+
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return outputNode;
|
|
1137
|
+
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Setups premultiplied alpha.
|
|
1142
|
+
*
|
|
1143
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1144
|
+
* @param {Node<vec4>} outputNode - The existing output node.
|
|
1145
|
+
* @return {Node<vec4>} The output node.
|
|
1146
|
+
*/
|
|
1147
|
+
setupPremultipliedAlpha( builder, outputNode ) {
|
|
1148
|
+
|
|
1149
|
+
return premultiplyAlpha( outputNode );
|
|
1150
|
+
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Setups the output node.
|
|
1155
|
+
*
|
|
1156
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1157
|
+
* @param {Node<vec4>} outputNode - The existing output node.
|
|
1158
|
+
* @return {Node<vec4>} The output node.
|
|
1159
|
+
*/
|
|
1160
|
+
setupOutput( builder, outputNode ) {
|
|
1161
|
+
|
|
1162
|
+
// FOG
|
|
1163
|
+
|
|
1164
|
+
if ( this.fog === true ) {
|
|
1165
|
+
|
|
1166
|
+
outputNode = this.setupFog( builder, outputNode );
|
|
1167
|
+
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
// PREMULTIPLIED ALPHA
|
|
1171
|
+
|
|
1172
|
+
if ( this.premultipliedAlpha === true ) {
|
|
1173
|
+
|
|
1174
|
+
outputNode = this.setupPremultipliedAlpha( builder, outputNode );
|
|
1175
|
+
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
return outputNode;
|
|
1179
|
+
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Most classic material types have a node pendant e.g. for `MeshBasicMaterial`
|
|
1184
|
+
* there is `MeshBasicNodeMaterial`. This utility method is intended for
|
|
1185
|
+
* defining all material properties of the classic type in the node type.
|
|
1186
|
+
*
|
|
1187
|
+
* @param {Material} material - The material to copy properties with their values to this node material.
|
|
1188
|
+
*/
|
|
1189
|
+
setDefaultValues( material ) {
|
|
1190
|
+
|
|
1191
|
+
// This approach is to reuse the native refreshUniforms*
|
|
1192
|
+
// and turn available the use of features like transmission and environment in core
|
|
1193
|
+
|
|
1194
|
+
for ( const property in material ) {
|
|
1195
|
+
|
|
1196
|
+
const value = material[ property ];
|
|
1197
|
+
|
|
1198
|
+
if ( this[ property ] === undefined ) {
|
|
1199
|
+
|
|
1200
|
+
this[ property ] = value;
|
|
1201
|
+
|
|
1202
|
+
if ( value && value.clone ) this[ property ] = value.clone();
|
|
1203
|
+
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
const descriptors = Object.getOwnPropertyDescriptors( material.constructor.prototype );
|
|
1209
|
+
|
|
1210
|
+
for ( const key in descriptors ) {
|
|
1211
|
+
|
|
1212
|
+
if ( Object.getOwnPropertyDescriptor( this.constructor.prototype, key ) === undefined &&
|
|
1213
|
+
descriptors[ key ].get !== undefined ) {
|
|
1214
|
+
|
|
1215
|
+
Object.defineProperty( this.constructor.prototype, key, descriptors[ key ] );
|
|
1216
|
+
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Serializes this material to JSON.
|
|
1225
|
+
*
|
|
1226
|
+
* @param {?(Object|string)} meta - The meta information for serialization.
|
|
1227
|
+
* @return {Object} The serialized node.
|
|
1228
|
+
*/
|
|
1229
|
+
toJSON( meta ) {
|
|
1230
|
+
|
|
1231
|
+
const isRoot = ( meta === undefined || typeof meta === 'string' );
|
|
1232
|
+
|
|
1233
|
+
if ( isRoot ) {
|
|
1234
|
+
|
|
1235
|
+
meta = {
|
|
1236
|
+
textures: {},
|
|
1237
|
+
images: {},
|
|
1238
|
+
nodes: {}
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
const data = Material.prototype.toJSON.call( this, meta );
|
|
1244
|
+
data.inputNodes = {};
|
|
1245
|
+
|
|
1246
|
+
for ( const { property, childNode } of this._getNodeChildren() ) {
|
|
1247
|
+
|
|
1248
|
+
data.inputNodes[ property ] = childNode.toJSON( meta ).uuid;
|
|
1249
|
+
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
// TODO: Copied from Object3D.toJSON
|
|
1253
|
+
|
|
1254
|
+
function extractFromCache( cache ) {
|
|
1255
|
+
|
|
1256
|
+
const values = [];
|
|
1257
|
+
|
|
1258
|
+
for ( const key in cache ) {
|
|
1259
|
+
|
|
1260
|
+
const data = cache[ key ];
|
|
1261
|
+
delete data.metadata;
|
|
1262
|
+
values.push( data );
|
|
1263
|
+
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
return values;
|
|
1267
|
+
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
if ( isRoot ) {
|
|
1271
|
+
|
|
1272
|
+
const textures = extractFromCache( meta.textures );
|
|
1273
|
+
const images = extractFromCache( meta.images );
|
|
1274
|
+
const nodes = extractFromCache( meta.nodes );
|
|
1275
|
+
|
|
1276
|
+
if ( textures.length > 0 ) data.textures = textures;
|
|
1277
|
+
if ( images.length > 0 ) data.images = images;
|
|
1278
|
+
if ( nodes.length > 0 ) data.nodes = nodes;
|
|
1279
|
+
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
return data;
|
|
1283
|
+
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Copies the properties of the given node material to this instance.
|
|
1288
|
+
*
|
|
1289
|
+
* @param {NodeMaterial} source - The material to copy.
|
|
1290
|
+
* @return {NodeMaterial} A reference to this node material.
|
|
1291
|
+
*/
|
|
1292
|
+
copy( source ) {
|
|
1293
|
+
|
|
1294
|
+
this.lightsNode = source.lightsNode;
|
|
1295
|
+
this.envNode = source.envNode;
|
|
1296
|
+
this.aoNode = source.aoNode;
|
|
1297
|
+
|
|
1298
|
+
this.colorNode = source.colorNode;
|
|
1299
|
+
this.normalNode = source.normalNode;
|
|
1300
|
+
this.opacityNode = source.opacityNode;
|
|
1301
|
+
this.backdropNode = source.backdropNode;
|
|
1302
|
+
this.backdropAlphaNode = source.backdropAlphaNode;
|
|
1303
|
+
this.alphaTestNode = source.alphaTestNode;
|
|
1304
|
+
this.maskNode = source.maskNode;
|
|
1305
|
+
this.maskShadowNode = source.maskShadowNode;
|
|
1306
|
+
|
|
1307
|
+
this.positionNode = source.positionNode;
|
|
1308
|
+
this.geometryNode = source.geometryNode;
|
|
1309
|
+
|
|
1310
|
+
this.depthNode = source.depthNode;
|
|
1311
|
+
this.receivedShadowPositionNode = source.receivedShadowPositionNode;
|
|
1312
|
+
this.castShadowPositionNode = source.castShadowPositionNode;
|
|
1313
|
+
this.receivedShadowNode = source.receivedShadowNode;
|
|
1314
|
+
this.castShadowNode = source.castShadowNode;
|
|
1315
|
+
|
|
1316
|
+
this.outputNode = source.outputNode;
|
|
1317
|
+
this.mrtNode = source.mrtNode;
|
|
1318
|
+
|
|
1319
|
+
this.fragmentNode = source.fragmentNode;
|
|
1320
|
+
this.vertexNode = source.vertexNode;
|
|
1321
|
+
|
|
1322
|
+
this.contextNode = source.contextNode;
|
|
1323
|
+
|
|
1324
|
+
return super.copy( source );
|
|
1325
|
+
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
export default NodeMaterial;
|